cschwarz / wkx

A WKT/WKB/EWKT/EWKB/TWKB/GeoJSON parser and serializer.
MIT License
316 stars 62 forks source link

wkb to GeoJSON #5

Closed spatialhast closed 9 years ago

spatialhast commented 9 years ago

I store coordinates in wkb format (data get from PostGIS DB, geometry Field the_geom geometry(Geometry,4326)). Example http://spatialhast.github.io/index.wkb.to.geojson.html. In ' var the_geom' - wkb data of polygonal geometry. In geometryType of wkx.js I receive wrong number of geometry type (536870915). In 'var geojson' - example of GeoJSON data which need receive wrom wkb data. Possible convert wkb in GeoJSON data (to display on map via Leaflet.js)?

cschwarz commented 9 years ago

PostGIS stores the geometry in ewkb format. You can use ST_AsBinary to get wkb out of it.

spatialhast commented 9 years ago

Thanks! Initially I use https://github.com/tobinbradley/dirt-simple-postgis-http-api to publish data from PostGIS DB in JSON format and there data in geometry field is in WKB format. Using wkx plugin I want convert in GeoJSON format. I change SQL query in from dirt-simple-postgis-http-api plugin to receive GeoJSON format.

derrickpelletier commented 9 years ago

@cschwarz is a conversion from EWKB something you've attempted? Or is it not possible?