using this to geocode a map to correct address.
function initialize() {
var mapOptions = {
[COLOR="#FF8C00"]center: new google.maps.LatLng(45.5300102, -122.9604111),[/COLOR]
zoom: 8
};
var map = new google.maps.Map(document.getElementById("first-map"),
mapOptions);
}
Was wondering if anyone here had some quick advice for adding multiple geocodes and markers or can point me to a tutorial? i tried adding a comma & a second set of coordinates…but that would have been way to simple.
thx
D
I used a database and php to hold some locations along with data, photo path and custom icons. This works quite well apart from when you have two icons at the same location!
I based my map on this tutorial
Edit: You could probably use a csv or XML file.
Thank you Rubble will check it out!
(might actually have more luck w/the php. but will find out.)
actually i wonder if i could define the various coordinates as variables & key them in?
oh well.
D
in case anyone needs it putting it here. found it in a lynda tutorial
in the page i have an empty div with the id of #first-map
below is the javascript code
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=you want to put your own api key here&sensor=false">
</script>
<script>
'use strict';
document.addEventListener('DOMContentLoaded', initialize);
var gmapApiKey = ' you want to put your own api key here ';
var map;
function initialize() {
var location = new google.maps.LatLng(44.9332619, -123.043808);
var wvaLocation = new google.maps.LatLng(445.5300102, -122.9604111);
var wcaLocation = new google.maps.LatLng(46.5730143, -116.0865071);
var bkwtrLocation = new google.maps.LatLng(44.9259796, -123.0310364);
var desertLocation = new google.maps.LatLng(33.5862846, -112.1065903);
var predLocation = new google.maps.LatLng(33.4115715, -111.8959503);
var mapOptions = {
center: new google.maps.LatLng(40.8356781, -115.76754),
zoom: 4,
mapTypeID: google.maps.MapTypeId.HYBRID,
};
map = new google.maps.Map(document.getElementById("first-map"), mapOptions);
var marker = new google.maps.Marker({
position: location,
map: map,
title:'Salem Oregon!'
}),
marker01 = new google.maps.Marker({
position: wvaLocation,
map: map,
title:'willamete valley arms'
}),
marker02 = new google.maps.Marker({
position: wcaLocation,
map: map,
title:'white creeks armory'
}),
marker03 = new google.maps.Marker({
position: bkwtrLocation,
map: map,
title:'black water tactical'
}),
marker04 = new google.maps.Marker({
position: desertLocation,
map: map,
title:'desert firearms'
}),
marker05 = new google.maps.Marker({
position: predLocation,
map: map,
title:'predator tactical'
});
}
</script>
& used this for the geolocation http://www.gpsvisualizer.com/geocode