?
Solved

Plotting points on a 2D world map.

Posted on 2005-03-02
29
Medium Priority
?
715 Views
Last Modified: 2012-08-13
hi,
I came across this question on EE:
http://www.experts-exchange.com/Miscellaneous/Math_Science/Q_20853587.html

The solution suggested on the last comment of the thread works fine for the specific N-W-E-S coordinates mentioned in the post.

When I try to use the same method to plot points on a larger map, that is, Entire world map, the equation does not work.

I am using the following link to create vector:
http://www.aquarius.geomar.de/omc/make_map.html

N=90, E=180, S=-90, W=-180

This gives me the map of whole world.

As mentioned in that post, I am using PHP to generate Latitude/Longitudes.

Is anyone here able to help me find the right solution?

At the end of the day, I want to plot X and Y co-ordinates on the Image of World Map using Latitude and Longitude as the only inputs.

Thanks a lot.

0
Comment
Question by:ssdesign
[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
  • 14
  • 14
29 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 13440915
What kind of projection do you want to use?
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13442167
Mercator Projection.
0
 
LVL 84

Expert Comment

by:ozo
ID: 13442355
A Mercator Projection projects N=90 and S=-90 to Y = ±infinity which may not work well with your data.
Equidistant Cylindrical or Cylindrical Equal-Area might be simpler
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 7

Author Comment

by:ssdesign
ID: 13442912
How about this?
http://www.xpenguin.com/ip-atlas.php

How does this work? I am still studying the code, maybe this is a good option.
0
 
LVL 84

Expert Comment

by:ozo
ID: 13443147
Are you trying to plot latitude/longitude values for IP addresses?
In that case,  Mercator might work, since I don't think there's an IP address for N=90, although I think the South Pole station has internet access.
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13443302
What I am doing is, I have IP addresses.
I am running a PHP script to get Longitude and Latitude of these IP addresses.
Then plot these Lat/Lon on a map.

Thats what I want to do.
0
 
LVL 84

Expert Comment

by:ozo
ID: 13443429
In that case, as long as you have no IP addresses near N=90 or S=-90, the Mercator projection of y = ln(tan(Latitude)+sec(Latitude)) should work for you
http://mathworld.wolfram.com/MercatorProjection.html
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13446861
So can you tell me how do I use this site http://www.aquarius.geomar.de/omc/make_map.html to generate the map as you mentioned above?

Sorry I am not a mathematician so I might be asking stupid questions :)
0
 
LVL 84

Expert Comment

by:ozo
ID: 13446932
What points are you trying to plot there?
Don't try to use Map Boundaries of N=90, S=-90 with a Mercator Projection
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13461681
I a extracting URL's from webpage, find their IP address, then find Latitude and longitudes and plot then on a map.
0
 
LVL 84

Expert Comment

by:ozo
ID: 13465258
http://www.aquarius.geomar.de/omc/make_map.html has not been responding lately,
but earlier it had a field in which you can enter latitude and longitudes to be ploted on a map.
It seemed to be working for me, were you having difficulty with it?
A Mercator Projection gets infinitely distorted near N=90, or S=-90, but as long as you stay away from there, I saw no problems.
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13465553
I am just creating the map in a vector format from that website.
I am then using PHP and Flash to create dynamic plotting of locations on this Map.

So I cant use that site to plot the points becuase they are determined by the PHP script.
0
 
LVL 84

Expert Comment

by:ozo
ID: 13465643
I think you can use PHP to submit the points to http://www.aquarius.geomar.de/omc/make_map.html
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13466934
But that wont help, I need to do it on my custom graphic created in flash, so plotting points using aquarius site is out of question.
0
 
LVL 84

Expert Comment

by:ozo
ID: 13467028
Ok, what map boundaries did you use, and what are the coordinates of the corners of your graphic?
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13467136
ok so the graphic i generated is using:
90N/180E/-90S/-90W

The dimentioned of the graphics are: 900x900pixels

So the boundaries are:
Top Left: -180W/90N
Top right: 90N/180E
Bottom left: -180W/-90S
Bottom right: -90S/180E
0
 
LVL 84

Expert Comment

by:ozo
ID: 13467234
I think you mean 90N/-90N or 90N/90S, but 90N/90S doesn't make sense for a Mercator Projection,
if 90N was at y=900 and 90S was at y=0, that would put all points other than the poles at y=450
(and longE/W would map to x=450+450*long/180)
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13467271
I am not a mathemaatecian, so in order to get a complete map of the world, i used the above mentioned points on aquarius website.

If u enter the values as suggested by me you will get a complete map of the world.

Let me know if i am doing anything wrong here, but the map comes out perfect.
0
 
