1

How can I load coordinates (lng/lat) from a database (MySQL) into a map service like Google Maps or Leaflet?

Currently I only have a JavaScript which loads a GeoJSON file with coordinates.

I want to inject them from my database to the map. I'm not very skilled in web development.

Why can't I just do SQL queries in JavaScript and print the results to the map like in Java where I just loop the result set and operate on my data.

Or do I have to use PHP or some other server side scripting language? The issue is, I have to use Java to process the coordinates.

2
  • you can use php to retrieve your lat/lngs with most databases (mysql,postgres) developers.google.com/maps/articles/phpsqlajax_v3 uses javascipt (not java)
    – Mapperz
    Commented Nov 4, 2016 at 20:48
  • I have to use Java at least somewhere. A user http their coordinates and thats when I neeed java to process them. Could I use java store them in a DB and then use PHP to retreive the data from the DB to show on the map? Commented Nov 4, 2016 at 20:51

1 Answer 1

2

You could use software like MapServer or GeoServer to read your database and provide the data as a layer of layers as part of a WMS and/or WFS.

So you use Java to populate the database, and a WMS/WFS service to provide access to the data. You don't need to use any server-side scripting to get the data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.