Tag Info

New answers tagged

2

If Python is your thing then you can use GeoMet. It's a Python module that converts GeoJSON to WKT/WKB and vice versa. You can install it directly from the github repository using pip $ pip install git+git://github.com/larsbutler/geomet.git Here is a sample conversion: >>> from geomet import wkt >>> point = {'type': 'Point', ...


5

why not use ST_GeomFromGeoJSON which takes as input a geojson representation of a geometry and outputs a PostGIS geometry object. ST_AsGeoJSON, the inverse see Creating GeoJSON Feature Collections with JSON and PostGIS functions or ST_GeomFromGeoJSON from OpenGeo. To convert to WKT, use ST_AsText , the reverse of ST_GeomFromText() which return the ...


0

GeoJSON doesn't deal with this. Any style information is going to depend on what the renderer is, Geojson CSS seams to target SVG but you also have Carto which targets mapnik, do remember that you can add extra fields to GeoJSON and it will still validate so none of these are invalid GeoJSON.


0

Removing properties and simplifying lines are the easiest ways if you want just GeoJSON, TopoJson an modified version of GeoJson and can get some very small sized files especially if you keep it projected


1

There are a couple of problems with your JSON. Firstly, the coordinates should be an array of arrays. Secondly, looking at the coordinates, it looks like the values are Latlong in a Geographic coordinate system, most probably EPSG:4326. That then needs to be transformed to EPSG:3857. Once you correct these two things, you can insert the row, using the ...


2

I found the solution. The GeoJSON specification says that the coordinates of a polygon are an array of line strings. Therefore I had to wrap them with additional brackets. { "type":"Polygon", "coordinates": [ [ [-91.23046875,45.460130637921], [-79.8046875,49.837982453085], ...


5

Taking a look at the source code of PostGIS I found out how it parses SRIDs. Here is the correct way to specify the SRID in GeoJSON. The GeoJSON specification says that the coordinates of a polygon are an array of line strings. Therefore I had to wrap them with additional brackets. { "type":"Polygon", "coordinates": [ [ ...


2

your geojson must have UTM values instead, you could transform that with Proj or other online tools, but you can do it easily and directly with postgis before inserting it into your table, try this (untested): SELECT ST_AsText(ST_Transform(ST_GeomFromGeoJSON ( { "type":"Polygon", "coordinates":[ ...


0

WRITE_BBOX parameters is supported for OGR >= 1.9.0. FwTools contains previous version of OGR.You should download the latest installer version (for now 1.10.0) from here.


2

Adding on what R.K. is saying, your best bet is to refine your postgis query to build the entire GeoJSON object. This should explain how: http://www.postgresonline.com/journal/archives/267-Creating-GeoJSON-Feature-Collections-with-JSON-and-PostGIS-functions.html


1

According to the docs, ST_AsGeoJSON() returns the geometry as a GeoJSON element. It does not return a whole GeoJSON object. Here is an example of a full GeoJSON object: { "type": "Feature", "id": "OpenLayers.Feature.Vector_314", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 97.03125, ...



Top 50 recent answers are included