Community of VE/MapPoint Users and Developers
This is a discussion on Convert Lat Lon to X Y within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I'm drawing shapes in mappoint and the saving the coordinates (lat\lon) to a file. I then have another program that ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Convert Lat Lon to X Y I then have another program that needs to be able to read these files in and plot the shape on a VB .net form using GDI+ (Not mappoint) The problem i'm having is converting these lat lon coordinates into x y pixel coordinates. Does anyone have any ideas? The shape needs to re-size with the form. |
| |||
| Ya there has been method given by mappoint to convert
Hi There is a way to convert the lat long to the xy coordinates. Once you converted your lat longs to xy then you can easily redraw then again The method for converting the is present in render services of mappoint RenderService.ConvertToPoint() This method takes few arguments as below : 1. waypoint of the map generated 2. view array of the map 3. your picture box's width 4. your picture box's height now with there values you can get the x y coordinates. this is help ful as when the picture box size is changes then it takes the fresh height and width Regards Manav |
| ||||
|
It sounds like Manav's answer is for the MapPoint Web Service, but this is forum is mainly for Desktop MapPoint. You need to create a Location object from the longitude,latitude coords and then use the LocationToX() and LocationToY() methods. See the MapPoint documentation for full details, but here's the example from the help file: Code: Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLocNY As MapPoint.Location
Dim objLocLA As MapPoint.Location
Dim objCenter As MapPoint.Location
Dim objTextbox As MapPoint.Shape
'Set up application and create Location objects
Let objApp.Visible = True
Let objApp.UserControl = True
Set objMap = objApp.ActiveMap
Set objLocNY = objMap.FindResults("New York, NY").Item(1)
Set objLocLA = objMap.FindResults("Los Angeles, CA").Item(1)
'Find the point on the screen midway between the two
X1% = objMap.LocationToX(objLocNY)
Y1% = objMap.LocationToY(objLocNY)
X2% = objMap.LocationToX(objLocLA)
Y2% = objMap.LocationToY(objLocLA)
Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| |||
|
Yeah thats not really what I'm trying to. I have an app that uses mappoint, the user draws a shape and submits that shape to a database, the shape is stored as a set of lat lon coordinates. I have a second app that doesn't use mappoint (and cant) on which I need to plot the shape on a windows form using GDI. The difficulty I'm having is plotting the lat lon coordinates using GDI points. The question I was asking was how do I convert these Lat lon coordinates into Pixel X Y coordinates without using mappoint. In summary I need to convert a set of lat lon coordinates into Pixel X Y coordinates to plot a shape on a windows form (or possibly change the scale on the form using GDI however being a GDI novice i;m unsure of how to do this either) Thanks for your help |
| ||||
|
You need to read about map projections. This is a huge subject unto itself, and there are books dedicated to the subject. The good news is that you can do it with "a bit of maths". A simplistic projection would be to simply use a linear mapping from longitude,latitude to x,y (eg. x=Longitude+180); y=90-Latitude). This will seriously distort the poles, but gives you an idea of a simple approach. There are literally hundreds of different map projections according to your specific needs. Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| ||||
|
"Transverse Mercator" is probably a good start. I'm sorry I can't be of much help beyond this, but it should help in your web and book searches. Many years ago, I did work with esoteric map projections but these were intended for specialist projections of angular data (equal-angle projections for crystallography, and equal-area projections for structural geology). I remember at high school we'd often use an equal area map because relative land areas remained the same. Despite this the map looked distorted - eg. Africa was large, and Northern Europe (and Canada) were squashed. Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| |||
|
Fabio, I agree some sort of variation on your suggestion would have been the best way (Convert Lat Lon to xy when drawing the shape and store that, then use that to scale the shape to the size of the form) However the data already exists, there are hundreds of thousands of these shapes so to try to re-plot and resubmit would probably more work than attempted a programatic conversion. Incidently after some of the suggestions found here I'm actually quite close to a solution, thanks again for your help. |
![]() |
| Tags |
| convert, lat, lon |
| ||||
| Posted By | For | Type | Date | |
| Lon-to - Softonic Google search | This thread | Refback | 10-10-2008 09:36 AM | |
| lat lon xy - Zuula Search | This thread | Refback | 10-03-2008 02:28 PM | |
| convert lat lon to x y - Zuula Search | This thread | Refback | 09-26-2008 09:58 AM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| which is the transformation that MP use to convert.... | Anonymous | MapPoint 2006/2009 Discussion | 4 | 07-02-2008 02:57 PM |
| Convert .ptm to .jpg | dkirk | MapPoint 2006/2009 Discussion | 6 | 03-03-2005 07:10 AM |
| Help: convert VB code to Delphi! | Anonymous | MapPoint 2006/2009 Discussion | 3 | 10-06-2004 02:02 PM |
| Convert to Lat/Long | wallacech | MapPoint 2006/2009 Discussion | 1 | 02-26-2004 01:37 PM |
| Convert to Add-In | David Kachuck | MapPoint 2006/2009 Discussion | 0 | 07-06-2003 04:41 PM |