Solved

How to Convert World Coordinates to the x,y coords of a PictureBox ?

Posted on 2002-05-22
10
747 Views
Last Modified: 2008-01-16
I am sorry for my poor English.

I need to Convert World Coordinates to the x,y coords of a picture box. For example, If I set a point in a map, its world coordinate is (80E,30N), to the the upper left corner of the picturebox, how do I get the x,y cords of other points.

Could anyone can help me?

Thanks a lot!
0
Comment
Question by:Jerryleo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 2

Expert Comment

by:Crin
ID: 7026639
Hello,

Please provide more information: do I understand right that picturebox mentioned contain map image?
Is map natural scale known? If not your problem has no solution.

Generally, if you know geographical coordinates of upper left and bottom right corners of the map picture conversion is quite simple, Geo coordinates assume world coordinates and Pict - coordinates within picturebox:

GeoX = GeoLeftTopX + PictX / Picture1.Width * (GeoRightBottomX - GeoLeftTopX)

GeoX = GeoLeftTopY + PictY / Picture1.Height * (GeoRightBottomY - GeoLeftTopY)

Sincerely,
Crin
0
 

Author Comment

by:Jerryleo
ID: 7026734
I am sorry for my unclear expression.

Yes.

1. The picturebox has contained a map image.
2. The map scale is known, such as 1:150000
3. The map projection is Lambert Conformal Conic Projection.

I am sorry for I think the formula you gived me only apply to mecator projection, not the Lambert conformal Conic
0
 

Author Comment

by:Jerryleo
ID: 7026882
What I mean is if I set the upper left corner of the map to (0,0)(using Cartesian coordinate system), how to use (x,y) to indicate the point in the map, not the longitude and latitude.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:Crin
ID: 7028117
Hello Jerryleo,

I'm sorry I didn't quite understand you. Let me start from the very beginning.

You have scanned map or control which give you required part of the map and you place it within picturebox.

While software work one parameter became known and software need to perform some operation.

So the questions are:
1) which parameter becomes known - geographical coordinates (user input 80E 30N) OR mouse movements within the picturebox? (in the Picture1_MouseMove(x,y) event routine?)
2) what should do the software - indicate point (say with red or blue color) in right position on the map placed in the picturebox OR give coordinates (80E 30N) using (x,y) of the current mouse position?

Also, actual map scale is useless, we should know scale to pixels value. So, if you have dpi value for your map images in addition to map scale then we can continue this approach.

Actually, I believe it would be more clear (and will speed up my help) if you briefly explain what your software should do.

Sincerely,
Crin

0
 
LVL 2

Accepted Solution

by:
Crin earned 50 total points
ID: 7028151
For more details about different coordinates conversions read here, a lot of formulas there:
http://www.nima.mil/GandG/tm83581/tr83581b.htm

Sincerely,
Crin
0
 

Author Comment

by:Jerryleo
ID: 7055990
Hello Crin

Thank you very much

I am sorry for delay.

I am making a plotting program. It first draws a map with a series of data with geographical coordinates. Then according given geographical coordinates to plot some information on the map. All the data format are geographical coordinates and can be read from a text file.

I have read the reference URL you give. And I have found the Lambert Conformal Conic Projection may be fit for me. But the formula is too complex.

Is there any simplified Lambert Conformal Conic Projection formula or other simplified transformation of geographical coordinates to the plane?

Thanks again!
0
 
LVL 2

Expert Comment

by:Crin
ID: 7057508
Hello Jerryleo,

Unfortunatelly, in Russia we use another system, so I'm not familar with Lambert Conformal Conic Projection.

However, just analyzing your goal I must say that you have to use that set of complex formulas since all simplifications are aproximations, any approximation differs from the original and for such map scale will be quite visible and will distort the picture.

If you fear productivity issue I can calm you since VB6 math compiled to a native code with appropriate settings (Project -> Projectname settings, Compile tab, check Compile to native code.) So, the only complex task is to code that math.

Sincerely,
Crin
0
 

Author Comment

by:Jerryleo
ID: 7058287
Hello Crin,

Thank you very much.

You are right. I think it may be the only way, use that set of complex formulas.

BTW, I am sorry for my curiosity. In Russia, which system you use? And how to plot a map?

Thanks again!
0
 
LVL 2

Expert Comment

by:Crin
ID: 7060608
No problem with curiosity, actually I don't know english equivalent for the name, but will look and say it to you :)

By the way, there are no formulas, but a lot of common information about different projections here: http://www.colorado.edu/geography/gcraft/notes/coordsys/coordsys_f.html

Sincerely,
Crin
0
 

Author Comment

by:Jerryleo
ID: 7060859
Hello Crin,

Thank you very much!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 9 hours left to enroll

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question