Hello from France
For a project, i would like to be able to put POI on a custom umap map, using a HTML form.
- I have done the HTML form, it use nominatim calls to retrieve longitude and latitude from an adress
- I can store those coordinates in a database, export it to a csv file and import this file via the umap web interface
Is there an API out there that would save me this last painfull step, allowing me to directly send the POI to my umap map?
There is something similar for OverPass, see http://www.mappa-mercia.org/2014/09/creating-an-always-up-to-date-map.html
You could provide an API to your database via URLs. You can then configure umap to call those URLs.
Hello escada, thank you for your answer
Do you think this could work :
- i use the html form to create a new poi
- the poi is saved in my database
- the insert in database trigger a cron job and a new csv file is created on the server
- the umap map is set to retrieve csv data from the url of the csv file on my server
That would be sweet!
If you go to remote data in umap (it’s in the layer properties). You will see csv as one of the possible formats.
I have not tried this, but if you fill in the URL of your (always up-to-date) csv file, this might work.
At least this how it works for data from the Overpass servers
I will try it and keep this topic updated for futur users who might have the same need.
Thank you escada
Ok, it works. Here is what i did:
- umap wants https url to use remote data, so use it
- on my server, i have several csv files, each one for a different poi category on umap
- i wrote a php script that takes a GET parameter to identify which csv file is requested and return it
- in this php script i set header(‘Access-Control-Allow-Origin: https://umap.openstreetmap.fr’); to allow umap to request ressource from my server
- for each poi category on umap, i set the endpoint in the remote data entry, example https://myserverurl.com/getCsvFile.php?cat=stuff
- you can set the remote data to be dynamic : if you are editing you own map on umap and that the distant cvs file change, for example a marker is added, the poi will literally pop on the screen. If you monitor your map from a public iframe, data will pop only when you move arround your map or request it.
Hey Thanks for creating this thread, i managed to replicate this on my server.
I figured it would be way easier for most people (including me) to just use github.com or similar as remote data source - since you don’t need your own server.
- Open a File in your projects git repository on github.com
- click on “raw” to copy the link starting with “https://raw.githubusercontent.com…”
- use that link as remote data URL in umap
My use case is displaying events in different categories as different layers on a umap, while fetching the Data from a Nextcloud Calendar. I wrote a script in python which fetches the data and outputs a geoJson file for each calendar fetched. I also have a Wordpress Form which enables people to add new events.