Link to home
Start Free TrialLog in
Avatar of Jerryleo
Jerryleo

asked on

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

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!
Avatar of Crin
Crin

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
Avatar of Jerryleo

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of Crin
Crin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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!
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
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!
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
Hello Crin,

Thank you very much!