Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 726
  • Last Modified:

Plotting points on a 2D world map.

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
ssdesign
Asked:
ssdesign
  • 14
  • 14
1 Solution
 
ozoCommented:
What kind of projection do you want to use?
0
 
ssdesignAuthor Commented:
Mercator Projection.
0
 
ozoCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ssdesignAuthor Commented:
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
 
ozoCommented:
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
 
ssdesignAuthor Commented:
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
 
ozoCommented:
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
 
ssdesignAuthor Commented:
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
 
ozoCommented:
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
 
ssdesignAuthor Commented:
I a extracting URL's from webpage, find their IP address, then find Latitude and longitudes and plot then on a map.
0
 
ozoCommented:
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
 
ssdesignAuthor Commented:
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
 
ozoCommented:
I think you can use PHP to submit the points to http://www.aquarius.geomar.de/omc/make_map.html
0
 
ssdesignAuthor Commented:
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
 
ozoCommented:
Ok, what map boundaries did you use, and what are the coordinates of the corners of your graphic?
0
 
ssdesignAuthor Commented:
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
 
ozoCommented:
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
 
ssdesignAuthor Commented:
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
 
ozoCommented:
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
 
ssdesignAuthor Commented:
I am not using 90N/90S

I am using: 90N/-90S/180E/-180W
0
 
ozoCommented:
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
 
ssdesignAuthor Commented:
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
 
ozoCommented:
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
 
ssdesignAuthor Commented:
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
 
ozoCommented:
What are the y coordinates of those points within the 900x900pixel graphic?
0
 
ssdesignAuthor Commented:
for 180W y=0
for 180E y=900
0
 
ozoCommented:
> 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
 
ssdesignAuthor Commented:
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
 
Ai3dCommented:
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

Independent Software Vendors: 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!

  • 14
  • 14
Tackle projects and never again get stuck behind a technical roadblock.
Join Now