Hey guys I am trying to create a KML layer for my google map on my own PHP based website for a project.
The URL for the API I want to use doesn't seem to work for me. The API can be found here. http://openchargemap.org/site/develop/api. Its for electric vehicle charging stations to be presented on the map.
When using other APIs and googles examples, they work fine with my code, using the one I need will not work.
var kmlLayer = new google.maps.KmlLayer({
url: 'http://api.openchargemap.io/v2/poi/?output=kml&countrycode=GB&maxresults=500',
suppressInfoWindows: true,
map: map
});
The above code is inside my initialise map function.
I have tried different variations of the API for the url which none of them work. The example above is for UK results with a maximum of 500 with the output set to KML.
What I have noticed which could be useful is that when this API is entered into the browser with the output as KML, it downloads locally as an unrecognised file where as the google samples on the developers page and other APIS download directly as KML's.
The unrecognised file when opened with Notepad++ is the KML functionality that I want and can be saved as a KML which could be uploaded and used that way. Which makes me think there could be something wrong with the Opencharge map API. But I am all new to this so any help is appreciated!
Thanks guys!