geographical perl modules

34
Geographical perl modules

Upload: peter-mendez

Post on 01-Jan-2016

15 views

Category:

Documents


0 download

DESCRIPTION

Geographical perl modules. Some etymology. Some etymology. geo'graphy Drawing the Earth. Some etymology. geo'graphy Drawing the Earth geo'metry Measuring the Earth. The interest in geography. The interest in geography. The Open Guide to London - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Geographical perl modules

Geographical perl modules

Page 2: Geographical perl modules

Some etymology

Page 3: Geographical perl modules

Some etymology

geo'graphyDrawing the Earth

Page 4: Geographical perl modules

Some etymology

geo'graphyDrawing the Earth

geo'metryMeasuring the Earth

Page 5: Geographical perl modules

The interest in geography

Page 6: Geographical perl modules

The interest in geography

The Open Guide to London

Geocache, MUD-London and other web based mapping ideas

Page 7: Geographical perl modules

The interest in geography

'Grubstreet' had map links with OS grid coordinates (www.streetmap.co.uk)

We can use the X and Y to plot a map.

Page 8: Geographical perl modules

The interest in geography

X

Y

Page 9: Geographical perl modules

Find by distance

We know the location of A (X1, Y1)

We know the location of B (X2, Y2)

The distance between them is:Sqrt ( (X2 - X1)^2 + (Y2 - Y1)^2)

And: OS eastings and northings work in Metres

Page 10: Geographical perl modules

BUT: everyone else uses Latitude and Longitude

The standard for GPS

Works worldwide

Page 11: Geographical perl modules

The problem

The world is flat

Page 12: Geographical perl modules

The problem

The world is flat round

Page 13: Geographical perl modules

Latitude and Longitude are angles

Page 14: Geographical perl modules

Mercator's Projection

Page 15: Geographical perl modules

Mercator's Projection

Was designed for nautical use

Preserves angles (azimuth, heading)

Distorts large distances

Works well over short range distances

The Mercator projection is geared to temperate latitudes (e.g. Europe)

Page 16: Geographical perl modules

Transverse Mercator

Page 17: Geographical perl modules

Ordnance Survey Grid

Is a transverse Mercator, with false (offset) Easting and Northing.

A perl module exists to convert between OS Grid and Lat/LongGeography::NationalGrid

Page 18: Geographical perl modules

Geography::NationalGrid

Object Orientated interface

Each object is a location

As parameters to new specify one of the following:Lat/LongOS Grid reference e.g. TQ 1234566 digit Easting and Northing (i.e. X and Y)

Page 19: Geographical perl modules

Geography::NationalGrid

Method calls include: latitude, longitudegridReferenceeasting, northingdeg2string( $degrees )

Converts an angle to degrees, minutes and seconds

Page 20: Geographical perl modules

Geography::NationalGrid

Subclassable

Subclasses are used to implement grids for individual countries.

The module comes with:Geography::NationalGrid::GBGeography::NationalGrid::IE

Page 21: Geographical perl modules

Back to OpenGuides

Location and find_by_distance are based on the Ordnance Survey grid

Page 22: Geographical perl modules

Back to OpenGuides

Location and find_by_distance are based on the Ordnance Survey grid

The OS charge £££ licence fees to use their data and maps

Page 23: Geographical perl modules

Back to OpenGuides

Location and find_by_distance are based on the Ordnance Survey grid

The OS charge £££ licence fees to use their data and maps

We want a system that will work outside the UK and Ireland

Page 24: Geographical perl modules

Why don't we do it ourselves?

Radius of a circle of parallel

R = E cos A

where

E = radius of EarthA = latitude

Page 25: Geographical perl modules

The radian approximation

For small θ

sin θ < θ < tan θ

θ must be in RADIANS

Page 26: Geographical perl modules

The radian approximation

For small θ

sin θ < θ < tan θ

θ must be in RADIANS

For a small distance on the groundThe conversion between lat/long and X/Y is

linear

Page 27: Geographical perl modules

Transverse Mercator revisited

There is an emerging standard, UTMUniversal Transverse Mercator

It is not UK-centric

Page 28: Geographical perl modules

Problem #2

The world is flat roundsquashed

Page 29: Geographical perl modules

The Earth is an oblate spheroid

More like the shape of an apple than a ball

Instead of projecting onto a cylinder, we project on to an ellipsoid

Page 30: Geographical perl modules

To use UTM

You need to specify a datumThis includes an ellipsoid and offsets

(false easting and false northing)

Page 31: Geographical perl modules

Geo::Coordinates::UTM

Takes an ellipsoid, not a datumHence no internal facility for false easting

or false northing.

Non OO interface.

Page 32: Geographical perl modules

latlon_to_utm

my ($zone,$east,$north) = latlon_to_utm ( 'clarke 1866', 98.251, 2.562);

Page 33: Geographical perl modules

utm_to_latlon

my ($lat,$long) = utm_to_latlon ('clarke 1866', '30V', 12554, 41562);

Page 34: Geographical perl modules

Plug-ins for CGI::Wiki and OpenGuides

CGI::Wiki::Plugin::Locator::UK

CGI::Wiki::Plugin::Locator::UTM