Gmap3 - Forum

Gmap3 exchange platform

You are not logged in.

Ads
(server costs 27.50€ per month)


#1 2012-07-12 12:17:29

chahalsurender
Member
Registered: 2012-07-12
Posts: 6

Hide/remove direction from map

After viewing the direction from one place to another, I want to hide/remove that directions only but marker keep remain.
For this I try to implement below code but its not working

1.

var directionsDisplay = new $('#googleMap').gmap3.DirectionsRenderer();
directionsDisplay.setMap(null);

2.

$map.gmap3({ action: 'setDirections', directions: eval(null) });

First comment I have seen on google developer's map site but unfortunately this one not working in gmap3 plugin. 

Please help me to remove directions.

Thanks in advance.

Offline

Ads
(server costs 27.50€ per month)


#2 2012-07-12 21:22:50

johnnylo
Member
Registered: 2012-01-23
Posts: 7

Re: Hide/remove direction from map

Use

$map.gmap3({ action:'clear', name: 'directionsRenderer' })

Offline

#3 2012-07-13 05:19:53

chahalsurender
Member
Registered: 2012-07-12
Posts: 6

Re: Hide/remove direction from map

Hi johnnylo,
Thanks for replying but its not working and nothing happens on map.
I have tried also
1.

$map.gmap3({ action:'clear', name: 'directionsRenderer' })

2.

$map.gmap3({ action:'clear', name: 'route' })

3.

var clear = { action: 'clear', name: 'directionsRenderer' };
    $map.gmap3(clear);

4.

$map.gmap3("get").setMap(null);

But unfortunately these are not working also!

Please suggest me another code.

Thanks

Offline

#4 2012-07-13 08:54:30

chahalsurender
Member
Registered: 2012-07-12
Posts: 6

Re: Hide/remove direction from map

Hey friend,

var todo = { action: 'clear', name: 'directionRenderer' };
$map.gmap3(todo);

This code is working.

Offline

#5 2012-07-13 17:11:15

johnnylo
Member
Registered: 2012-01-23
Posts: 7

Re: Hide/remove direction from map

Try selecting the id of your map canvas in the HTML file.  For example, if the tag for your map canvas is like so

    <div id="googlemap"></div>

try

    $("#googlemap").gmap3({action:"clear",name:"directionsRenderer"});

Where did you define the object 'map'?  Are you sure it is accessible in the execution context of your code?

Offline

#6 2012-09-25 04:06:39

chahalsurender
Member
Registered: 2012-07-12
Posts: 6

Re: Hide/remove direction from map

In html code

<div id="googlemap"></div>

In javascript code

$map = $('#googleMap');
var todo = { action: 'clear', name: 'directionRenderer' };
$map.gmap3(todo);

This code is remove or hide the direction of map...

Offline

Board footer

Powered by FluxBB