I gone thought all of the guides but every time I try to set a
Latitude / Longitude outside Norfolk it totaly go's mad and puts me in
the north sea?
Here is all of my code that I am using I can not find any problems
with this and its doing my head in now. have been working on it for 2
weeks now.
I have 2 interfaces one to set the Latitude / Longitude and one to
display it.
I save it all into the database.
Basic the following Script sets the Locations and then does a POST
back this information for me to use with PHP on a other page etc looks
to be all working fine.
////////////////////////////////////////////////////////////////////////////////
Seting locations
var marker;
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(52.413983, 0.339468), 6);
var mapControl = new GMapTypeControl();
map.addControl(mapControl);
map.addControl(new GLargeMapControl());
GEvent.addListener(map, "click", function(overlay, latlng) {
if (latlng) {
map.clearOverlays();
marker = new GMarker(latlng, {draggable:true});
GEvent.addListener(marker, "dragstart", function() {
map.closeInfoWindow();
});
GEvent.addListener(marker, "click", function() {
var lat = latlng.lat();
var lng = latlng.lng();
var html = 'crap removed';
marker.openInfoWindow(html);
});
map.addOverlay(marker);
}
});
}
}
function createMarker(point, name, image, price, icontype, sitelink)
{
var marker = new GMarker(point,icons[icontype]);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml('crap removed');
});
return marker;
}
/////////////////////////////////////////////////////////////////
Displaying all of the location
var marker;
var map = null;
var geocoder = null;
var iconBlue = new GIcon();
iconBlue.image = 'http://labs.google.com/ridefinder/images/
mm_20_blue.png';
iconBlue.shadow = 'http://labs.google.com/ridefinder/images/
mm_20_shadow.png';
iconBlue.iconSize = new GSize(12, 20);
iconBlue.shadowSize = new GSize(22, 20);
iconBlue.iconAnchor = new GPoint(6, 20);
iconBlue.infoWindowAnchor = new GPoint(5, 1);
var iconRed = new GIcon();
iconRed.image = 'http://labs.google.com/ridefinder/images/
mm_20_red.png';
iconRed.shadow = 'http://labs.google.com/ridefinder/images/
mm_20_shadow.png';
iconRed.iconSize = new GSize(12, 20);
iconRed.shadowSize = new GSize(22, 20);
iconRed.iconAnchor = new GPoint(6, 20);
iconRed.infoWindowAnchor = new GPoint(5, 1);
var customIcons = [];
customIcons[1] = iconBlue;
customIcons[2] = iconRed;
function initialize() {
if (GBrowserIsCompatible()) {
geocoder = new GClientGeocoder();
}
}
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(52.413983, 0.339468), 6);
GDownloadUrl("phpsqlajax_genxml.php", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var sitelink = markers[i].getAttribute("ID");
var Name = markers[i].getAttribute("NAME");
var Image = markers[i].getAttribute("IMAGE");
var Price = markers[i].getAttribute("PRICE");
var Type = markers[i].getAttribute("TYPE");
var Point = new GLatLng(parseFloat(markers[i].getAttribute("LAT")),
parseFloat(markers[i].getAttribute("LNG")));
var marker = createMarker(Point, Name, Image, Price, Type,
sitelink);
map.addOverlay(marker);
}
});
function createMarker(Point, Name, Image, Price, Type,
sitelink) {
var marker = new GMarker(Point,customIcons[Type]);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml('crap removed');
});
return marker;
}
}
}
XML DATA is like
<marker ID="31" NAME="Pan Africa Market" IMAGE="1222874563.jpg"
PRICE="£251,561" LAT="53.63161060657857" LNG="7.204101607203484"
TYPE="1"/>
Anyone got any ideas why this is doing this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---