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


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
    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.

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