Mapping Brunei

So there was this data hack day we had last month....

I <3 Buses

I Got Invested

Until....

Firdaus reminds me...

Survey Dept

Them Data!

Why Mukim and Kampong data?

Where am I?

Mukims

The Data

Wait what is this data?!?!?

What is this?

Take me to 4.535277,114.727669

The Rabbit Hole Begins

Danger

Acronyms and head aching words ahead!

What is this?

EPSG 29873

EPSG: European Petroleum Survey Group

  • Scientific organization with ties to the European petroleum
  • Compiled and disseminated the EPSG Geodetic Parameter Set, a widely used database of
    • Earth ellipsoids
    • Geodetic datums
    • Geographic and projected coordinate systems
    • Units of measurement
    • etc

World Geodetic System (WGS)

Standard in cartography, geodesy, navigation including by GPS

 

Standard coordinate system for the Earth

 

Latest revision is WGS 84 (aka WGS 1984, EPSG:4326), established in 1984 and last revised in 2004

 

WGS 84 is the reference coordinate system used by the Global Positioning System

WGS 84

Web Mercator

a.k.a Google Web Mercator, Spherical Mercator, WGS 84 Web Mercator or WGS 84/Pseudo-Mercator

 

De facto standard for Web mapping applications. It rose to prominence when used in the first Google Maps in 2005.

 

Official EPSG identifier is EPSG:3857

WGS 84 Web Mercator

WGS 84 Web Mercator

sr-org projection 7483

epsg projection 3857

WGS 84

epsg projection 4326

Geographic coordinate systems (lat/long) are based on a spheroidal surface that approximates the surface of the earth
 

A datum typically defines the surface and the position of the surface relative to the center of the earth
 

A projection is a series of transformations which

  • converts the location of points on a curved surface (the reference surface or datum)
  • to locations on flat plane (i.e. transforms coordinates from one coordinate reference system to another)

http://gis.stackexchange.com/questions/664/whats-the-difference-between-a-projection-and-a-datum

What's the difference between a projection and a datum?

Two components of a Coordinate System

1.  A Geographic Coordinate System or GCS

GCS is used to define your real world points on a 3 dimensional digital surface

WGS84 falls under a GCS

2. Projected Coordinate System or PCS

PCS takes points defined with your GCS and translate them to a 2-dimensional surface

This is what people commonly refer to as a "projection"

http://gis.stackexchange.com/questions/149749/is-wgs84-a-coordinate-system-or-projection-system

Is WGS84 a Coordinate system or projection system?

  • Google Earth: geographic coordinate system. wgs84 datum. (EPSG: 4326)
  • Google Maps: projected coordinate system. wgs84 datum. (EPSG 3857)
  • Open Street Map database: geographic coordinate system with units decimal degrees & datum of wgs84. (EPSG: 4326)
  • Open Street Map tiles and WMS webservice: are in the projected coordinate system that is based on the wgs84 datum. (EPSG 3857)
  • Further confusing:
    • often map is in Web Mercator(EPSG: 3857)
    • actual coordinates used are in lat-long (EPSG: 4326).

http://gis.stackexchange.com/questions/48949/epsg-3857-or-4326-for-googlemaps-openstreetmap-and-leaflet

EPSG 3857 or 4326 for GoogleMaps, OpenStreetMap and Leaflet

Even More formats

degrees minutes seconds: 40° 26′ 46″ N  79° 58′ 56″ W
degrees decimal minutes: 40° 26.767′ N  79° 58.933′ W
        decimal degrees: 40.446° N      79.982° W

EPSG 29873: Survey Dept
EPSG: 3857 WGS 84 Web Mercator
EPSG: 4326 WGS 84

Transform Fail

Proj4js

JavaScript library to transform coordinates from one coordinate system to another, including datum transformations

WKT: Well-known text

  • Markup language for representing vector geometry objects on a map, spatial reference systems of spatial objects and transformations between spatial reference systems

  • WKB: well-known binary

    • A binary equivalent of WKT.

    • For databases: PostGIS, Microsoft SQL Server, DB2

  • Formats defined by the Open Geospatial Consortium(OGC) 

