MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Convert Lat Lon to X Y

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


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (3) Thread Tools Display Modes
  3 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 04-25-2006
Senior Member
Green Belt
 
Join Date: Sep 2003
Posts: 103
Convert Lat Lon to X Y

I'm drawing shapes in mappoint and the saving the coordinates (lat\lon) to a file.

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 04-25-2006
Junior Member
White Belt
 
Join Date: Apr 2006
Posts: 5
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 04-25-2006
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 893
Blog Entries: 10
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 04-25-2006
Senior Member
Green Belt
 
Join Date: Sep 2003
Posts: 103
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 04-25-2006
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 893
Blog Entries: 10
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 04-25-2006
Senior Member
Green Belt
 
Join Date: Sep 2003
Posts: 103
Thanks for your help, I can see i'm going to have to look into this a bit deeper!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 04-25-2006
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 893
Blog Entries: 10
"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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 04-26-2006
Senior Member
Green Belt
 
Join Date: Sep 2003
Posts: 103
Thanks for all your help,

I've got a good grounding now for my research, I didn't think there would be a simple answer (although I hoped there would!), thanks for pointing me in the right direction.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 04-26-2006
Junior Member
White Belt
 
Join Date: Oct 2005
Posts: 9
Maybe another simple solution is to hold on the database not only lat & long but also corresponding X & Y on the map.

Is it right?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 04-27-2006
Senior Member
Green Belt
 
Join Date: Sep 2003
Posts: 103
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
convert, lat, lon


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/convert-lat-lon-x-y-4925.html

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 07:17 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54