LVL 84

Expert Comment

by:ozo
ID: 13467343
I got a very distorted map which was not really a Mercator projection on 90N/90S, which would have been infinitely distorted.
(they might have silently changed the input to something like 89N/89S)
Did you look at your map?  Are you sure you used a Mercator projection?
Where on your image would the Arctic and Antarctic Circles and the Tropics of Cancer and Capricorn have been?
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13467678
I am not using 90N/90S

I am using: 90N/-90S/180E/-180W
0
 
LVL 84

Expert Comment

by:ozo
ID: 13467844
If by 90N/-90S you mean North Pole/South Pole then we are talking about the same thing,
and it looks like you're just using +/- as a redundancy for N/S
If you're using a notation where 90N == -90S and -90N == 90S
then you've just named the North Pole twice.
Either way a Mercator projection is infinitely distorted there, so you're probably either not using a Mercator projection or using a Mercator projection that cuts off around 88° or 89° (there's no land/sea border beyond about 87°6') so there's not much to draw there anyway.
Based on 88lat = 900y or 89lat=900y I could give you a Mercator interpolation for other latitudes, but 90lat=900y would put everything else at the same y coordialte as 0 lat.
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13469396
Ok so things are going out of my understanding here :), yes frankly.

So lets say, what would be the best solution for me give the situation that:

1. I have a list of Latitudes and Longitudes which I want to plot on a map using something like say PHP or Macromedia Flash.
2. The base of this map is a world map (What would be the best map here? Mercator or something else?)
3. Using that map, what would be the way to interpret or transfor these points onto this map?

thanks
0
 
LVL 84

Expert Comment

by:ozo
ID: 13469694
Best choice of projection depends on what properties you want it to have.
These may incliude minimal shape distortion in the area of greatest interest, conformality, area preservation (these are mutually exclusive), eqidistance,
straight line loxodromes (this is what Mercator preserves), directions (from particular points), angles, continuity.  All planar maps are compromises between such considerations.  Projections can also be taken from different angles and perspectives, but I gather you want North/South to be up/down and West/East to be Left/right.
A cylindrical eqidistant projection would have the simplest translation from latitude/longitude to graphic coordinates -- it would jut be a linear interpolation.
But if you know the y coordiantes of 3 or more non-90° latitudes of a Mercator projection, I could give you a formula for the y coordinate of any other non-90° latitude.
 
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13470392
yes i know many points on the map.

Some of the points are:

Lon: 135W      Lat: 25S        AU
Lon: 121.92E      Lat: 37.32N      SanJose
Lon: 118.22E      Lat: 33.98N      HuntingtonPark
Lon: 77.44E      Lat: 38.88N      Chantilly
Lon: 118.09E      Lat: 34.15N      Pasadena
Lon: 73.79E      Lat: 42.85N      CliftonPark
0
 
LVL 84

Expert Comment

by:ozo
ID: 13471823
What are the y coordinates of those points within the 900x900pixel graphic?
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13474336
for 180W y=0
for 180E y=900
0
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 13474655
> for 180W y=0
> for 180E y=900
I guess I had the graphic turned sideways in my mind.
What would the x coordinates be for some latitude?

For longitude, as I said earlier,
longW would map to 450-450*longW/180,
longE would map to 450+450*longE/180,
0
 
LVL 7

Author Comment

by:ssdesign
ID: 13479078
ok great, I will tryout this equation and see if it worked. OZO you are doing a great job of helping me here ;)
I am usually active on FLASH section.

Will get back soon with my results.
0
 
LVL 7

Expert Comment

by:Ai3d
ID: 13587161
The Mercator projection, developed mathematically by the Flemish geographer Gerardus Mercator, is related to the cylindrical projection, with certain modifications. A Mercator map is accurate in the equatorial regions but greatly distorts areas in the high latitudes. Directions, however, are represented faithfully, and this is especially valuable in navigation. Any line cutting two or more meridians at the same angle is represented on a Mercator map as a straight line. Such a line, called a rhumb line, represents the path of a ship or an airplane following a steady compass course. Using a Mercator map, a navigator can plot a course simply by drawing a line between two points and reading the compass direction from the map
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

How to Win a Jar of Candy Corn: A Scientific Approach! I love mathematics. If you love mathematics also, you may enjoy this tip on how to use math to win your own jar of candy corn and to impress your friends. As I said, I love math, but I gu…
Lithium-ion batteries area cornerstone of today's portable electronic devices, and even though they are relied upon heavily, their chemistry and origin are not of common knowledge. This article is about a device on which every smartphone, laptop, an…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Suggested Courses

765 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