Solved

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

Posted on 2002-05-22
10
715 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

776 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