Postgis / working with polygons (example) #1201
SebastiendOrnano
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I wanted to add a land plot module in my app COOP to visualize the limits of the plot where a building is located. That means a map showing a polygon. But the PostGIS example in the SQLpage doc shows only how to work with points. I thought it will be difficult (at least, for me, as I am new to PostGIS and still a beginner with SQL) to introduce the data of polygons. But no. I am truly impressed by the duo SQLpage + PostGIS. It is amazing what you can do, easily, when working with spatial data when combining those two !
Step 1 :
I draw the polygon in umap. Then right click on the polygon -> copy as GeoJson to produce MyPolygon.geojson
Step 2 :
Create an extension postgis in postgresql and a table "polygons"
Step 3 :
create polygons_form.sql (I used the example of csv file upload from the SQLpage doc about the form component. I thought first that the file upload was limited to csv file but as far it is a text file with a structure, you can work with any type of file. I tested with a GeoJson file, but the process could , probably, be adapted to other formats such as KML, GPSX...)
Step 4 :
create geojson_upload.sql (this example works with a simple geojson polygon file. It should be possible to code a more sophisticate process to deal with multiple polygons or to extract data from KML or GPSX files)
Step 5 :
create polygon_map.sql
Beta Was this translation helpful? Give feedback.
All reactions