I have created a React application to display a Leaflet map, with a series of polygons over the top. The data source for the polygons is a GeoJSON file.

As part of the app, I am giving the user the ability to change the background colour of the polygons (by changing the feature's 'fillColor' property).

To enable this, I have converted the GeoJSON file to a Shapefile using QGIS, and loaded it into a 'spatial' table in MySQL. This now provides the ability to alter the fillColor property for each feature by its ID, via an API put request.

The issue I've got is that I want to render the map (including any fillColor changes) on the front end, but I'm struggling to work out (or find information on) how to do this.

Is there a way of using the MySQL table as the Leaflet map data source instead of using the GeoJSON file?

  • Welcome to GIS SE. As a new user, please take the Tour, which emphasizes the importance of asking one question per Question. Ending your post with two questions is likely to result in closure. Please Edit the question to focus on the solution you really want.
    – Vince
    Apr 13 at 20:07
  • No, it's not possible. You write "I am giving the user the ability to change the background colour". If this is happening client side (browser), you can do this with Leaflet, you don't need server side for that.
    – TomazicM
    Apr 13 at 20:16


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.