473,320 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

GoogleMaps\ASP.NET

gh
Does anyone have an example of how to loop through a table to get the
lat\lon and then pass it to the google map api? I am able to use js to
send one lat\lon to the api and have the map and marker show up on the
web page. I am not sure how or where to do this when looping through a
table.

Thanks
Jan 12 '07 #1
3 1301
I have made a .NET control for Google Maps which lets you create
markers easily using .NET code. You can find it at
http://www.reimers.dk

If you use that you can write code like:
foreach(Datarow dr in myDataTable){
GoogleMarker marker = new GoogleMarker();
marker.ID = dr["ID"];
marker.Latitude = (double)dr["Lat"];
marker.Longitude = (double)dr["Lng"];
GoogleMap.Overlays.Add(marker);
}

This will add all the markers in the overlay collection to your map on
load. You can also use it to add marker asynchronously using AJAX.
gh wrote:
Does anyone have an example of how to loop through a table to get the
lat\lon and then pass it to the google map api? I am able to use js to
send one lat\lon to the api and have the map and marker show up on the
web page. I am not sure how or where to do this when looping through a
table.

Thanks
Jan 12 '07 #2
gh
Jacob:

Will your map component also do geocoding. Example my user select Ohio
from a list of states. I open a new web page, in the page load event a
query returns a result of the Ohio Members, loops through the result set
to get the lat\lon. If a lat\lon is missing, I would like to retrieve
it from google to update the record in the dataset.

TIA

Jacob wrote:
I have made a .NET control for Google Maps which lets you create
markers easily using .NET code. You can find it at
http://www.reimers.dk

If you use that you can write code like:
foreach(Datarow dr in myDataTable){
GoogleMarker marker = new GoogleMarker();
marker.ID = dr["ID"];
marker.Latitude = (double)dr["Lat"];
marker.Longitude = (double)dr["Lng"];
GoogleMap.Overlays.Add(marker);
}

This will add all the markers in the overlay collection to your map on
load. You can also use it to add marker asynchronously using AJAX.
gh wrote:
>>Does anyone have an example of how to loop through a table to get the
lat\lon and then pass it to the google map api? I am able to use js to
send one lat\lon to the api and have the map and marker show up on the
web page. I am not sure how or where to do this when looping through a
table.

Thanks

Jan 12 '07 #3
The free version has some basic clientside geocoding functionality, but
the licensed version does both serverside and clientside geocoding, as
well as serverside reverse geocoding (click map and get nearest town).

I think in your case you are probably better off geocoding your members
when you register them, that way you can simply loop through your table
when you load your map.

Read this for some geocoding examples:
http://www.reimers.dk/forums/thread/171.aspx
http://www.reimers.dk/blogs/jacob_re...explained.aspx
gh wrote:
Jacob:

Will your map component also do geocoding. Example my user select Ohio
from a list of states. I open a new web page, in the page load event a
query returns a result of the Ohio Members, loops through the result set
to get the lat\lon. If a lat\lon is missing, I would like to retrieve
it from google to update the record in the dataset.

TIA

Jacob wrote:
I have made a .NET control for Google Maps which lets you create
markers easily using .NET code. You can find it at
http://www.reimers.dk

If you use that you can write code like:
foreach(Datarow dr in myDataTable){
GoogleMarker marker = new GoogleMarker();
marker.ID = dr["ID"];
marker.Latitude = (double)dr["Lat"];
marker.Longitude = (double)dr["Lng"];
GoogleMap.Overlays.Add(marker);
}

This will add all the markers in the overlay collection to your map on
load. You can also use it to add marker asynchronously using AJAX.
gh wrote:
>Does anyone have an example of how to loop through a table to get the
lat\lon and then pass it to the google map api? I am able to use js to
send one lat\lon to the api and have the map and marker show up on the
web page. I am not sure how or where to do this when looping through a
table.

Thanks
Jan 12 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.