[GIS] PostGIS convert GeoJSON to geography

geography-data-typegeojsonpostgis

While there are functions to convert geography to GeoJSON:

text ST_AsGeoJSON(geography geog, integer maxdecimaldigits=15, integer options=0);

I do not see any way to go the opposite direction (GeoJSON to geography) only to geometry.
http://postgis.net/docs/reference.html#Geometry_Constructors

Is this on the roadmap?


The data in the database has geography polygons or multi-polygons to describe each item in the DB. The query is coming from lealfet.js, which allows me to easily get the shape in GeoJSON.

What I am doing is just a simple ST_Intersects() to check for overlap and return. Yes, I have a hack to convert this to EWKT right now, but I was wondering if it was on the roadmap to support this in a future version of PostGIS, or where one adds it as a wish list (since symmetry is a good thing, and it seems a shame that only geometry is supported in that direction).

Best Answer

Why don't you just do:

SELECT ST_GeomFromGeoJSON(geojsongoeshere)::geography;
Related Question