Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

calculate distance in miles using Easting Northing coordinates.

by Anonymous Monk
on Mar 17, 2008 at 22:20 UTC ( #674665=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello, How do I calculate distance bet. two points in miles, when the longitude and latitude is given in Easting Northing coordinates? Thanks for help! --Nikie

Comment on calculate distance in miles using Easting Northing coordinates.
Re: calculate distance in miles using Easting Northing coordinates.
by igelkott (Curate) on Mar 17, 2008 at 22:35 UTC
    Check CPAN for Easting Northing.
Re: calculate distance in miles using Easting Northing coordinates.
by grep (Monsignor) on Mar 17, 2008 at 23:54 UTC

      OSGB will only work for UK based locations surely. I missed where the questioner mentioned the country he wants to use, but I would have thought that UTM would be more likely to serve his purposes (assuming reasonably short distances are involved).

      Update: I see that the original questioner has worked out the appropriate zone. For anyone else looking here let me explain what UTM is.

      The US military needed a way to specify locations that would work wherever they operate (i.e. anywhere on the Earth). So what they did was split the world into 6 degree longitude slices and have a "Transverse Mercator" projection for each. So locations between -180 degrees and -174 degrees are in UTM Zone 1, -174 to -168 in Zone 2 and so on. New York, being at -74 is in Zone 18 (-78 to -72).

      The other thing to notice is that there are different projections for locations North or South of the equator. So the final suggestion would be to use the zone "UTM18N"

        Thanks all. The country that I need miles for is U.S. I'll check out both Geo::* and UTM. (oops I forgot totally about CPAN... sorry.. and thanks once again everyone!!)
        I took a look at UTM and Geo::Coordinates. For UTM, it is looking for zones. How would I find what zone NY, NJ,PA and CT fall under? Unfortunately, I did not get original shape file, all I have is information, with earting and northing values given. Any help would be appreciated! Thanks!!
        I found the UTM zone information for the data file that I am using : When I use zone as 15, in Geo::Coordinates::UTM, I get following error message: UTM zone(5) invalid. Thanks once again for help!!!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://674665]
Approved by GrandFather
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2015-05-05 10:57 GMT
Find Nodes?
    Voting Booth?

    In my home, the TV remote control is ...

    Results (115 votes), past polls