GoogleMaps\ASP.NET

  • Thread starter Thread starter gh
  • Start date Start date
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
 
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.
 
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
 
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
 
Back
Top