Comments (5)
@Wingong - I'm assuming you're trying to access Feature
attributes. If so, you can use feature_kv_iterator
#include <mapnik/feature_kv_iterator.hpp>
.....
while (auto feature = features->next())
{
feature_kv_iterator itr(*feature, true);
feature_kv_iterator end(*feature);
for (; itr != end; ++itr)
{
std::cerr << std::get<0>(*itr) << ":" << std::get<1>(*itr).to_string() << std::endl;
}
}
or
auto itr = feature->begin();
auto end = feature->end();
for (; itr != end; ++itr) { ... }
or
for (auto const& kv : feature)
{
std::cerr << std::get<0>(kv) << ":" << std::get<1>(kv).to_string();
}
HTH
from mapnik.
@artemp I tried feature_kv_iterator
, but it seems not working. itr is equal to end, so nothing was iterate. Besides, I read the code of the input file shape.input
, exactly dbf.hpp
and dbf.cpp
in it. When reading dBase file, it doesn't load records, but only the header (using read_header()
function). I thought if it could cause the problem?
from mapnik.
@Wingong Could you share your shapefile if it's not too large?
from mapnik.
@artemp Of course, but i don't know how to upload file - however, it is just the demo shapefile in mapnik source code, like src/demo/data/boundaries
and others. Thanks very much!
from mapnik.
@artemp update: using mapnik::rule and add rules to style can filter the write shape (like r.set_filter(parse_expression("[NAME_EN] = 'Ontario'"));
). I tried using map.query_point(index, x, y)
, and features in it contain correct context.
from mapnik.
Related Issues (20)
- Is there a Dot Net wrapper anywhere? HOT 12
- Feature request: allow empty Multi* geometries HOT 1
- Misoriented altitude labels on contour lines HOT 4
- make failed in ubuntu 23.04 (with quick and dirty fix) HOT 1
- compile fails under ubuntu noble if you include proj.h HOT 2
- mapnik On Window10
- Support percentage values with a fractional component HOT 1
- 4.0.0-rc1 pollutes /usr/include toplevel directory HOT 1
- Github actions - Linux and MacOS runners are faliing HOT 8
- Text not rendered correctly in visual-tests HOT 4
- GCC 14 build errors HOT 4
- Proposal: new logging and formatting HOT 2
- Using of `simplify_prefilter` parameter in PostGis datasource HOT 3
- Windows build is broken on github HOT 3
- FR: allow loading of styles with missing layer data files HOT 1
- bad rendering of specific Arabic text HOT 2
- Fails to build with GCC 14 HOT 4
- The 4.0.1 release archive contains a lot of Apple specific noise HOT 5
- Brew not including mapnik-config in 4.0.0 install HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapnik.