Ticket #28 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Implement expected interface for Feature.properties

Reported by: artem Owned by: artem
Priority: Milestone: 0.5.0
Component: Boost.Python Binding Version: SVN Trunk
Severity: Normal Keywords: map_indexing_suite to_python
Cc: Patch Needs Improvement:
Needs Docmentation: Has Patch?:
Design Decision Needed:

Description

for f in ds.features_at_point(merc):

print f

<mapnik._mapnik.Feature object at 0xb7f163ac>

on that, I'd expect to be able to call:

for (k,v) in f.properties:

but I can't. Also, if I do:

f.propertiestype?

I get back a mapnik._mapnik.Value object, and not a native python object as I'd expect

Also, if I do

for prop in f.properties:

you have to call key() and value(), it'd be good if there were python attributes for them

Nick

Change History

Changed 3 years ago by artem

  • keywords map_indexing_suite to_python added
  • status changed from new to closed
  • resolution set to fixed

I added two to_python converters:

  1. std::pair<std::string,mapnik::value> to boost::python::tuple
  2. mapnik::value to native Python types e.g int,float and unicode str.

and modified map_indexing_suite2.

Example

from mapnik import *

ds = Datasource(type='postgis',host='localhost',user='artem', dbname='planet_osm', table='planet_osm_polygon')

pt = Coord(-35555.19,6662160.5)

print "querying at point " + str(pt)
for f in ds.features_at_point(pt):
    for k,v in f.properties:
        print " %s = %s " % ( k,v ) 


Note: See TracTickets for help on using tickets.