Solved

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

Posted on 2002-05-22
738 Views
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
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
• 5
• 5

LVL 2

Expert Comment

ID: 7026639
Hello,

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

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

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

LVL 2

Expert Comment

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

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

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

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

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

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

ID: 7060859
Hello Crin,

Thank you very much!
0

## Featured Post

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
###### Suggested Courses
Course of the Month4 days, 6 hours left to enroll