Google Map Api V3 - Setting Mutiple Markers Using Checkboxes?

Mar 25, 2011

I was using a google map V2 API, but decided as it is deprectaed, to step up and use the latest version, and it is doing my head in. Basically all I want is a map, that has 5 checkboxes, checkbox1, checkbox2 etc... and if one or all is checked then a marker will appear on the map that I have location preset, the marker when clicked will show a little information and contain a url. I was able to get the map with the five markers completed using V2, but when I was researching how to use checkboxes, i kept being led to the V3 API. I think the Google documentation is pretty bad for this PAI, as there is tons and tons of information but none of it is explaing the simple things, like how to set mutilple markers in V3. It will instead show you how to create polygons using images and fancy stuff that is not essential.

View 24 Replies


ADVERTISEMENT

JQuery :: Setting Custom Markers With Google Maps API?

Apr 14, 2010

I have a few questions:

1. In the current script, the markers are set to be random within a radius. What would be an easy way to switch from that to using individual markers that I set from latitudes and longitudes? I'm going to be using around 5 way points surrounding an area and can either hard code or throw in some PHP code.

2. In addition to setting my markers, the navigation is done through generated links like "Point 1", "Point 2", and so forth. How would I insert code to replace .html("Point "+i) with something else? I'm guessing to have a main city, have a few towns around it, and the "Point" links are replaced with text I want to use. Probably hard code or use PHP/MySQL to show a zip code or town related to that marker.Here is a sample of the JavaScript code. I only threw in PHP echo tags for the start lat/long and I have that set:

Code:
$(document).ready(function(){
var map = new GMap2($("#map").get(0));
var StartArea = new GLatLng(<?=$latitude?>,<?=$longitude?>);[code].........

View 1 Replies View Related

Google Maps & Mutiple Domains But One Site.

Jul 30, 2006

I have a site that uses 2 domains to forward to the IP no. (a .org.uk and .co.uk). The site uses the Google Map API for a map on the site, however the API key is locked to the individual domain (I do have two keys for both the domains). I found the following Javascript which is supposed to switch the key depending on the domain that is accessing the page.

Code:

if (window.location.host == 'www.domain1.com') {
document.write('<'+'script
src="http://maps.google.com/maps?file=api&v=1&key=key/for/domain1"
type="text/javascript">' +
'<'+'/script>');
} else if (window.location.host == 'www.domain2.com') {
document.write('<'+'script
src="http://maps.google.com/maps?file=api&v=1&key=key/for/domain2"
type="text/javascript">' +
'<'+'/script>');
} else {
alert("host ="+window.location.host);
}

but I can't get it to work, the page doesn't display any map (not even an alert) if I use this instead of the normal API key script.

View 4 Replies View Related

Google Map API Zoom / Center Around Markers ?

Nov 1, 2010

I have a php page that pulls MySQL marker locations.I have tried using examples for bounds etc but the map isn't centered or zoomed, it instead seems to center over the Pacific and minimum zoom level (For the url below it should be centered over the Devon region of the UK and zoomed in)the page where you can see the end result is here:

http:[url].......... whereby I was using deprecated function of GPoint for passing locations but one of the group mods kindly pointed this out and this was replaced with GLatLng but the fault is still there.

View 31 Replies View Related

Google Maps Api Multiple Markers?

Nov 5, 2010

i have a page with an input field where a user can input a name. when they do so it will bring back the postcode for that name and then display a marker on a google map in the correct place.

unfortunately some of the names have more than 1 result which means it needs to plot more than 1 marker on the map...ive spent a lot of time on this but cant figure it out.

<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">

[Code]...

View 1 Replies View Related

Markers Not Showing On Google Maps

Oct 25, 2011

I have an array of latitude/longitude data. I need to make a marker appear on the map for each lat/lng pair. But it won't. If I ask the function to print out the coordinates instead of marking them on the, map, it works fine. I don't get an error message either way, so I'm stuck. The page displays the map but without any markers. Here's the code of the function that should add markers:

//adds markers to the map
function addMarkers(locarray) {
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locarray.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locarray[i][0], locarray[i][1]),
map: map
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent('some words');
infowindow.open(map, marker);
}})(marker, i));
}}

Here's the initialize function (called on body load):
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = codeAddress("<?php echo $_POST['postal']; ?>");
var myOptions = {
zoom: 11,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
} map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}

Geocoder and map are declared as global variables. The codeAddress function returns lat and lng of the place I want to center the map around, it's been tested and works perfectly. And here is the script that declares the array and calls the addMarkers function:
<script type='text/javascript'>
var locations = [
[-33.890542, 151.274856],
[-33.923036, 151.259052],
[-34.028249, 151.157507],
];
addMarkers(locations)
</script>

View 1 Replies View Related

Google Maps Api V3 - Add Markers From A Xml File To Map

Jul 8, 2010

I have some trouble with the google maps api. I want to add markers from a xml file to my map but it seems that the function is not parsing my xml file and I am clueless.

