I need to, using gmaps.js, grab marker information from a .json file and display the marker locations on my local html page.
I have been able to do this successfully with the standard Google Maps Platform API using the example given here: https://developers.google.com/maps/documentation/javascript/importing_data
My geojson file is in the same format as the one in the example above. However I would like to use gmaps.js because of its simplicity and ease of use. How can the above code be adapted and used with gmaps.js?
Here is my very basic code so far:
var mapObj = new GMaps({
el: '#map',
lat: 30.267283,
lng: -90.554560,
zoom: 2,
minZoom: 2
})
/*attempting to place markers from geojson file*/
/*managed to add markers manually*/
mapObj.addMarker({
lat: 30.267283,
lng: -90.554560,
title: 'Marker with InfoWindow',
infoWindow: {
content: '<p>HI!</p>'
},
click: function(e) {
mapObj.map.panTo(e.position);
}
});
I have attempted to use: https://hpneo.dev/gmaps/examples/json.html
However my webpage seems to result in a blank white screen.