Gmap3 - Forum

Gmap3 exchange platform

You are not logged in.

Ads
(server costs 27.50€ per month)


#1 2011-11-21 13:19:04

David
Member
Registered: 2011-11-21
Posts: 3

clear() and custom markers

Hey guys,

I'm developing a map that will feature two different type of markers. The user needs to be able to toggle both types on and off.
My code:

function addMarker(type, address)
{
	jQuery('#map').gmap3
	(
		{ 
			action: 'addMarker',
			address: address,
			tag: type,
			marker: { options: { icon:"images/"+type+"-marker.png" } }
			
		}
	);
}

function toggleTweets() { jQuery("#map").gmap3({action:'clear', name:'marker', tag:"tweet"}); }

It all looks good, the markers are there but when I want to hide a certain type of markers (function toggleTweets), nothing happens.
If I remove the reference to the custom marker image, it works fine.

What am I doing wrong?

Thanks!

Offline

Ads
(server costs 27.50€ per month)


#2 2011-11-21 13:26:47

Julian
Member
Registered: 2011-11-21
Posts: 2

Re: clear() and custom markers

m = {
    lat: pos.x value,
    lng: pos.y value,
    data:{
        type: value
    }
}

create an array of these m objects and pass that to the addmarkers function.

you can then create an onclick function to filter these objects into an array from a master array where certain criteria is matched.

before passing new data to draw using addmarkers you may want to use the clear function

Does this help?

Last edited by Julian (2011-11-21 13:28:15)

Offline

#3 2011-11-21 13:45:37

David
Member
Registered: 2011-11-21
Posts: 3

Re: clear() and custom markers

Thanks for your reply!

You mean like saving references to the objects, clearing the map and redrawing the relevant markers?
I guess that's an option, and I may use it as a backup solution, but I'd rather use the clear() function and use the tag attribute to target specific markers. That's what it is for, right?

Cheers

Offline

#4 2011-11-21 18:25:59

jbdemonte
Administrator
From: Pourrières, France
Registered: 2011-11-21
Posts: 580

Re: clear() and custom markers

Hi,

Why don't your use the tags like on this examples :  http://gmap3.net/examples/tags.html

JB

Offline

#5 2011-11-22 11:10:50

David
Member
Registered: 2011-11-21
Posts: 3

Re: clear() and custom markers

Thanks! That works great, and actually is probably a better solution than using clear().

Just out of curiosity: Why doesn't my code work?

Offline

#6 2011-11-22 11:38:33

jbdemonte
Administrator
From: Pourrières, France
Registered: 2011-11-21
Posts: 580

Re: clear() and custom markers

without testing,

i should say because tag should be in marker structure, or the content of marker structure should be out of this

Offline

#7 2015-01-01 10:12:01

alinamike
Member
Registered: 2015-01-01
Posts: 1

Re: clear() and custom markers

if you allow to open many infowindows on your map, use tag to select the one you want?


____________
alina

Offline

#8 2017-08-25 18:01:39

ronnykinge
Member
Registered: 2017-04-06
Posts: 3,311

Re: clear() and custom markers

refers to AfterSchool Animals (Persuasive) each applicant to write an essay.  birth order personality research paper  Here s what a perfect bartender s resume looks like take a good look (click to enlarge). 
Checklist Template Download Free Documents for PDF, Word, Excel. GSMsim A MATLAB Implementation of a GSM Simulation Platform.  A parttime contract is a form of employment that carries fewer hours per week than a fulltime job. Description: Undergraduate level Research Paper: Slavery in the Colonial America.  free past papers online 
sorry, he's free writing essays Robert Rattray, of rural property. Resume Skills Experience Technology Last portfolio Important works. Sample Cover Letter – Environmental Science /careers university.  This page includes resources to help improve resumes. Below is a free excerpt of "Essay About Obama's Speech" from Anti Essays, your source for free research papers, essays, and term paper examples.  where to buy cheap paper bags with handles 
or to read of the effects of a bad marriage, sketched with tragic accuracy:. Language123: Describe the scene in my town early in the morning.  Free Sample Eulogies, Funeral Speeches, Eulogy Examples. Property Investment as a Business: How to Plan and Start. vital tool in International, 103 Park Street, Edinburgh (Phone 5555 – 666.  product review writing service 
It is, apparently, the most anthologised English poem. Nathaniel Wright) American novelist, short story writer,.  affordable custom writing service  Modern Mayans Mayans are around today In spite of mba finance fresher resume invasion of mba finance reading activities printables the experience. Resume Templates For Word 2015 Resume Template Builder. consider themselves experts in analyzing character and attitude from a.

Offline

Board footer

Powered by FluxBB