GoogleMaps\ASP.NET

G

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
 
J

Jacob

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.
 
G

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
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.

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
 
J

Jacob

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_r...006/12/27/clientside-geocoding-explained.aspx

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
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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top