Mapping Brunei
Presented at Brunei Geek Meet
So there was this data hack day we had last month....
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2553102/pasted-from-clipboard.png)
I <3 Buses
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2532930/bus2.png)
I Got Invested
Until....
Firdaus reminds me...
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2553113/mfirdaus_chat.png)
Survey Dept
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2533007/survey_dept.png)
Them Data!
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2553140/survey_dept_outline.jpg)
Why Mukim and Kampong data?
Where am I?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2532974/Search_Post_Code.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2532958/Kampong_Search.png)
Mukims
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2553140/survey_dept_outline.jpg)
The Data
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2533067/The_Data.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2532923/pasted-from-clipboard.png)
Wait what is this data?!?!?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2533076/What_is_this_data2.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2532932/pasted-from-clipboard.png)
What is this?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2533010/Coordinates_Zoom.png)
Take me to 4.535277,114.727669
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2533019/Brunei_Coordinates.png)
The Rabbit Hole Begins
Danger
Acronyms and head aching words ahead!
What is this?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2533010/Coordinates_Zoom.png)
EPSG 29873
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2538460/EPSG_29873.png)
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
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2533941/wgs84.png)
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
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2533968/wgs84_aux.png)
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).
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
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2534162/Transform_Coordinates.png)
EPSG 29873: Survey Dept
EPSG: 3857 WGS 84 Web Mercator
EPSG: 4326 WGS 84
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2534300/Transform_Success_.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2538460/EPSG_29873.png)
Transform Fail
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2534315/transform_fail.png)
Proj4js
JavaScript library to transform coordinates from one coordinate system to another, including datum transformations
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2538460/EPSG_29873.png)
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'), " "));
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2543817/coordinates.png)
// 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
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2543817/coordinates.png)
NOPE!
Though most likely me?
Back to the Drawing Board
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2538683/Back_to_the_Drawing_Board_aka_Query.png)
Curl it up
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2538720/curl_it_up.png)
Mukims
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2538737/Mukims.jpg)
Kampongs
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2538731/Kampongs.jpg)
Buses!!!!!
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2532930/bus2.png)
Route Signboard
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2538805/bus_route.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2538825/geojson.io.png)
GeoJSON in Github
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2538808/geojson.png)
Tools!
- Mapping Libraries
- https://developers.google.com/maps/documentation/: the 'default'?
- http://leafletjs.com/: mobile friendly
- http://openlayers.org/: complex but powerful
- http://www.openstreetmap.org/
- GUI
Google My Maps
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2544316/Google_My_Maps_1.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2544322/Google_My_Maps_2.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2544333/Google_My_Maps_3.png)
- Points, Lines, Polygons, Layers
- Sharing
- Driving routes (auto lay out lines)
- Photos on markers
- So hard to find it exists
GeoJSON.io
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2544430/geojson.io_screenshot.png)
- Points, Lines, Polygons
- Custom data/attributes
- Layers somehow
- Techie
- No direct collaboration
- Github Integration is nice
MapBox
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2544409/mapbox_screenshot.png)
- Points, Lines, Polygons, Layers
- No sharing / Photos
- Modern looking
- Errors everywhere...
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2544421/mapbox_errors.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2544422/mapbox_errors_2.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2544423/mapbox_errors_3.png)
Mappit
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2544510/Mappit_screenshot.png)
- Points, Lines, Polygons, Photos
- No layers?
- Collaborative
- Clunky
CartoDB
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2544564/cartodb_1.png)
- Points, Lines, Polygons
- Focus on data and visualisations (clustering)
- Not Collaborative?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/87792/images/2544558/cartodb.png)
Any to share?
Mapping Brunei
By Timothy Lim
Mapping Brunei
- 2,221