🔙 Visualizing polygon with ST_AsGeoJSON and leaflet
7/22/2020
ST_AsGeoJSON
is a pretty neat function of postgis, and in fact is supported by many others databases.
#TIL about the ST_AsGeoJSON function of @postgis. I used that to transform a polygon stored in the database into a GeoJSON format. GeoJSON is a standardised format for encoding geographical data structures. I then pumped that to a @LeafletJS map 🥳https://t.co/XzcSH6hR5d pic.twitter.com/VAcBrdEXpn
— Rafael Nunes (@peaonunes) July 22, 2020
It allows you to transform a regular polygon stored in your database to GeoJSON. Plenty of tools and applications adhere to that format, and you can use them visualize your polygons 😄.
After exporting the result looks something like the map below: