PDA

View Full Version : Markers not displaying


nathan346535
03-06-2009, 08:40 AM
Hi,
I am having the problem with no marker showing on my map.
I am in a local environment at the moment and my map looks fine apart from the fact there is no marker showing.

I have copied the images locally and refer to them in my code to see if that made any difference but so far no joy.

My created js file reads as below:
function wagt_map_2() {
if(GBrowserIsCompatible()) {
if(!document.getElementById('wagt_map_2')) return false;
var map = new GMap2(document.getElementById('wagt_map_2'));
map.enableContinuousZoom();
map.enableDoubleClickZoom();
map.addControl(new GSmallZoomControl());
var geocoder = new GClientGeocoder();

var icon = new GIcon();
var markerStyle = 'Flag';
var markerColor = 'Pacifica';
icon.image = '../_img/pacifica.png';
icon.shadow = '../_img/shadow.png';
icon.iconSize = new GSize(31,35);
icon.shadowSize = new GSize(31,35);
icon.iconAnchor = new GPoint(4,27);
icon.infoWindowAnchor = new GPoint(8,3);
icon.printImage = '../_img/pacifica.gif';
icon.mozPrintImage = '../_img/pacifica_mozprint.png';
icon.printShadow = '../_img/shadow.gif';
icon.transparent = '../_img/pacifica_transparent.png';

var address_0 = {
street: 'XXXX',
city: 'XXXXX',
state: 'XXXX',
zip: 'CH5 2UA',
country: 'United Kingdom',
infowindow: 'default',
infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: #000;"><strong>Address:</strong><br />CH52UA United Kingdom</span>',
full: 'CH52UA, United Kingdom',
isdefault: true
};

geocoder.getLatLng (
address_0.full,
function(point) {
if(point) {
map.setCenter(point, 13);
var marker = new GMarker(point, icon);
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(address_0.infowindowtext );
});
map.addOverlay(marker);
marker.openInfoWindowHtml(address_0.infowindowtext );
}
else {
map.setCenter(new GLatLng(53.23486238365943, -3.022785186767578), 13);
}
}
);

}
}

Ray Borduin
03-06-2009, 09:16 AM
The paths must be wrong... remember they must be relative to the page where the map is displayed and not to the location of the .js file. Most likely that is the issue.

nathan346535
03-09-2009, 05:51 AM
My markers are still not showing.

which bit of code set the marker position?

should it automatically appear where the map.setCenter is set?

my map.setCenter latlng line reads:

map.setCenter(new GLatLng(53.23511924679029, -3.0228710174560547), 13);

anyone know if my marker needs a setting the same as that?

Ray Borduin
03-09-2009, 08:23 AM
Please post a url to the page you are having difficulty with. I will be able to test it and try to determine the correct path to use.

epiisila369765
03-10-2009, 10:06 AM
In your DW page, the extension may have done two things. If in ASP, it may have put <!--#include file="google_javascript/wagmp_map_1.asp" --> You may need to change "file" to "virtual" Also, for me document relative links did not work, I need to change it to <!--#include virtual="/InsertYourFolderNameHere/google_javascript/wagmp_map_1.asp" -->

You need to do the same thing for the .js file

<script type="text/javascript" src="/InsertYourFolderNameHere/google_javascript/wagmp_maps.js">/*wagmp*/</script>

I'm still having other hiccups, but at least the markers are displaying now.