+proj=omerc +lat_0=4 +lonc=115 +alpha=53.31582047222222 +k=0.99984 
+x_0=590476.87 +y_0=442857.65 +ellps=evrstSS +units=m +no_defs 
PROJCS["Timbalai 1948 / RSO Borneo (m)",
    GEOGCS["Timbalai 1948",
        DATUM["Timbalai_1948",
            SPHEROID["Everest 1830 (1967 Definition)",6377298.556,300.8017,
                AUTHORITY["EPSG","7016"]],
            AUTHORITY["EPSG","6298"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.01745329251994328,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4298"]],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    PROJECTION["Hotine_Oblique_Mercator"],
    PARAMETER["latitude_of_center",4],
    PARAMETER["longitude_of_center",115],
    PARAMETER["azimuth",53.31582047222222],
    PARAMETER["rectified_grid_angle",53.13010236111111],
    PARAMETER["scale_factor",0.99984],
    PARAMETER["false_easting",590476.87],
    PARAMETER["false_northing",442857.65],
    AUTHORITY["EPSG","29873"],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH]]

Human-Readable OGC WKT

Proj4

coord = [114.71360430047, 4.6084126066456]
// based on place on map at http://spatialreference.org/ref/epsg/29873/
console.log("Input Coordinates                                   :"+
                                "  114.71360430047     ,  4.6084126066456");
console.log("Output Coordinates                                  :"+
                                "  558706.105088       ,  510127.869649");
console.log("-----------------------------------------------------"+
                                "----------------------------------------");

// http://openlayers.org/en/master/examples/scaleline-indiana-east.html
// http://spatialreference.org/ref/epsg/29873/prettywkt/
proj4.defs('BN',
'PROJCS["Timbalai 1948 / RSO Borneo (m)",'+
  'GEOGCS["Timbalai 1948",'+
    'DATUM["Timbalai_1948",'+
      'SPHEROID["Everest 1830 (1967 Definition)",6377298.556,300.8017,
        '+'AUTHORITY["EPSG","7016"]],'+
      'AUTHORITY["EPSG","6298"]],'+
    'PRIMEM["Greenwich",0,'+ 'AUTHORITY["EPSG","8901"]],'+
    'UNIT["degree",0.01745329251994328,'+'AUTHORITY["EPSG","9122"]],'+
    'AUTHORITY["EPSG","4298"]],'+
  'UNIT["metre",1,'+'AUTHORITY["EPSG","9001"]],'+
  'PROJECTION["Hotine_Oblique_Mercator"],'+
  'PARAMETER["latitude_of_center",4],'+'PARAMETER["longitude_of_center",115],'+
  'PARAMETER["azimuth",53.31582047222222],'+
  'PARAMETER["rectified_grid_angle",53.13010236111111],'+
  'PARAMETER["scale_factor",0.99984],'+
  'PARAMETER["false_easting",590476.87],'+'PARAMETER["false_northing",442857.65],'+
  'AUTHORITY["EPSG","29873"],'+
  'AXIS["Easting",EAST],'+'AXIS["Northing",NORTH]]'+
'');

console.log("ol.proj.fromLonLat(coord, 'BN')                     :  " +
  printArray(ol.proj.fromLonLat(coord, 'BN'), "   "));
// http://openlayers.org/en/master/examples/reprojection-image.html
proj4.defs('EPSG:29873', "+proj=omerc +lat_0=4 +lonc=115 +alpha=53.31582047222222 "+
                         "+k=0.99984 +x_0=590476.87 +y_0=442857.65 " + 
                         "+ellps=evrstSS +units=m +no_defs");

console.log("ol.proj.transform(coord, 'EPSG:4326', 'EPSG:29873') :  " +
  printArray(ol.proj.transform(coord, 'EPSG:4326', 'EPSG:29873'), "   "));
console.log("ol.proj.fromLonLat(coord, 'EPSG:29873')             :  " +
  printArray(ol.proj.fromLonLat(coord, 'EPSG:29873'), "   "));

function printArray(arr, space1){ return arr[0] + space1 + ", " + arr[1]; }
Input Coordinates                                   :  114.71360430047     , 4.6084126066456
Output Coordinates                                  :  558706.105088       , 510127.869649
---------------------------------------------------------------------------------------------
ol.proj.fromLonLat(coord, 'BN')                     :  558706.0937005071   , 510098.552281862
ol.proj.transform( coord, 'EPSG:4326','EPSG:29873') :  558706.0937005071   , 510098.552281862
ol.proj.fromLonLat(coord, 'EPSG:29873')             :  558706.0937005071   , 510098.552281862

Output

NOPE!

Though most likely me?

Back to the Drawing Board

Curl it up

Mukims

Kampongs

Buses!!!!!

Route Signboard

GeoJSON in Github

Tools!

Google My Maps

  • Points, Lines, Polygons, Layers
  • Sharing
  • Driving routes (auto lay out lines)
  • Photos on markers
  • So hard to find it exists

GeoJSON.io

  • Points, Lines, Polygons
  • Custom data/attributes
  • Layers somehow
  • Techie
  • No direct collaboration
  • Github Integration is nice

MapBox

  • Points, Lines, Polygons, Layers
  • No sharing / Photos 
  • Modern looking
  • Errors everywhere...

Mappit

  • Points, Lines, Polygons, Photos
  • No layers?
  • Collaborative
  • Clunky

CartoDB

  • Points, Lines, Polygons
  • Focus on data and visualisations (clustering)
  • Not Collaborative?

Any to share?

Mapping Brunei

By Timothy Lim

Mapping Brunei

  • 2,138