Skip to content
Mapbox studio source files for osm2pgsql imported database
PLpgSQL Shell SQLPL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
scripts packaging,=>@kartotherian Mar 25, 2017
sql Merge branch 'master' into tilerator_crash Feb 7, 2019
.gitignore Switch to vanilla postgis-vt-util Aug 4, 2015
LICENSE Initial commit Apr 28, 2015
README.md Fix README.md for SQL commands Dec 17, 2018
data.xml Do not render bays Dec 21, 2018
data.yml Do not render bays Dec 21, 2018
package-lock.json 1.0.2 Oct 30, 2018
package.json 1.0.3 Jan 11, 2019

README.md

osm-bright.tm2source

Data source for Kartotherian's fork of OSM Bright

Install

This style requires an osm2pgsql database with ocean data, custom indexes, and custom functions.

It's probably easiest to grab an PBF of OSM data from geofabrik. Once you've installed PostgreSQL and PostGIS, create a database and import with osm2pgsql:

createdb gis
psql -d gis -c 'CREATE EXTENSION postgis; CREATE EXTENSION hstore;'
osm2pgsql -d gis -E 3857 --hstore ~/path/to/data.osm.pbf

You can find a more detailed guide to setting up a database and loading data with osm2pgsql at switch2osm.org.

Next we need some shapefiles

curl -O http://data.openstreetmapdata.com/water-polygons-split-3857.zip
unzip water-polygons-split-3857.zip && rm water-polygons-split-3857.zip
cd water-polygons-split-3857
shp2pgsql -I -s 3857 -g way water_polygons.shp water_polygons | psql -Xqd gis

Then some custom functions and indexes

cd .. # return to osm-bright.tm2source directory
npm install
psql -Xqd gis -f node_modules/@kartotherian/postgis-vt-util/lib.sql
psql -Xqd gis -f sql/admin.sql
psql -Xqd gis -f sql/functions.sql
psql -Xqd gis -f sql/create-indexes.sql
psql -Xqd gis -f sql/names.sql
psql -d gis -c 'select populate_admin();'

Editing

  • Clone osm-bright.tm2source repository (this one)
  • Install the latest Mapbox Studio Classic Open Mapbox Studio and open the data source. You should see your data as "x-ray" outlines. Don't edit just data.yml or data.xml - they must be in sync; editing this project in MBS only ensures that.

To see the data in style

  • Clone osm-bright.tm2 repository
  • Edit style's project.yml - change the source: to "tmsource:///home/user/.../osm-bright.tm2source" directory. Open it in the Mapbox Studio.

Layers

The order of layers in this style matters because that's the default order that they will be drawn on map. Note that the list of layers goes from bottom to top, opposite to the order in files.

  • landuse - various uses for land: wood, park, industrial zone, etc. Mostly corresponds to OSM's landuse key.
  • waterway - streams, rivers on low zoom, etc.
  • water - water bodies (oceans, lakes, rivers wide enough on a given zoom level to be represented by areas as opposed to lines).
  • aeroway - both areas and lines related to airports: tarmacs, taxiing lines, etc.
  • building - buildings.
  • road - roads and other similar transport ways: streets, bridges and tunnels.
  • admin - administrative borders between countries and regions.
  • country_label - country labels.
  • place_label - city/neighborhood/district labels.
  • poi_label - places of interest. Currently, only transport stations are implemented.
  • road_label - road labels, including highway number shields.
You can’t perform that action at this time.