Community of MapPoint and Bing Maps Users and Developers
This is a discussion on How do I loop my dataset of Lat/Long into a map using C#? within the MapPoint Desktop Discussion forums, part of the Map Forums category; Using C# & MP2K4, I already have a dataset that contains my Lat/Long values that I want to plot onto ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| How do I loop my dataset of Lat/Long into a map using C#? I don't need to use GetLocation since I already have the coordinates. I just want to shove them onto a map and display them. //populate my dataset System.Data.DataSet myDataSet = new System.Data.DataSet(); myDataAdp.Fill(myDataSet,"myTable"); //display a map MapPoint.Map myMap = axMappointControl1.NewMap(MapPoint.GeoMapRegion.ge oMapNorthAmerica); MapPoint.DataSet myMapDS = myMap.DataSets.AddPushpinSet("New PushPins"); foreach(DataRow DR in myDataSet.Tables["myTable"].Rows) { ?????????? } |
| |||
|
You need to look at the GetLocation method I dont know about doing this in C# but in VB .Net it would be something along the lines of Code: Dim objLoc as mappoint.location Dim objMap as Mappoint.map ObjLoc = GetLocation(50.333,-1.222, 100) objMap.AddPushpin(objLoc) Note this is completely untested but I have done it before and i seem to remember its something along these lines, unfortunatly i'm not near somewhere I could test it at the moment. |
| |||
|
Sorry I didn't read your previous post properly, you said you dont need to use getlocation but perhaps you do. Again in VB Code: Dim dr as datarow
For each Dr in myDataSet.Tables["myTable"].Rows
ObjLoc = GetLocation(dr("Lat"),dr("Lon"), 100)
objMap.AddPushpin(objLoc)
Next
|
| |||
|
Hi, For best results make the Altitude argumen 1 instead of 100. Many mappoint calculations get inapropriate if you view it to high
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz www.comfortsoftware.be MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Thanks for responding so quickly, but I don't want to use GETLOCATION as I already know where it is since I have long/lat in my dataset. Anybody else have a suggestion.? I highly appreciate it if someone can help in c# please. |
| |||
|
What wilfred said about the altitude makes sense, I just put 100 in as an example. trinity as I understand it your saying you dont want to use GetLocation because you already have the lat/lon but I think your missing the purpose of GetLocation. Getlocation isn't used to return a set of coordinates but to return a location object on a set of coordinates that you pass it, as my code shows. As you already know the coordinates your working with you can put this in the GetLocation method to return a location object, once you have the location object you can place a pushpin or do whatever else it is that you need to do. Perhaps i'm misunderstanding your question but this seems the logical answer to me. |
| |||
| Quote:
thanks
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz www.comfortsoftware.be MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
You were right, I did misunderstand GetLocation, this is what I am using now. Thank you everybody! MapPoint.Location mapLoc; double dblLon; double dblLat; foreach (DataRow dataRow in myDataSet.Tables["myTable"].Rows) { dblLat = Convert.ToDouble(dataRow["Latitude"]); dblLon = Convert.ToDouble(dataRow["Longitude"]); mapLoc = myMap.GetLocation(dblLat, dblLon, 100); myMap.AddPushpin(mapLoc, "PP"); } |
| |||
|
Hi, Glad it works now for you Code: mapLoc = myMap.GetLocation(dblLat, dblLon, 100);
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz www.comfortsoftware.be MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Glad we could help, the Mappoint help is actually suprisingly good at explaining a lot of its methods and properties if you continue to have problems. Of course this forum is also fantastic, its helped me a lot in the past |
![]() |
| Tags |
| dataset, lat or long, loop, map |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Creating New Dataset | Yazzy | MapPoint Desktop Discussion | 4 | 08-23-2005 07:20 AM |
| Importing Lat and Long directly to Pushpin Dataset? | Anonymous | MapPoint Desktop Discussion | 1 | 12-21-2004 08:00 PM |
| How do you loop through the stops on a route? | petemarkham | MapPoint Desktop Discussion | 1 | 11-11-2003 11:06 AM |
| DataSet Modifications ? | Anonymous | MapPoint Desktop Discussion | 1 | 09-12-2003 02:44 AM |
| Need help: return to loop and continue processing | David Kachuck | MapPoint Desktop Discussion | 1 | 11-13-2002 10:38 PM |