[GIS] Put LeafletJS geoJSON’s into a MySQL database through PHP

databasegeojsonleafletleaflet-drawPHP

I'm doing a project that will let users manipulate a map through LeafletJS, creating circles and polygons on top of the map. I need to gather these inputs for later analysis, using a MySQL database for the storing.

I was thinking in getting the input as geoJSON, then converting it into PHP by separating into several variables to correctly fill the tables in the database.

My question is more about where do I do that conversion… I imagine it is not everything on the client side right? I need to send the geoJSON to some back-end making the JSON-PHP conversion there, right? Or is there any other more direct way to do it?

Best Answer

Yes. You have to send your data from the client to the server and let server-code handle the database-insert.

You should look into HTTP POST through jQuery or other libraries as a way to asynchronously send your data from the client to the server.