I used something like:
var map; function initialize() { map = new google.maps.Map(document.getElementById('map-canvas'), { zoom: 4, center: {lat: -28, lng: 137.883} }); map.data.loadGeoJson('https://storage.googleapis.com/maps-devrel/google.json'); } google.maps.event.addDomListener(window, 'load', initialize);
to upload a geojson form file to the map.data layer of my map. There are several classes of functions in the form file that define the polygons that need to be drawn on the map. So far I have not had a problem.
Later, however, I want to load another geojson file on top of another (replacing the drawn "functions" on the map). When you simply upload another file on top of another, it simply redraws it on top of the other. How do you clear the map.data layer of all functions before loading them into a new geojson form file?
I tried using map.data.remove(feature) with an outline, but I cannot get all the functions from the map.data layer.
source share