Skip to content

Commit 8e8cb07

Browse files
committed
Merge pull request #525 from mapzen/nvkelso/docs
Move docs into main project repo
2 parents deca7a6 + 1f8cae4 commit 8e8cb07

File tree

10 files changed

+484
-261
lines changed

10 files changed

+484
-261
lines changed

README.md

Lines changed: 33 additions & 261 deletions
Large diffs are not rendered by default.

docs/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Mapzen Vector Tile documentation
2+
3+
This repository contains documentation for Mapzen's Vector Tile service.
4+
5+
* [index.md](index.md) - This is where all the good stuff is.
6+
* [use-service.md](use-service.md) - Use the vector tile service, layers, and tile formats.
7+
* [api-keys-and-rate-limits.md](api-keys-and-rate-limits.md) - Don't ruin a good thing.
8+
* [display-tiles.md](display-tiles.md) - Display vector tiles in a map in Tangram, MapboxGL, D3, and other frameworks.
9+
* [layers.md](layers.md) - Layers in the vector tile service detailed incuding available `kind` values and other tags.
10+
* [data-sources.md](data-sources.md) - Where does Mapzen's data come from?
11+
* [attribution.md](attribution.md) - Giving credit where credit is due, and the data licence requires it.
12+
13+
## Contributing
14+
15+
If you have any comments on the documentation, you can drop a note as a GitHub issue, or fork it and add your own exercises.

