GeoJson from PostGIS

Here is a way to check how big the simplified files will be when varying the 0.1 parameter and the max number of decimals (it may also be possible to improve this to make the concatenation of all rows fully valid geojson directly, otherwise we can use Geoserver):

SELECT bit_length(array_to_string(array(SELECT ST_asGeoJson(ST_SimplifyPreserveTopology(geom,0.1), 6) FROM outant_2008_polygon) , ‘,’))

http://postgis.refractions.net/documentation/manual-svn/ST_AsGeoJSON.html

···

On Mon, Oct 26, 2009 at 9:37 PM, Knut Staring knutst@gmail.com wrote:

…in order to use the new functions and create queries like this:

SELECT ST_asGeoJson(ST_SimplifyPreserveTopology(geom,0.1))
FROM outant_2008_polygon

Also very cool to be able to do this in OpenJump:

SELECT ST_AsBinary(ST_SimplifyPreserveTopology(geom,0.1))

FROM outant_2008_polygon

http://www.postgresonline.com/journal/index.php?/archives/72-OpenJump-for-PostGIS-Spatial-Ad-Hoc-Queries.html

Knut


Cheers,
Knut Staring