Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

having map component zoom into a particular country when first displayed

I want a google map component to zoom into a country when first rendered. I know that I can do this by setting the address to be the centre of the country and then setting the zoom level.

My problem with this is that I don't want the location marker to show, or I wan't to be able to remove it when I search for a driving route.

Can this be done?

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

having map component zoom into a particular country when first displayed

Terry,

You can remove a marker by setting it's map to NULL .... here's another code snippet....

function fClearGPSMarkers() {
if (aMarkers.length !== 0 || aMarkers !== '[]') {
for (var i = 0; i < aMarkers.length; i++) {
this.aMarkers.setMap(null);
}
}
return true;
}

if you have only one marker - of course no need to keep track of them in a global array (what's assumed above).

Of NOTE - although it's your first thought - a map has markers - it's actually the other way around - a MARKER has a map - and in order to show a marker - you create it - and then associate it with a map , and then when you want to delete it from the map - you tell the marker to no longer associate itself with the map.

Hope this helps!

Happy Tuesday again!
Bruce

Return to “Issues”