docs/api-keys-and-rate-limits.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# API keys and rate limits
2+
3+
## Obtain an API key
4+
5+
To use the Mapzen Vector Tile service, you should first obtain a free developer API key. Sign in at https://mapzen.com/developers to create and manage your API keys.
6+
7+
1. Go to https://mapzen.com/developers.
8+
2. Sign in with your GitHub account. If you have not done this before, you need to agree to the terms first.
9+
3. Create a new key for Mapzen Vector Tiles, and optionally, give it a name so you can remember the purpose of the project.
10+
4. Copy the key into your code.
11+
12+
## Rate limits
13+
14+
Mapzen Vector Tiles is a free, shared service and rate limits are not currently enforced.
15+
16+
If an individual user abuses the service (especially by "vacuuming" or "scraping" tiles not pre-generated), the overall system performance will be degraded for the on-demand portion of the service for all users. Cached tiles will continue to be highly available for all users.
17+
18+
We pre-generate popular map areas and those tiles are highly available and served directly via Fastly's edge cache. But map areas with low traffic are generated on-demand.
19+
20+
If you experience slow tile loading in a map area, it's likely because you are a first requester using on-demand tile generation. Subsequent loads of the same map area should be much faster because the tile is now available in the cache, and when the source OSM data changes in that map area we will update the tiles automatically for you.
21+
22+
If you have questions, contact [tiles@mapzen.com](mailto:tiles@mapzen.com). You can also set up your own instance of [Vector Tiles](https://github.com/mapzen/vector-datasource), which has access to the same data used in the Mapzen Vector Tiles service.

docs/attribution.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Attribution
2+
3+
4+
Attribution is required for many of our data providers. Example language is provided below, but you are responsible for researching each project to follow their license terms. More details are available on the [Data Sources]() page.
5+
6+
**Required attribution:**
7+
8+
> © OpenStreetMap contributors, Who's On First
9+
10+
**Full attribution for all projects:**
11+
12+
> © OpenStreetMap contributors, Who's On First, Natural Earth, and openstreetmapdata.com
13+
14+
### Where to attribute
15+
16+
Attribution needs to "appear in a place that is reasonable to the medium or means you are utilising." [Specific examples](http://wiki.osmfoundation.org/wiki/License#Where_to_put_it.3F) are given by the OSM Foundation and are generally best practices for giving credit to any source.
17+
18+
## The fine print
19+
20+
### OpenStreetMap
21+
22+
`source:openstreetmap`
23+
24+
[OpenStreetMap](https://www.openstreetmap.org/) is a community-driven, editable map of the world. All OpenStreetMap data is licensed under the [ODbL](http://opendatacommons.org/licenses/odbl/), a [share-alike](https://en.wikipedia.org/wiki/Share-alike) license which also requires attribution.
25+
26+
```
27+
© OpenStreetMap contributors
28+
```
29+
30+
31+
### openstreetmapdata.com
32+
33+
We include OSM-derived water and earth polygons from [openstreetmapdata.com](http://openstreetmapdata.com) at mid- and high-zooms. This data is under the OSM ODbL license.
34+
35+
```
36+
© OpenStreetMap contributors
37+
```
38+
39+
40+
### Natural Earth
41+
42+
`source:naturalearthdata.com`
43+
44+
Natural Earth is a public domain dataset released as follows:
45+
46+
```
47+
All versions of Natural Earth raster + vector map data found on this
48+
website are in the public domain. You may use the maps in any manner,
49+
including modifying the content and design, electronic dissemination,
50+
and offset printing. The primary authors, Tom Patterson and Nathaniel
51+
Vaughn Kelso, and all other contributors renounce all financial claim
52+
to the maps and invites you to use them for personal, educational, and
53+
commercial purposes.
54+
55+
No permission is needed to use Natural Earth. Crediting the authors is
56+
unnecessary.
57+
```
58+
59+
More details can be found on the Natural Earth [Terms of Use](http://www.naturalearthdata.com/about/terms-of-use/) page.
60+
61+
62+
### Who's On First
63+
64+
`source:whosonfirst`
65+
66+
Crediting [Who's On First](http://whosonfirst.mapzen.com) is recommended and linking back to their License is required.
67+
68+
```
69+
Data from Who's On First. <a href="http://whosonfirst.mapzen.com#License">License</a>
70+
```
71+
72+
Who's On First makes use of a number of open data sources, some of whom **do** require attribution. Neighbourhood sources include: [Zetashapes](https://github.com/whosonfirst/whosonfirst-data/blob/master/LICENSE.md#zetashapes) (geometry), [Quattroshapes](https://github.com/whosonfirst/whosonfirst-data/blob/master/LICENSE.md#quattroshapes) (geometry), and [GeoPlanet](https://github.com/whosonfirst/whosonfirst-data/blob/master/LICENSE.md#geoplanet) (names). Please note that original sources may be modified.
73+
74+
===
75+
76+
See something funky? Please notify us if you believe that an open data project has not been properly noted!

docs/data-sources.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Data sources in Mapzen Vector Tiles
2+
3+
Mapzen Vector Tiles are powered by several major open data sets and we owe a tremendous debt of gratitude to the individuals and communities which produced them.
4+
5+
**Attribution is required** for many of our data providers. See the [Attribution]() document for more information.
6+
7+
## What is sourced at what zooms?
8+
9+
Generally speaking, **Natural Earth** is used at low-zooms, and **OpenStreetMap** is relied on in mid- and high-zooms. Data from **openstreetmapdata.com** is used at the same zooms as the raw OSM data, and is derived from the OSM data. **Who's On First** neighbourhood labels generally come in at high-zooms.
10+
11+
When possible, we annotate individual map features in each tile with a `source` property.
12+
13+
14+
## OpenStreetMap
15+
16+
`source:openstreetmap`
17+
18+
[OpenStreetMap](https://www.openstreetmap.org/) is a community-driven, editable map of the world. It prioritizes local knowledge and individual contributions over bulk imports, which often means it has excellent coverage even in remote areas where no large-scale mapping efforts have been attempted. OpenStreetMap contains information on landmarks, buildings, roads, and natural features.
19+
20+
With its coverage of roads, POIs, landuse, as well as rich metadata, OpenStreetMap is arguably the most valuable dataset used by Mapzen Vector Tiles for general usage.
21+
22+
All OpenStreetMap data is licensed under the [ODbL](http://opendatacommons.org/licenses/odbl/), a [share-alike](https://en.wikipedia.org/wiki/Share-alike) license which also requires attribution.
23+
24+
## openstreetmapdata.com
25+
26+
`source:openstreetmapdata.com`
27+
28+
We include coastline-derived water polygons from [openstreetmapdata.com](http://openstreetmapdata.com) at mid- and high-zooms. This service was created by Jochen Topf and Christoph Hormann for the OpenStreetMap community and the general public and it rocks!
29+
30+
As they say, "The coastline in OpenStreetMap is often broken. The update process will try to repair it, but this does not always work. If the OSM data can't be repaired automatically, the data here will not be updated."
31+
32+
33+
## Natural Earth
34+
35+
`source:naturalearthdata.com`
36+
37+
Natural Earth is a public domain map dataset available at 1:10m, 1:50m, and 1:110 million scales suitable for zooms 0 to 8. Featuring tightly integrated vector and raster data, with Natural Earth you can make a variety of visually pleasing, well-crafted maps with cartography or GIS software.
38+
39+
Natural Earth was built through a collaboration of many [volunteers](http://www.naturalearthdata.com/about/contributors/) and is supported by [NACIS](http://www.nacis.org/) (North American Cartographic Information Society), and is free for use in any type of project (see our [Terms of Use](http://www.naturalearthdata.com/about/terms-of-use/) page for more information).
40+
41+
More details can be found at: http://www.naturalearthdata.com/about/terms-of-use/
42+
43+
44+
## Who's On First
45+
46+
`source:whosonfirst`
47+
48+
[Who's On First](http://whosonfirst.mapzen.com) is Mapzen's place gazetteer, and is used to source neighbourhood labels.
49+
50+
51+
===
52+
53+
Please notify us if you believe that an open data project has not been properly noted.

docs/display-tiles.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Display vector tiles in a map
2+
3+
You can use Mapzen’s vector tile service with a variety of browser-based rendering software packages. Following the syntax of the library you are using, you need to specify the URL to the Mapzen vector tile service, the layers that you want to draw on the map, and styling information about how to draw the features.
4+
5+
## Tangram
6+
[Tangram](https://mapzen.com/projects/tangram) is a WebGL mapping engine designed for real-time rendering of 2D and 3D maps from vector tiles. More details are available on the [Tangram home page](https://mapzen.com/projects/tangram).
7+
8+
## D3
9+
D3 is a JavaScript visualization library that you can use to render to SVG format in your browser. [Mike Bostock](http://bl.ocks.org/mbostock) adapted d3.geo.til [to show OpenStreetMap vector tiles](http://bl.ocks.org/mbostock/5593150). To use D3 with Mapzen vector tiles, use either GeoJSON or TopoJSON format, which have similar syntax, or the Mapbox Vector Tiles format. The layer styling can be inline or referenced from a CSS file.
10+
11+
With D3, specifying the URL to the Mapzen vector tile service takes the form of
12+
13+
`d3.json("https://vector.mapzen.com/osm/{layers}/{zoom}/{x}/{y}.{format}", function(error, json)`
14+
15+
where .{format} can be .json for GeoJSON, .topojson for TopoJSON, or .mvt for Mapbox Vector Tiles.
16+
17+
D3 uses a different zoom level than other map tiles. Default zoom for a map is set using `d3.geo.mercator` and `.scale()`. In this example, 21 is roughly equivalent to z13.
18+
19+
```var projection = d3.geo.mercator()
20+
.scale((1 << 21) / 2 / Math.PI)```
21+
22+
Upper and lower zoom levels are set using `d3.behavior.zoom()` and `.scaleExtent()`. In this example, the scale extent of 12 to 25 is roughly z4-z5 to z17:
23+
24+
```.scaleExtent([1 << 12, 1 << 25])```
25+
26+
See also the [D3 documentation on zoom behavior](https://github.com/mbostock/d3/wiki/Zoom-Behavior).
27+
28+
See the examples at https://github.com/mapzen/d3-vector-tiles for more information. This repository has samples using each input format (see geojson.html, topojson.html, or index.html for .mvt).
29+
30+
## MapboxGL
31+
[MapboxGL](https://www.mapbox.com/mapbox-gl/) is a JavaScript library used to render the Mapbox Vector Tiles protocol buffer format through OpenGL on both web and native platforms.
32+
33+
To specify Mapzen vector tile server as the source, use the following URL string, where .mvt is the file format.
34+
35+
``` "sources": {
36+
"osm": {
37+
"type": "vector",
38+
"tiles": ["https://vector.mapzen.com/osm/{layers}/{zoom}/{x}/{y}.mvt"]```
39+
40+
See https://github.com/mapzen/mapboxgl-vector-tiles for a sample map of Mapzen vector tiles displayed in MapboxGL.
41+
42+
## Hoverboard
43+
[Hoverboard](https://libraries.io/bower/hoverboard/v1.0.1) is a JavaScript library created by Tristan Davies to draw vector tiles as a Leaflet tile layer on the `<canvas>` HTML element of a web page. Hoverboard supports the Mapzen vector tiles in GeoJSON, TopoJSON, or Mapbox Vector Tiles format.
44+
45+
```window.xyz_tile_source_url = 'https://vector.mapzen.com/osm/{layers}/{zoom}/{x}/{y}.json';```
46+
47+
See https://github.com/mapzen/hoverboard for more information. This repository has samples using each input format (see geojson.html, topojson.html, or index.html for .mvt). The Leaflet tile layer is defined in example.js, where you specify the Mapzen vector tile layers you want to render and the colors and symbols used to draw them.

docs/images/vector-tile-example.png

219 KB
Loading

docs/index.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#Mapzen Vector Tiles
2+
3+
The [Mapzen vector tile service](https://mapzen.com/projects/vector-tiles) provides worldwide basemap coverage sourced from [OpenStreetMap](www.openstreetmap.org) and other open data projects, updated daily.
4+
5+
![Contents of an example vector tile](images/vector-tile-example.png)
6+
7+
Vector tiles are square-shaped collections of geographic data that contain the map feature geometry, such as lines and points. Information about how map features are drawn is maintained in a separate stylesheet file.
8+
9+
For many purposes, vector tiles are more flexible than raster tiles, which are images that already have the visual appearance of the map features pre-drawn. With vector tiles, there is no need to head back to the server and fetch a different set of tiles if you want to filter the output or change the style of a road or color of a building.
10+
11+
Vector tiles make real-time rendering possible by sending the underlying data geometry and tags directly to the client, whether that’s a browser or a native mobile app. Buildings and roads can be rendered in different ways, or not at all, when the vector tile is downloaded, and changes happen instantly on the client's side.
12+
13+
With vector tiles you have the power to customize the content and visual appearance of the map. We're excited to see what you build!
14+
15+
### Use Mapzen's Vector Tile Service
16+
17+
To start integrating vector tiles to your app, you need a [developer API key](https://mapzen.com/developers). API keys come in the pattern: `vector-tiles-xxxxxxx`.
18+
19+
* [API keys and rate limits](api-keys-and-rate-limits.md) - Don't abuse the shared service!
20+
* [Attribution requirements](attribution.md) - Terms of service for OpenStreetMap and other projects require attribution.
21+
22+
#### Requestiong tiles
23+
24+
The URL pattern to request tiles is:
25+
26+
`https://vector.mapzen.com/osm/{layers}/{z}/{x}/{y}.{format}?api_key=vector-tiles-xxxxxxx`
27+
28+
Here’s a sample tile in TopoJSON:
29+
30+
`https://vector.mapzen.com/osm/all/16/19293/24641.topojson?api_key=vector-tiles-xxxxxxx`
31+
32+
More information is available about how to [use the vector tile service](use-service.md) and specify custom layers in the service (though we recommend the default `all` layer).
33+
34+
##### Formats
35+
36+
The Mapzen vector tile service provides [tiles in a variety of formats](use-service.md#formats), including GeoJSON, TopoJSON, and MVT binary.
37+
38+
**We recommend** `TopoJSON` format for desktop web development, and `MVT` format for native mobile development. The Mapzen server gzips tiles automatically, so the TopoJSON file format is comparable in file size to MVT over the wire, and it's much friendlier to debug.
39+
40+
##### Drawing a map
41+
42+
How to [draw the tile](display-tiles.md) in a browser is up to the vector-friendly visualization tool, such as SVG, Canvas, or WebGL. The [Tangram](https://mapzen.com/projects/tangram) rendering engine, which uses WebGL, is one way that you can draw the vector tile service in 2D and 3D maps.
43+
44+
### How are vector tiles produced?
45+
46+
Vector tiles are served by clipping geometries to the tile bounding box, and then simplified to match the zoom level to avoid unnecessary complexity at lower zoom levels. These geometries and features are also further processed to facilitate styling.
47+
48+
When changes are made to OpenStreetMap or another map [data sources](data-sources.md), rather than waiting for an image tile to be redrawn, only the geometry coordinates and feature attributes for that particular building or road need to be updated in the vector tile.
49+
50+
Depending on the URL syntax, Mapzen vector tiles can return all of the map data, or just individual [layers](layers.md), or combinations of layers, including water, earth, landuse, roads, buildings and points of interest.
51+
52+
53+
### Build from source
54+
55+
If you are interested in setting up your own version of this service, follow these [installation instructions](https://github.com/mapzen/vector-datasource/wiki/Mapzen-Vector-Tile-Service), or you can also try this [Vagrant VM](https://github.com/mapzen/vagrant-tiles), which will additionally set up other tile components as well.
56+
57+
### Credits
58+
59+
This is based on the work of [Michal Migurski](http://mike.teczno.com/), and extends his [OSM.US-hosted vector tile service](http://openstreetmap.us/~migurski/vector-datasource/) with additional data and format support.

0 commit comments

Comments
 (0)