[postgis-users] st_geojson like st_mvt function

Regina Obe lr at pcorp.us
Wed Dec 13 01:59:27 PST 2017

This has come up in discussion before and we have a ticket for it.




I've revised the title so intent is clearer and easier to find for any others looking for it.


I think Paul Ramsey intimated he may do it for PostGIS 2.5, but that's still an iffy for him since I think he's got higher priorities.


If enough interest it will probably happen in 2.5 since I think much of the logic can be patterned after ST_AsMVT.


Feel free to add your comments to the above ticket or provide a patch or garner funding for it.







From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of RĂ©mi Desgrange
Sent: Tuesday, December 12, 2017 3:56 PM
To: postgis-users at lists.osgeo.org
Subject: [postgis-users] st_geojson like st_mvt function




this is my first mail on this list, I didn't know if I should have posted on dev list or this one. Don't hesitate to correct.


With postgis 2.4 we now have the possibility to generate mvt format directly in SQL, what I really like is the ability to construct a mvt response with geometrie + data. The sql result is directly well formated and ready to use. When I need to use geojson in my app I need something like that :


{ "type": "Feature", 



        "type": "Point", 

        "coordinates": [125.6, 10.1] 


      "properties": { "name": "Dinagat Islands" }



In order to do that I do :

SELECT name, st_geojson(geom) as geom FROM mytable


And then I my code I manipulate "name" to put it in the json under "properties" there hack around to directly return geojson, but they're hack not actual solutions.


What I imagine is something like that :


SELECT st_geojson(x) FROM (SELECT name, geom FROM mytable) x


the signature would be :


text St_AsGeoJSON(anyelement set row)


I do not know if this question has already been asked, I found nothing when I googled. Do you think that this is a legitimate feature request ?





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20171213/61e132aa/attachment.html>

More information about the postgis-users mailing list