Kakenx
Kakenx

Reputation: 1445

How to embed JSON Google map to website?

A client of mine sent me a JSON file. It's supposed to display a google map location once embedded on the site. But I am not sure how to embed this into the site. Here's a sample of what it looks like:

[
{
    "featureType": "administrative",
    "elementType": "labels.text.fill",
    "stylers": [
        {
            "color": "#ec0000"
        }
    ]
},
{
    "featureType": "administrative.land_parcel",
    "elementType": "all",
    "stylers": [
        {
            "visibility": "off"
        }
    ]
},
{
    "featureType": "landscape",
    "elementType": "all",
    "stylers": [
        {
            "color": "#008006"
        }
    ]
},
{
    "featureType": "landscape.natural",

Any Ideas?

Thanks,

K

Upvotes: 0

Views: 2427

Answers (1)

Michael Geary
Michael Geary

Reputation: 28850

That JSON file will not display a map. If you wanted to display a map based on data from a JSON file, you would write Maps API code to interpret the JSON data and display the map, or use a GeoJSON layer. But that particular JSON file doesn't have information like geographic coordinates or anything like that. The file isn't GeoJSON (JSON with geographic information). Instead, it contains settings that are used to style a map, as described here:

https://developers.google.com/maps/documentation/javascript/styling#style_syntax

In other words, this data could be used to control the appearance of a map, but not the actual contents of the map.

Upvotes: 1

Related Questions