[Code]..

View 3 Replies View Related

Google Maps - Multiple Custom Markers

Nov 25, 2011

MY GOAL - I have a database with a bunch of items and each has latitude, longitude and a category (all the items are within 1 city). I want to have a page that will show a google map, display a marker based on the lat/lng and the image of the marker should be customized based on the category of the row. For example, some rows have a 'food' category and some have a 'health' category - I have specific images I want displayed for each image. I need a script that will plot a marker for each item in my db. I have never used Google maps API before and I'm thinking V3 is what I need to use.

$query=mysql_query("SELECT * FROM table");
while($row=mysql_fetch_array($query)){
$lat=$row['lat'];
$lng=$row['lng'];
$category=$row['category'];
//SET MARKER PICTURE TO $category
//ADD MARKER TO MAP
}
I don't know javascript that well and I have tried about 40 different things and get nothing but a blank page!

View 12 Replies View Related

JQuery :: Adding Markers To A Map Using The Google Maps API?

Feb 21, 2010

Notice: This is a discussion thread for comments about the SitePoint article, Adding Markers to a Map Using the Google Maps API and jQuery.

I just got a little lost as to where the #showmarkers button comes from?

View 7 Replies View Related

Placing Google Maps Markers Via Array?

Aug 1, 2010

I've got a few locations that I'd like to put on a google map and can do it just fine when I use the following code:[code]However, when I try to do it via an array the markers appear, but not in the correct location and I can't figure out why.Below is my version where I attempt to use an array:[code]

View 6 Replies View Related

JQuery :: While Loop And Google Maps - Loaded In Several Markers Via Xml

Mar 29, 2011

I'm working on this project for university.I have loaded in several markers via xml and pushed their latlng into an array.

I have created an html link that on click should run through the marker lat lng array and pan the map to the next location in the array.

Problem is that the map just pans to the last entry in the array because it runs through the loop before the animation has played

Here is the working example[url] contains all code we are troubleshooting.

something like this is require but i'm new to jquery and not sure of the syntax. maybe i need some kind of event listener in there too?

View 1 Replies View Related

Google Maps: Database Markers Shown But How To Record?

Oct 20, 2011

so far any values recorded in my database are shown on the map:

[Code]...

View 1 Replies View Related

Resolved Google Maps API V3 - Generate Markers From Array?

Aug 24, 2009

I pulled this code from Google's example section to make markers on a v3 Google Maps API (I have added my own lat/long points and corresponding event listeners, of course, but this is still the spirit of the code):

[Code]...

It's not throwing up any errors in Firefox's developer or in IE but there it sits, a blank map. I'm sure this isn't clean or optimized code, but it looks correct to me. I've color-coded the code above to show what "for" loops are being used to try to replace which code. Hopefully that makes this more sensible.

View 6 Replies View Related

Setting Up ECommerce On My Google Analytics Account?

Nov 16, 2009

get some help setting up eCommerce on my Google Analytics account.How do I add a unique order ID to the javascript field? Do I just leave it blank? All of my customers are directed to the same thankyou page so I'm not sure how to track a bunch of unique order ID's on the one page.The code is on this site and the code I've altered below: I just need to alter the _addTrans and _addItem parts.http:[url]....This is my altered version:

HTML Code:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");[code]....

View 1 Replies View Related

Stop Google Analytics Setting Cookies On Subdomain

Jul 7, 2009

I'm trying to serve static content from a cookieless subdomain s.mydomain.org.uk, so that image/css requests from pages at [URL] don't get sent with needless cookie data. The trouble is that Google Analytics insists on adding its cookies (_utma, _utmz) to those requests anyway!

My code is:
<script src="[URL]" type="text/javascript"></script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("xxxx");
pageTracker._setDomainName("www.mydomain.org.uk");
pageTracker._trackPageview();
} catch (err) { }
</script>

View 1 Replies View Related

Prompt Box With Mutiple Messages

Aug 31, 2006

I'm trying to make a prompt where if a person types in their username, according to the name it will play a hello message with their name and have their own background.

The script so far looks like this, but I'm trying to make it work.

<script language="JavaScript">
name=prompt("Please Enter Your Name"");
if (name == "Ex1")
{
document.write("<html><head><title>Welcome " + name + "</title></head><body><EMBED src="sound1.ram"><h1>Hello, " + name + "</body></html>");
}
if (name == "Ex2")
{
document.write("<html><head><title>Welcome " + name + "</title></head><body><EMBED src="sound2.ram"><h1>Hello, " + name + "</body></html>");
}
if (name == "Ex3")
{
document.write("<html><head><title>Welcome " + name + "</title></head><body><EMBED src="sound2.ram"><h1>Hello, " + name + "</body></html>");
}
//etc
}
</script>

View 2 Replies View Related

How To Make Focus() To Mutiple Select

Nov 20, 2003

How to make focus() to mutiple select wit name "my_select[]" ?

