JavaScript, Java, and others • Computer skill: UNIX and Linux, Networking(L1 to L7), Virtual Machine (VirtualBox, KVM, Docker) • GIS skill: Data processing, Tile • Computer community: • OSGeo.JP • OpenStreetMap Foundation Japan • Japan Unix Society • Mozilla community in Japan • Contact: [email protected] or @smellman 2018/10/17 JICA 2018 Seminar 2
internet. • Map images are separated as tile. • Zoom Level 0 = World • Each zoom level doubles in the dimensions. • Too many tiles use “Web Mercator projection”. • Structure of tile is useful to web. • Scroll, zoom up/down with AJAX request. • Tile become known for Google Maps. • Tile has existed from the late 1990s. 2018/10/17 JICA 2018 Seminar 5 https://a.tile.openstreetmap.org/0/0/0.png
• Z = Zoom Level • X = X coordinate • Y = Y coordinate • Format • Raster image format (png, jpg, webp) • Vector data format (pbf, mvt) 2018/10/17 JICA 2018 Seminar 7
(TMS) • Web Map Tile Service (WMTS) • TMS is simple than WMTS. • TMS’s X Y coordinate is started from bottom left. • Same as Cartesian coordinate system. • WMTS‘s X Y coordinate is started from top left. • Same as Coordinate system for 2D computer graphics. 2018/10/17 JICA 2018 Seminar 10
but The Y coordinates are numbered from top left. • If take no thought of meta data, Y coordinate flipped TMS equals WMTS. • GSI Map use this rule too. • OpenStreetMap call “Slippy Map” • We call zxy tile • {z}/{x}/{y}.png • Also call xyz tile 2018/10/17 JICA 2018 Seminar 12
Mercator • Y coordinate flipped TMS • Provide REST API • {z}/{x}/{y}.{format} • Anyone provide “Specification” • Too many libraries supports ZXY Tile. 2018/10/17 JICA 2018 Seminar 13
have ”data”. • Focus to visualization. • Enable to scroll and zoom up/down. • GSI provides tile of “digital elevation model” as PNG format. • The elevation value obtainable by calculating with RGB values. 2018/10/17 JICA 2018 Seminar 14
“Vector data” • The tile like a data container. • Vector tile doesn’t have style. • Client render image with style settings. • Easy to rotation and bearing. • Supports 3D view. • Also vector tile use only provide data. • Programmable • Client can modify styles. 2018/10/17 JICA 2018 Seminar 15
• De facto standard of Vector Tile in current. • Specification • A tile encoded by Google’s Protocol Buffer format. • Designed with Web Mercator. • Supports Layers and Features. 2018/10/17 JICA 2018 Seminar 18
Style editor as commercial service. • tileserver-gl is OSS software to provide Mapbox Vector Tile and style(includes fonts and sprite image) • It allows raster image hosting with server side rendering. • Maputnik is OSS Mapbox Style editor. • It allows to design with GUI. • Also, you can make the style with text editor. 2018/10/17 JICA 2018 Seminar 20
OK Plugin OpenLayers 4 OK OK Mapbox GL JS OK OK (*1) Tangram (*2) OK OK Android Mapbox GL Native OK OK Google Maps SDK OK NG iOS Mapbox GL Native OK OK Mapkit OK NG 2018/10/17 JICA 2018 Seminar 21 *1: Android webview is supported but buggy. *2: Tangram will be duplicate
Pro with Creators update • Use Docker for Windows • Ubuntu 18.04 • Hardware • 4GB memory • Windows laptop requires 8GB memory • Docker requires to allocate 2GB memory but too many laptop memory shared with Video-RAM. 2018/10/17 JICA 2018 Seminar 23
by International Steering Committee for Global Mapping (ISCGM) • Composed of 8 Data Sets • Vector Data (Transportation, Boundaries, Drainage, Population Centres) • Raster Data (Elevation, Vegetation, Land Cover, Land Use) • Free for non-commercial use. 2018/10/17 JICA 2018 Seminar 25
into github by GSI. • https://github.com/globalmaps • https://globalmaps.github.io/ • Old website was closed • Some countries provides global map archives at the national site. • All links: https://github.com/globalmaps/projectmanagement/ blob/master/REPOS.md • Some links are dead now. 2018/10/17 JICA 2018 Seminar 26
• It was provide as Geography Markup Language (GML) format. • Raster data provide as GeoTiff file. • It was provide as Band interleaved by line (BIL) format. 2018/10/17 JICA 2018 Seminar 27
between versions. • Example: • gmlk10 https://github.com/globalmaps/gmlk10 • Global map version 1.x in Sri-Lanka. • gmlk20 https://github.com/globalmaps/gmlk20 • Global map version 2.x in Sri-Lanka. • You can download all specifications: • https://github.com/globalmaps/specifications 2018/10/17 JICA 2018 Seminar 28
Shapefiles to GeoJSON files using QGIS or ogr2ogr. 2. Generate Mapbox Vector tile from GeoJSON files using tippecaneo. Shapefile GeoJSON Mapbox Vector Tile
Shapefile in gmlk20. 3. Right click the layer and select “Save as”. 4. Select ”GeoJSON” in Format. 5. Input File name and save. 2018/10/17 JICA 2018 Seminar 34
from GeoJSON. • Tippecanoe is difficult to run in Windows. • You need build from source. • Mapbox provides “Dockerfile” to build ”Docker image”. 2018/10/17 JICA 2018 Seminar 36
platform”. • ”software container” is focus to run “software”. • It is easy way to run Unix software in Windows. • Docker provides windows version. • Based on Hyper-V virtualization technology. • Windows 10 Pro can enable Hyper-V. 2018/10/17 JICA 2018 Seminar 37
and “styles” directory under working directory. • Download ZIP archives from following urls and extract: • https://github.com/openmaptiles/fonts/tree/gh-pages • https://github.com/openmaptiles/osm-bright-gl- style/tree/gh-pages • Copy lka.mbtiles under “tileserver¥data” 2018/10/17 JICA 2018 Seminar 44
“tileserver” directory. • Copy downloaded style file (JSON file) to “styles” directory and rename to “globalmap.json”. • Open ”globalmap.json” file in Text Editor. • Modify “name”, “glyphs” and “sprites”. 2018/10/17 JICA 2018 Seminar 48
can’t read any file from localhost because online version run in https schema but localhost will run http schema. • It known as insecure resource issue. • maputnik can run in localhost with docker. 2018/10/17 JICA 2018 Seminar 51 > docker run --rm -it -p 8888:8888 maputnik/editor • Open localhost:8888 in Chrome browser.
Type. • Background • Fill • Line • Symbol • Raster • Circle • Draw circle image. • Fill Extrusion • Fill Extrusion will use 3D. • https://www.mapbox.com/mapbox-gl-js/style- spec/ 2018/10/17 JICA 2018 Seminar 55
Field name is “rtt” • “rtt” = 14 is primary route. • Select ”roadl-primary” layer and click “Add filter”. • Set filter “rtt == 14”. 2018/10/17 JICA 2018 Seminar 67
New layer “roadl-primary-copy” will created. • Change layer ID to “roadl-secondary”. • Modily filter to “rtt == 15”. • Drag down layer. 2018/10/17 JICA 2018 Seminar 68
• Set Zoom 6 = 1 and Zoom 10 = 6, the value will increase between Zoom 6 and 10. • “base” property will use to control the rate witch the function output increases. • base = 1 will be increase linearly. • “base” property can’t edit in maputnik GUI but can edit in JSON editor. • https://www.mapbox.com/mapbox-gl-js/style- spec/#other-function 2018/10/17 JICA 2018 Seminar 70
layout properties. • It can use Feature properties using token like {field_name}. • airp’s nam property is name. • Set {nam} into Field property. • But result seem wrong. • Need to set “Offset”. 2018/10/17 JICA 2018 Seminar 74
style into local. • Open downloaded design file and modify three lines. • sources/global_map/url to “mbtiles://{lka}”. • glyphs to “{fontstack}/{range}.pbf” • sprite to “sprite” • Overwrite globalmap.json in tileserver-gl. 2018/10/17 JICA 2018 Seminar 76
support raster tile output. • The output url will be • http://{server}/styles/{style identifier}/{z}/{x}/{y}.png • You can access from ”raster” in top menu. 2018/10/17 JICA 2018 Seminar 78
• Select “Transparency” • Select Transparency band to None. • Add Transparenct pixel list • From 0, To 0, Percent 100. • Click OK. 2018/10/17 JICA 2018 Seminar 82
parameter”. • Set “Resampling method” to “near” • Set “Zoom levels to render” to “0-11”. • Select your directory to output. • Ex: el_tms 2018/10/17 JICA 2018 Seminar 87
• You need to convert to zxy. • Download tms2xyz.py. • https://github.com/smellman/creating_tiles_with_glo bal_map_support_files/tree/master/2014 • Copy tms2xyz.py into created directory. • Open “OSGeo4W Shell” in Startup -> QGIS 2.x. • Change directory to output directory. • Run following: • python tms2xyz.py el_tms el 2018/10/17 JICA 2018 Seminar 89
tileserver-gl can run too many linux hosts. • But Vector tile needs SSL access in internet. • Let‘s encrypt is useful to get free SSL/TLS Certificates. • https://letsencrypt.org/ • Setup frontend server(Apache/nginx/etc) and connect from server with reverse proxy. 2018/10/17 JICA 2018 Seminar 92
data only, hosting as static image is better. • Apache / nginx / Amazon S3 / etc • Github’s gh-page is useful for free hosting. • Be careful about license. • If you use large number of data, be careful to hosting. • File system limitation: max number of files. • Ext4 on Linux: 4 billion files (specified at filesystem creation time) • File copy will slow. • Mbtiles is a solution to hosting large number of data. 2018/10/17 JICA 2018 Seminar 93
(@hfu) in United Nations tries to make vector tile easy to hosting. • https://github.com/hfu/hands-on-prod • https://github.com/hfu/hands-on-host • He will do workshop in FOSS4G ASIA about UN Vector Tile Toolkit. • I recommend to follow up UN Vector Tile Toolkit. 2018/10/17 JICA 2018 Seminar 98