Created
April 19, 2013 21:55
-
-
Save springmeyer/5423500 to your computer and use it in GitHub Desktop.
example of working with geojson, wkt, and wkb in mapnik python api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import mapnik | |
>>> path = mapnik.Path.from_geojson('{ "type":"Point","coordinates":[-122,48] }') | |
>>> path.envelope() | |
Box2d(-122.0,48.0,-122.0,48.0) | |
>>> path.to_geojson() | |
'{"type":"Point","coordinates":[-122,48]}' | |
>>> path.to_wkt() | |
'Point(-122 48)' | |
>>> path.to_wkb(mapnik.wkbByteOrder.NDR) | |
'\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x80^\xc0\x00\x00\x00\x00\x00\x00H@' | |
>>> path.to_wkb(mapnik.wkbByteOrder.XDR) | |
'\x00\x00\x00\x00\x01\xc0^\x80\x00\x00\x00\x00\x00@H\x00\x00\x00\x00\x00\x00' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment