MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Pixels [xy] to Lat/Long and vice Versa

This is a discussion on Pixels [xy] to Lat/Long and vice Versa within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi all I want to select a map and copy the image into a picturebox. I know the four corners ...


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 (5) Thread Tools Display Modes
  5 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 03-28-2007
Junior Member
Yellow Belt
 
Join Date: Mar 2007
Posts: 13
Cool Pixels [xy] to Lat/Long and vice Versa

Hi all

I want to select a map and copy the image into a picturebox. I know the four corners of the map's lat/long coordinates. I want to return the Lat/Long coordinates of any point on the picture (for e.g. on click I would like to return the Lat/Long of the pixel clicked)'

I will also need to pass Lat/Long coordinates to my system and convert these coordinates to pixels and show them on map.

Any help would be appreciated.

Thanks
Bramu
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 03-28-2007
Junior Member
Yellow Belt
 
Join Date: Mar 2007
Posts: 13
Re: Pixels [xy] to Lat/Long and vice Versa

Please help me. I need this algorithm badly
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 03-28-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Pixels [xy] to Lat/Long and vice Versa

Hi,

You can use Copy or CopyMap to copy the map to the clipboard. Then you can copy it to your picture box. You know the coordinates of 4 corners, you also know the width and height of your picturebox, so you can calculate the amount of latitude per pixel and for horizontal the amount of longitude per pixel. You have to recalculate this after every resizing of the box.

In the Click event you know the x,y coordinates of the mouse cursor, so there you can given on the calculation you did before calculate the real lat + long of the clicked position.

Back in mappoint you use GetLocation method to find the Location for these coordinates.
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 03-29-2007
Junior Member
Yellow Belt
 
Join Date: Mar 2007
Posts: 13
Re: Pixels [xy] to Lat/Long and vice Versa

The solution you gave me does not work if you have a very large zoomwidth. (e.g. you have all of europe visible)


bramu
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 03-29-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Pixels [xy] to Lat/Long and vice Versa

Hi,

What exacly does not works with a very high altitude ?
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 03-30-2007
Junior Member
Yellow Belt
 
Join Date: Mar 2007
Posts: 13
Re: Pixels [xy] to Lat/Long and vice Versa

The translation from lat/long to pixels and vice versa.

To give you an example: I had all europe visible (very high altitude) and when I clicked on Italy (to Zoom to italy) the returned image was not that of italy but another place. If I am at a low altitudes, it works fine. AT low altitudes, wherever I clicked it is ok.
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 03-30-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Pixels [xy] to Lat/Long and vice Versa

Hi,

What was wrong the latitude or the longitude ?

At high altitudes if you dont calculate a correction the longitude will be wrong. Latitude will always be ritht.

You have to make a correction because 1 degree lat == 1 degree long only on the equator. If you get away from the equator you have to multiply longitude by the cosinus of the latitude to get the correct position (or is it the sine ?, I'm busy with something else at the moment so I can mistake, but you can try this in seconds).
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-02-2007
Junior Member
Yellow Belt
 
Join Date: Mar 2007
Posts: 13
Re: Pixels [xy] to Lat/Long and vice Versa

Thx

You mean that the latitude is always correct and the long = long * cos(latitude)? am I right?

Brian
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-02-2007
Member
Green Belt
 
Join Date: Nov 2006
Posts: 87
Re: Pixels [xy] to Lat/Long and vice Versa

Bramu,


Why don't you use XYToLocation?

When a user clicks, you catch the mouseclick eventhandler and get the xy of the mouse and than call XYToLocation method of Map object. This is possible with Mappoint 2006.
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-02-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Pixels [xy] to Lat/Long and vice Versa

Quote:
Originally Posted by bramu View Post
Thx

You mean that the latitude is always correct and the long = long * cos(latitude)? am I right?

Brian
Yes to calculate the distance. And in your case also because you start from pixel.
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
lat or long, pixels, versa, vice


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/pixels-xy-lat-long-vice-versa-5783.html

Posted By For Type Date
vice versa - Zymboo This thread Refback 02-25-2008 07:32 AM
Using MS MapPoint in PowerBuilder - MapPoint Articles - MP2K Magazine This thread Refback 04-05-2007 02:22 PM
Working With Excel and MapPoint - MP2K Magazine This thread Refback 03-29-2007 06:21 AM
Map Visitors - Powered by Virtual Earth This thread Refback 03-28-2007 10:32 AM
The Magazine for MapPoint - MP2K Magazine This thread Refback 03-28-2007 09:21 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
Converting Lat/Long to x,y Pixels Anonymous MapPoint 2006/2009 Discussion 2 09-08-2004 05:24 PM
Convert to Lat/Long wallacech MapPoint 2006/2009 Discussion 1 02-26-2004 01:37 PM
Lat. and Long. Anonymous MapPoint 2006/2009 Discussion 1 02-06-2004 03:09 AM
Lat/Long lgeeck MapPoint 2006/2009 Discussion 1 07-01-2003 10:03 AM
get lat./long. Anonymous MapPoint 2006/2009 Discussion 1 11-19-2002 06:56 AM


All times are GMT -5. The time now is 03:32 AM.


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