Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell driver drivers email error ethernet excel firefox firefox 3 hard drive internet internet explorer itunes laptop linux malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express partition password printer problem router slow software sound spyware trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Passing Google Map coordinates ASP/Javascript


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
fizzle's Avatar
Junior Member with 19 posts.
 
Join Date: Jun 2005
Experience: it depends on the topic
27-Jan-2008, 04:00 PM #1
Passing Google Map coordinates ASP/Javascript
Hopefully someone can help me with this.

I have an Access db that contains coordinates (Longitude & Latitude) that I would like to query and use to plot markers on a Google Map.

Unfortunately, Google uses Javascript to do this task.
I am wondering if there is a way that I can integrate ASP into the task.

The Javascript code is as follows:
var point = new GLatLng(64.834829,-147.738820);
var marker = createMarker(point,'<img src="marker1.gif">', marker1)
map.addOverlay(marker);


I'd be a happy camper if I could just do this:
var point = new GLatLng(<%=rs("latitude") %>,<%=rs("longitude") %>);
var marker = createMarker(point,'<img src="marker1.gif">', marker1)
map.addOverlay(marker);

...but of course I'm just dreaming

So my question is:
Is there a way that I can generate that bit of Javascript code for every row of data that the query returns ???
If it wasn't Javascript, I could capture every row in a table... but how can something like that be done with Javascript ?
(if at all)

I'm at a loss, so any help would be appreciated.
Thanks
GCDude's Avatar
Senior Member with 400 posts.
 
Join Date: Apr 2005
Location: Brighton, UK
Experience: Possibly Competent
28-Jan-2008, 06:15 AM #2
why exactly cant you do-

var point = new GLatLng(<%=rs("latitude") %>,<%=rs("longitude") %>);

? Ive got a website that does exactly this. Well not exactly, im using -

var point = new GPoint(<%=rs("Long")%>,<%=rs("Lat")%>)

Seems to work fine.
fizzle's Avatar
Junior Member with 19 posts.
 
Join Date: Jun 2005
Experience: it depends on the topic
28-Jan-2008, 09:17 AM #3
Quote:
Originally Posted by GCDude View Post
why exactly cant you do-

var point = new GLatLng(<%=rs("latitude") %>,<%=rs("longitude") %>);

? Ive got a website that does exactly this. Well not exactly, im using -

var point = new GPoint(<%=rs("Long")%>,<%=rs("Lat")%>)

Seems to work fine.
Are you mapping just one set of coordinates, or are you mapping multiple coordinates?

My issue isn't the variable as much as it is in replicating the Javascript code that produces the map pointers.
If the result of the db query returns 10 coordinate pairs, then I need 10 instances of the Javscript code.
How do I generate a dynamic number of instances of the Javascript code and insert the resulting variables?
That's the real issue.

Are you doing something like that?
If so, would you mind sharing your technique with me?
(I am not Javascript literate, although I can usually tweak existing code if it's not too complicated)
Thanks
GCDude's Avatar
Senior Member with 400 posts.
 
Join Date: Apr 2005
Location: Brighton, UK
Experience: Possibly Competent
28-Jan-2008, 11:05 AM #4
with multiple points, you just need to loop through your recordset adding multiple points. cut down code im using is, something like this:-

Code:
function onLoad() 
{	    			
   if (GBrowserIsCompatible()) 
   {								
      var map = new GMap(document.getElementById("map"));
      map.addControl(new GSmallMapControl());           

      var point;
      var marker;
<%

set rs = GetRecordSet(sql2call) 

while not rs.EOF 
%>
   point = new GPoint(<%=rs("Long")%>,<%=rs("Lat")%>);
   marker = createMarker(point, <%=enumData%>, '<%=Name%>', '', '' );
   map.addOverlay(marker);
<%
wend
rs.close()
%>
   }
}
fizzle's Avatar
Junior Member with 19 posts.
 
Join Date: Jun 2005
Experience: it depends on the topic
28-Jan-2008, 11:43 AM #5
Thanks GCDude !!!
That certaily seems logical enough.
And therefore it kinda embarrasses me that I hadn't put the Javascript within the loop just to see how that would respond.
I interpretted the onLoad function as a "run once" only process.... so I got a bit skittish about doing anything to mess with it.
(once again, my Javascript naivete shows through)

I'll give that a try with my code when I get a chance
(I'm severely limited with what I can do here at work, unfortunately)

Thanks again. I appreciate your efforts to help me with this.
GCDude's Avatar
Senior Member with 400 posts.
 
Join Date: Apr 2005
Location: Brighton, UK
Experience: Possibly Competent
28-Jan-2008, 12:17 PM #6
no problem any more help required, ask away.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:19 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.