I'm having an issue with my site where I'm trying to pull down some info
contained within a class that represents the results (name, address,
glat/glng) that I would like to display on separate markers each with an
info bubble displaying the result information (name and address + ancillary
data)
The site is www.nite-fly.com .
Click search and do a search for "@100 Christopher st? to see the issue I'm
talking about. It only populates one marker and even if I try to change the
location of the marker, it seems like the array isn't being populated. The
code is also below if it helps, the results script calls the gmaps
javascript so it is not readily available unless you are using firebug or
google developer. I've been going through the code with a fine toothed comb
and using GLog() but the only error that comes up is "unidentified" and I am
not sure what that means or how to fix it. Help much appreciated!
-Evan
-----------------------------------------
google.load("maps", "2", {"other_params":"sensor=true"});
var map;
function initialize(){
window.map = new google.maps.Map2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
}
google.setOnLoadCallback(initialize);
function getVenueResults(_zip, _num, _remove){
var rFlag = '';
if(_remove != null){
rFlag = "&removeId=" + _remove;
}
var url = 'ajax/getVenues.php?zip=' + _zip + "&num=" + _num + rFlag;
new Ajax.Updater('resultsContainer', url, { onComplete: processResults });
}
function processResults(){
window.map.clearOverlays();
var waypoints = [];
var resultsList = $$('.resultWrapper');
var stepList = $$('.resultDirections');
for(i=0; i<stepList.length; i++){
Element.remove(stepList[i]);
}
for(i=0; i<resultsList.length; i++){
var resultsElem = resultsList[i];
resultsElem.removeClassName('firstResult');
resultsElem.removeClassName('lastResult');
if(i == 0){
resultsElem.addClassName('firstResult');
}
if(i == resultsList.length - 1){
resultsElem.addClassName('lastResult');
}
var insertContent = '<div class="resultDirections" id="resultDirections' + i
+ '"></div>';
Element.insert(resultsElem, { bottom : insertContent })
var num = resultsElem.getElementsByClassName('numHolder');
num[0].innerHTML = '<b>' + letters[i] + ".</b> ";
var geolat = resultsElem.getElementsByClassName('geolat')[0].value;
var geolong = resultsElem.getElementsByClassName('geolong')[0].value;
var point = new GLatLng(geolat, geolong);
waypoints[i] = point;
GLog.write();
}
if(waypoints.length == 1){
map.setCenter(waypoints[0], 16);
marker=new GMarker(waypoints[0])
map.addOverlay(marker);
resultsElem.getElementsByClassName('numHolder')[0].innerHTML = '';
}else{
map.setCenter(waypoints[0], 16);
//marker=new GMarker(waypoints[2])
//map.addOverlay(marker);
//var cont = resultsElem.getElementsByClassName('resultBox')[0].innerHTML;
//GEvent.addListener(marker, 'click', function() {
// marker.openInfoWindow(cont);
//});
for(j=0; j<waypoints.length; j++) {
var vLoc = waypoints[j];
var vInfo = resultsElem.getElementsByClassName('resultBox')[j].innerHTML;
//function to mine name out of div and make it the marker title
//x = resultsElem.getElementsByTagName("b");
// for (i=0;i<x.length;i++)
//
//marker.value = resultsElem.getElementBy('numHolder').innerHTML
createMarker(vLoc, vInfo);
window.map.addOverlay(marker);
}
}
function createMarker(vLoc, vInfo) {
marker = new GMarker(vLoc);
cont = vInfo;
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindow(cont);
});
return marker;
}
}
On Mon, Mar 15, 2010 at 2:36 PM, denlion <[email protected]> wrote:
> Yeah,I tried the same documentation to write my code I used
> map.setMapType(G_HYBRID_MAP);
> When I ran my code.It is showing in Map view but When I debug my code
> its open up with the satellite view..
>
>
> On Mar 15, 12:31 pm, Rossko <[email protected]> wrote:
> > > yeah I got my code working...It's working correctly but one thing how
> > > to change my map to satellite view..would anyone help me how to change
> > > my map to satellite view..
> >
> > You seem to have skipped reading 'Basics' in the documentation -
> http://code.google.com/apis/maps/documentation/introduction.html#MapT...
>
> --
> 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]<google-maps-api%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api?hl=en.
>
>
--
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.