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


ADVERTISEMENT

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

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 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

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

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

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

Adding Google Maps With Custom XML To This Complex Site?

Jul 23, 2009

Enter a search term and:1) Google Blog Results show up2) Twitter Search Results show up3) Google Maps with custom xml data shows upI have accomplished the first 2 parts - http://www.justincener.com/xmlI now want to add in Google Maps. The idea is to type in a athlete's name and have results come back from Google Blog Search (done), Twitter (done), and Google Maps. I only need to show 2-3 choices, so I want to create a custom Google Maps XML doc that corresponds to a few search terms. For example, when someone types in "Tom Brady", I want a Google Map to also come up along with the Google Blog and Twitter Results.

On the map, I want to plot 4 points showing his 4 next games. I think I know how to create the custom XML for GMaps, but I don't know how to implement it so that when someone enters input, the GMaps will show up. Can anyone get me started in the right direction please?Here is the JS so far that handles Google Blog Results and Twitter Results:

var errorCount=0;
var twitter_link;
function searchGoogle(query)

[code]....

View 16 Replies View Related

JQuery :: GoMap() Plugin For Google Maps - Use Of Several Maps On One Page Is Not Possible

Jan 5, 2011

I want to have several maps on my aspx/ascx-Webpage, but only the last one is rendered after PageLoad(). Is there any limitation for that in the goMap() plugin?

View 1 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 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 View Related

Using Google Maps For Land Use Maps

Dec 31, 2010

I'm developing a land use map and want to use Google Maps. Just want to ask if the Javascript API could actually handle overlays like this sample: URl...Or you would suggest other ways to do this?

View 2 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

JQuery :: Google Maps Style Draggable Div?

Oct 10, 2011

I am a total newbie and am trying to get a google maps type draggable div working for this site www.bingbangbosh.ie. Wondering is it possible to have the div set to a certain width, then when dragged the larger image within the div is dragged around until the cursor meets the edge of the div. would it also be possible to contain this draggable div to a larger div so that it would not be possible for it to disappear off the visible 'window'.[URL]..

View 3 Replies View Related

JQuery :: Show Google Maps With Its Popup Box?

Jan 6, 2011

I want to inject particular data from a webservice into a popup (not the default popups).

So, is there a way to show a Lightbox (or Fancybox) popup when clicking a Google maps marker ?

View 2 Replies View Related

JQuery :: Integrating Google Maps API Into App - Event Bubbling

Jan 9, 2012

I'm in the process of integrating the google maps api into my application. Unfortunately, my events seem to be bubbling. If I open the google maps info window 3 times and click the next button respectively, on the forth time when I click the next button the next event will fire four times. How do I stop this?

$("#google_map_canvas").on("click", "#next", function() {
var toHighlight = $('.first').next().length > 0 ?
$('.first').next() : $('#infoWin li').first();
$(this).fadeOut(100);
$('.first').fadeOut(100);
$('.first').delay(100).removeClass('first');
toHighlight.delay(100).addClass('first');
$('.first').delay(100).fadeIn(100);
$(this).delay(100).fadeIn(100);
});

View 7 Replies View Related

JQuery :: Point Of Loading The Google Maps Api File?

Apr 28, 2009

Point of loading the google maps api file?

[Code]...

View 1 Replies View Related

JQuery :: Using Pretty Photo Lightbox With Google Maps API

Oct 19, 2011

I'm using the pretty photo lightbox with the google maps api to load a map into a lightbox window when a link is clicked. There is a basicfunctional example here which is sort of working(click the link x 2 when you get on page): [URL]. I've taken the functionality from a tutorial by the creator of the plugin, and now want to extend it so that i can have multiple links on the same page, that open a different map according to the data attributes for the a tag.

I have this functionality working, to a degree, except that the callback function that initialises the map only fires on the second click of the link, it will not fire on the first clickevent - I've tried debugging in firebug - the click event is registered each time no problem, but the changepicturecallback function provided by prettyPhoto doesnt fire on the first click.

View 2 Replies View Related

Jquery :: Google Maps API Page Showing Error With IE6 / 7

Oct 22, 2009

I have a problem with javascript in IE6/IE7, or specifically with jQuery. There is a page that uses the google maps API which shows an error when you navigate to the website and the page remains blank. When I press refresh I get no error and the page loads as it's supposed to (this happens only ie IE6, IE7/8 appear to work fine). The same thing happens with tinymce and the jquery.tinymce.js plugin, which gives an error in IE6/7 but not in IE8. I can't post the URL since it's a password protected "under construction" website. The error for the Google Maps Api I get in IE6 is

Code:
Line: 215
Char: 26
Error: 'firstChild' is null or not an object
Code: 0
URL: -- left out --
And the error for TinyMCE in IE7 starts with

Code:
Line: 53
Char: 3
Error: Permission denied
Code: 0
URL: --left out--
And then when I press "yes" for "Do you want to continue running scripts on this page?" I get

Code:
Line: 19
Char: 7
Error: 'tinymce' is undefined
Code: 0
URL: --left out--

The google maps api page uses $(document).ready( fn ), while TinyMCE uses window.onload. And, as one would expect, in FF, Opera and Chrome all works fine.

View 1 Replies View Related

JQuery :: Multiple Google Maps - Invalid Argument In IE

Apr 16, 2009

[URL]. All works fine in FF but when I come to use it in IE, I get:
Code:
Message: Invalid argument.
Line: 82
Char: 18
Code: 0
URI: [URL]

View 4 Replies View Related

JQuery :: GoMap() Google Maps Plugin - Marker Shadows?

Nov 11, 2010

I'm using the goMap Google Maps plugin very successfully (and I highly recommend it) - except that I can't seem to set shadows on my map markers. There appears to be support for this in the plugin source code - but there's no documentation I can find.

Anyone got an clues on how to do this? This is a simplified version of the code I'm trying to use. I have checked the obvious/stupid things - file path is correct (the image isn't 404ing in firebug), and there's no js errors being thrown, or any other warnings reported.

[Code]...

View 1 Replies View Related

JQuery :: Google Maps - Feature - Drag And Drop The Marker

Jul 22, 2009

I want to know if this can be done using jQuery and Google Maps. In my website I have a Google map where users could add new markers with a description on it and the marker they put would be permanent on my map, meaning if they comeback they would still see the markers they added.

I also want the feature that they could just drag and drop the marker, so it would be easy to the users. What would be my approach and how would I do it?

View 1 Replies View Related







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