37
LEVERAGING VECTOR TILE LAYERS IN WEB APPS Rene Rubalcava, Julie Powell

LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

LEVERAGING VECTOR TILE LAYERS

IN WEB APPS

Rene Rubalcava, Julie Powell

Page 2: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Agenda

• Introduction to vector tile layers

- ArcGIS Online vector tile basemaps

- Custom vector tile layers using ArcGIS Pro

- Styling vector tile layers

• Use vector tile layers in your web app

• Client-side layer styling

• Working with sublayers

• Labeling

- Localization

- Map rotation

• Q&A

Page 3: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Introduction

Page 4: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Why vector tiles?

• GPUs have changed the landscape

- On your devices (OpenGL)

- In your browser (WebGL)

- On your desktop (DirectX, OpenGL)

- Even in virtualized systems (vGPU)

• Vector data can remain vector, draw at native resolution

• Raster data still best served as raster in most circumstances

Page 5: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Advantages of vector tiles

• Display quality

- Best possible resolution for Retina displays

- Small efficient format

• Dynamic labeling

- Clearer, more readable text

- On the fly labeling for heads up display

• Map Styling

- Streets, Topo, Canvas from one tileset

- Day and Night mode

- Restyling

Labels rotate and flip

Page 6: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Considerations

• IE11+

• Work best on machines with newer hardware

• Printing is still in the works (on the roadmap for 2017)

Page 7: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Vector tile format

• Vector tiles are stored using protocol buffers

- Compact binary format for transferring data

- Data is organized into layers of geometry with key/value pairs of attributes

• A style file defines

- The layer order

- Definition query for each symbol layer

- Symbol information for each symbol layer

Page 8: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Vector tile basemaps

• Available with ArcGIS Online since November 2015

• Street (with and w/o relief), Topo, Night, Navigation, Dark Canvas, Light Canvas, Hybrid

Page 9: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Using vector tiles in your applications

• Multiple ways to use vector tiles:

- A) Use Esri provided vector tiles / styles

- B) Style Esri vector tiles for your own use

- Change colors

- Drop features

- Match the needs of your application

- C) Create your own vector tiles from your own data

Page 10: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Vector tiles in the ArcGIS API for JavaScriptVectorTileLayer

• Configured in web maps or added directly in code (VectorTileLayer)

• Supported in 3.15+ and 4.0

• Works with all published Vector Tiles

• Tiles drawn in WebGL

• IE 11+

Page 11: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Using and styling ArcGIS vector tile basemaps

Demo

Page 12: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

How to bring a Vector Tile Layer into your JS app

• Include the vector tile layer in a web map

• Reference one of the ArcGIS Online basemaps in the map constructor by name

- i.e. “streets-vector”

• Create the vector tile layer from the item’s style JSON, located here:

- https://www.arcgis.com/sharing/rest/content/items/[ITEM ID]/resources/styles/root.json

• Create the vector tile layer from the service URL. Looks like:

- http://basemaps.arcgis.com/b2/arcgis/rest/services/World_Basemap/VectorTileServer

Page 13: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Styling vector tiles

• Simple Style Copy

- Save tile layer to your Portal or Online account

• Hand editing JSON

- Update map item

• Two additional sample Vector Styling Apps simplify this:

- Vector Style JSON Editor - GitHub

- Vector Basemap Style Editor - GitHub

Thanks for the styling tools, Rene Rubalcava and John Grayson!

Page 14: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Client-side Layer Styling

Page 15: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Client-side Layer Styling

• Vector Tiles Hacking agenda

- DIY styles

- Change colors

- Remove layers

- Suit them to your needs

- Create your own vector tiles!

Page 16: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Client-side Layer Styling

Styles Resources

Page 17: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

What you can do!

• Modern Antique

• Newspaper

Esri Vector Tile Basemaps (continued)

Vector Tiles: Styling Your Own Base Maps

Page 18: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Client-side Layer Styling

• Dissecting a style

- Glyphs – Url to fonts

- Sprite – Images, like Highway shields, markers, etc…

- Sources – Information on the source URL for Vector Tiles

- Layers – Group of layer styles and annotations

https://www.mapbox.com/mapbox-gl-style-spec/

Page 19: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Client-side Layer Styling

{

"id": "Building",

"layout": {},

"minzoom": 15,

"paint": {

"fill-color": "#552582",

"fill-outline-color": "#D9D1B8"

},

"source": "esri",

"source-layer": "Building",

"type": "fill"

}

Must be unique

Can also have maxZoom

Render type

Color properties

Source layer name to use

Page 20: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Client-side Layer Styling

• Branded Basemaps

• Match UI to Map

Page 21: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Working with sublayers

• Can add/remove layers as needed

• Less layers = less styling

Page 22: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Working with sublayers

• Demos - https://github.com/odoe/esrijs-vt-demos

Page 23: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Beyond basemaps

Page 24: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Not just for basemaps

• Vector Tiles for large datasets to display client-side

• Used in conjunction with basemaps

• Display Vector Tiles, Query Features

Page 25: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Not just for basemaps

• Author data in ArcGIS Pro

• Create Vector Tile Package

• Publish vtpk to ArcGIS Online

• Publish buddy Feature Service (optional)

Page 26: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Not just for basemaps

• Author data in ArcGIS Pro

Page 27: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Not just for basemaps

• Create an Index (recommended)

Page 28: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Not just for basemaps

• Create Vector Tile Package > Publish vtpk to ArcGIS Online > Publish buddy Feature Service (optional)

1 2 3

Page 29: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Not just for basemaps

• Result webmap - http://arcg.is/28SVHnj

• Useful application - https://odoe.github.io/esrijs4-vt-misc/vector-tile-query.html

Page 30: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Labeling

Page 31: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Labeling

• Label information is packaged with the vector tiles

• Can select attribute(s) to use for labeling when creating custom tile layers in Pro

• Label font can be customized

Page 32: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Localization

• Esri vector basemaps have two

options:

- global (default)

- local

• Can create localized content for

custom tile layers (in Pro)

• Select the local in the style file:

- 1 style per language configuration

Local version of the world street map

Page 33: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Map Rotation

• Supported in 4.0

• Useful with tablets/mobile devices

• Aligning the map for geographical significance (i.e. a coastline)

• Labels rotate with the map

Page 34: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Disputed boundaries

Page 35: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Q&A

Page 36: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

More sessions about vector tile layers

• Vector Tiles: Styling Your Own Base Maps

- Wed 3:15-4:30

• Styling Vector Tiles (DT)

- Thurs 10:30-11:15

• Designing Esri's Vector Tile Basemaps (DT)

- Thurs 12-12:30

• Best Practices for Caching Maps and Vector Tile Layers

- Thurs 1:30-2:45

• Desktop Mapping: Creating Vector Tiles

- Thurs 3:15-4:30

Page 37: LEVERAGING VECTOR TILE LAYERS IN WEB APPSproceedings.esri.com/library/userconf/proc16/tech-workshops/tw_1887-311.pdf · Please take our Survey: Leveraging Vector Tile Layers in Web

Please take our Survey: Leveraging Vector Tile Layers in Web AppsYour feedback allows us to help maintain high standards and to help presenters

Find the sessionyou want to review

Find your event in the Esri Events App

Scroll down to the bottom of the session

Answer survey questions and submit