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.


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.

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

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

  • How can I do it on google maps?
    – Balazs
    May 16 '16 at 12:54

Your Answer

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

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