Geographical perl modules - PowerPoint PPT Presentation

1 / 34
About This Presentation
Title:

Geographical perl modules

Description:

The interest in geography ' ... The interest in geography. X. Y. Find by distance. We know the location of A (X1, Y1) ... Geography::NationalGrid. Subclassable ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 35
Provided by: ivorwi
Category:

less

Transcript and Presenter's Notes

Title: Geographical perl modules


1
Geographical perl modules
2
Some etymology
3
Some etymology
  • geo'graphy
  • Drawing the Earth

4
Some etymology
  • geo'graphy
  • Drawing the Earth
  • geo'metry
  • Measuring the Earth

5
The interest in geography
6
The interest in geography
  • The Open Guide to London
  • Geocache, MUD-London and other web based mapping
    ideas

7
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.

8
The interest in geography
Y
X
9
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

10
BUT everyone else uses Latitude and Longitude
  • The standard for GPS
  • Works worldwide

11
The problem
  • The world is flat

12
The problem
  • The world is flat
  • round

13
Latitude and Longitude are angles
14
Mercator's Projection
15
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)

16
Transverse Mercator
17
Ordnance Survey Grid
  • Is a transverse Mercator, with false (offset)
    Easting and Northing.
  • A perl module exists to convert between OS Grid
    and Lat/Long
  • GeographyNationalGrid

18
GeographyNationalGrid
  • Object Orientated interface
  • Each object is a location
  • As parameters to new specify one of the
    following
  • Lat/Long
  • OS Grid reference e.g. TQ 123456
  • 6 digit Easting and Northing (i.e. X and Y)

19
GeographyNationalGrid
  • Method calls include
  • latitude, longitude
  • gridReference
  • easting, northing
  • deg2string( degrees )
  • Converts an angle to degrees, minutes and seconds

20
GeographyNationalGrid
  • Subclassable
  • Subclasses are used to implement grids for
    individual countries.
  • The module comes with
  • GeographyNationalGridGB
  • GeographyNationalGridIE

21
Back to OpenGuides
  • Location and find_by_distance are based on the
    Ordnance Survey grid

22
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

23
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

24
Why don't we do it ourselves?
Radius of a circle of parallel R E cos
A where E radius of Earth A latitude
25
The radian approximation
  • For small ?
  • sin ? lt ? lt tan ?
  • ? must be in RADIANS

26
The radian approximation
  • For small ?
  • sin ? lt ? lt tan ?
  • ? must be in RADIANS
  • For a small distance on the ground
  • The conversion between lat/long and X/Y is linear

27
Transverse Mercator revisited
  • There is an emerging standard, UTM
  • Universal Transverse Mercator
  • It is not UK-centric

28
Problem 2
  • The world is flat
  • round
  • squashed

29
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

30
To use UTM
  • You need to specify a datum
  • This includes an ellipsoid and offsets
  • (false easting and false northing)

31
GeoCoordinatesUTM
  • Takes an ellipsoid, not a datum
  • Hence no internal facility for false easting or
    false northing.
  • Non OO interface.

32
latlon_to_utm
my (zone,east,north) latlon_to_utm (
'clarke 1866', 98.251, 2.562)
33
utm_to_latlon
my (lat,long) utm_to_latlon ('clarke
1866', '30V', 12554, 41562)
34
Plug-ins for CGIWiki and OpenGuides
  • CGIWikiPluginLocatorUK
  • CGIWikiPluginLocatorUTM
Write a Comment
User Comments (0)
About PowerShow.com