1

I have PHP API (http://localhost/api.php) that gives data in GeoJSON format, how can I show that GeoJSON data on Google map ?

Dragging & Dropping GeoJSON data on map is not allowed.

1 Answer 1

3

You can use Ajax and leaflet for displaying GeoJSON data. Here is a detailed example of GeoJSON in leaflet.

You have to modify 'Ajax' given below according to your php.

$.ajax({
        type: "POST",
        url: "YourPHP.php",
        dataType: 'json',
        success: function (response) {

var gj = L.geoJson(response, { style: oldStyle }).addTo(map); });

1
  • How can I do it on google maps? Commented May 16, 2016 at 12:54

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.