erme Posted September 3, 2009 Share Posted September 3, 2009 Hi, I have a database of different uk addresses and a separate field for counties. on the webpage a user can click on a county name and the google map will display all the addresses of only that county. All works fine and dandy. Currently the map only displays the default Lat and Long I have entered. The question is, how would I go about making the map display the county so that the user doesn't have to scroll to the county to view the addresses displayed. Here is the code that specifies the 'default' location for the map upon load/refresh: function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(50.389496, -4.748574), ; GDownloadUrl("/includes/locations.php", function(data) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { var Name = markers[i].getAttribute("Name"); var Address = markers[i].getAttribute("Address"); var Tel = markers[i].getAttribute("Tel"); var point = new GLatLng(parseFloat(markers[i].getAttribute("Lat")),parseFloat(markers[i].getAttribute("Long"))); var marker = createMarker(point, Name, Address, Tel); map.addOverlay(marker); } }); } } Link to comment https://forums.phpfreaks.com/topic/173002-google-map-default-lat-and-long/ Share on other sites More sharing options...
erme Posted September 4, 2009 Author Share Posted September 4, 2009 Am I right in saying it would require some sort of array? I'm really confused on this one. Link to comment https://forums.phpfreaks.com/topic/173002-google-map-default-lat-and-long/#findComment-912460 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.