Solved

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

Posted on 2002-05-22
10
694 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
 
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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 Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now