for simple text I do
document.employee_form.employee_birth_date.focus();

View 1 Replies View Related

Searching Arrays For Mutiple Conditions?

Oct 6, 2011

I'm got an application that uses (will use) 6 drop down boxes to filter through items stored in an array, if I can get a search system sorted out.At the minute i've tried a range of ways and I can't suss this out. At the minute its counting the number of entries that match the filter criteria but its not even getting that 100% right.I've tried using one big if statment 'if condition 1 && condition 2 && condition3 = true then' etc. I've tried nested ifs. t the moment I thought I'd try to dump the values of servos into a new array, that meet the criteia of the first if, then using another if, create another array and repeat this until only the servos that meet all 6 if conditions are stored inside one array that i can then set to display on screen. if there are no matches then i can display a 'none found' messageHeres my code, hopefully its commented enough to follow whats happening,

View 11 Replies View Related

JQuery :: Place Plugin For Mutiple Elements Out There?

Jan 12, 2010

I'm searching high and low for a plugin and since my knowledge of what's available out there in way of plugins is pretty poor, I implore the assistance of [URL] I need a edit-in-place plugin that, when I click "edit", will open up the fields for two items at the same time, a title and a description. One save button, and two editable fields. Title and description should be separate fields, one field, one textfield. I've found tons of plug ins that do one item at a time, but not several.

View 1 Replies View Related

Adding Markers To Googlemaps?

Apr 8, 2009

I'm trying to get addresses from an XML doc and use them to populate a google map with markers. My problems are (A) markers don't show up when I first load the page, but if I return to the page they magically appear, angles sing and all is right with the world, and (B) Markers just flat out refuse to populate when using Firefox. My code is pretty simple and I'm just not understanding where I'm going wrong:seemlingly the offending code:

functin addMarkers(){
htt.open('get', 'phoneBook.xml', true);
http.send(null);

[code]....

View 7 Replies View Related

Put In A Line Break Between Map Markers In XML?

Apr 6, 2011

I have a lot of javascript for my google map api and I have all the information stored away in an xml file which the javascrupt reads. I have many map markers but I cannot get a line break between th esets of markers, only each and every marker. I tried this in the xml and in the javascript but I am stuck

<markers>
<marker lat="30.2672" lng="-97.7431"
name="Pantera"

[code]....

View 8 Replies View Related

JQuery :: Pass Dynamically Created Set Of Markers To GoMap?

Mar 3, 2011

The client is a realtor with a non-standard intranet which is a "conferencing" system with a very interesting built-in web server (FirstClass). They post property listings to conferences as email messages, with the property address as the message subject. I'm trying to place the addresses on a Google map using the goMap() plugin.

I've figured out how to read the conferences and extract the addresses to a web page, either as well-formed JSON or as a string formatted exactly as one would hard code it for goMap, but when I attempt to initialize a map it either rejects it with an error, or ignores it and gives me the default map (of Europe). If I copy/paste the server-generated string into the init function it works just fine.

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

[Code]....

how to get that info into my initialization function dynamically?

View 1 Replies View Related

Cross Browser Accessing Markers In An Embedded Video

Dec 22, 2011

I have a video (.wmv) that has markers in it one can access these markers in video players like "Windows Media Player" at "view" -> "file markers"

I want to embed the video object in an HTML page and be able to let the user jump to these markers via JavaScript or such. I managed to do this with Internet Explorer ודןמע JavaScript but I can't get any other browser to access these markers or any timeline. function for that matter. I need to be able to do so cross browser.

View 2 Replies View Related

JQuery :: $.goMap() - Load Markers Dynamically With Ajax Request

Nov 8, 2010

I want to load markers with an ajax request that retrieve data in json format all the markers.

I have no problem with the json data and ajax request but I don't know how to give this json data to $.goMap plugin.

Ajax with json data.

This is the right format of data that I want to achieve but dinamically, with ajax request:

View 2 Replies View Related

Google Maps Adding A Second Google Map To A Page

Apr 7, 2011

I'm not sure where I have translated this incorrectly. I have one google map embedded on my page which works fine. But I wanted to add a second one. I thought the easiest way to do this would be to have a second page which is called later on with all the details on it for the second map. However although I think (this I presume is where I went wrong) I have replicated the instructions correctly the place holder for the second map just remains blank.

This is the code for my called page with the instructions for the second map:

And this is the script of the main page, just in case I would be better off keeping them both in one place.

<head>

I've cut out the script that doesn't relate to this so I hope I haven't missed anything important.

View 1 Replies View Related

Make A Webpage That Displays A Googlemap With Multiple Markers Based On Data From An XML File

Jul 5, 2011

I have Been trying to make a webpage that displays a googlemap with multiple markers based on data from an XML file but can't seem to get it to work. Would be ETERNALLY grateful to anyone who can pick out where I'm going wrong!

<html>
<head>
<script type="text/javascript">
function callXML(){
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
[Code]...

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved