Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here

osm-bright

A Carto template for OpenStreetMap data

Subscribe to updates I use osm-bright


Statistics on osm-bright

Number of watchers on Github 588
Number of open issues 44
Average time to close an issue 7 months
Main language CartoCSS
Average time to merge a PR 19 days
Open pull requests 11+
Closed pull requests 6+
Last commit about 4 years ago
Repo Created almost 10 years ago
Repo Last Updated over 2 years ago
Size 1.44 MB
Organization / Authormapbox
Contributors19
Page Updated
Do you use osm-bright? Leave a review!
View open issues (44)
View osm-bright activity
View on github
Book a Mock Interview With Me (Silicon Valley Engineering Leader, 100s of interviews conducted)
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating osm-bright for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

OSM Bright

screenshot

OSM Bright is a sensible starting point for quickly making beautiful maps based on an OpenStreetMap database. It is written in the Carto styling language and can be opened as a project in TileMill.

The style is still a work in progress and you are encouraged to use the issue tracker to note missing features or problems with the current implementation.

Quickstart

Setup Instructions

1. Download shapefiles

OSM Bright depends on two large shapefiles. You will need to download and extract them before continuing.

Download them to the shp directory in the osm-bright folder. You can do this with wget like:

wget http://data.openstreetmapdata.com/simplified-land-polygons-complete-3857.zip
wget http://data.openstreetmapdata.com/land-polygons-split-3857.zip

If you are going to use the osm2pqsql style you will need another (but smaller shapefile) wget http://mapbox-geodata.s3.amazonaws.com/natural-earth-1.4.0/cultural/10m-populated-places-simple.zip

Once downloaded, extract them from their zip files.

2. Run the shapefiles through shapeindex

Shapeindex is a tool that improves performance for shapefiles in Tilemill.

Mac and Linux users already have Shapeindex installed through Tilemill but Windows users will need to download Shapeindex for Windows before continuing.

To run Shapeindex on Mac and Linux, go to the terminal, move to the shp directory of osm-bright, run shapeindex in each shp subdirectory like:

shapeindex land-polygons-split-3857.shp

3. Set up PostgreSQL & PostGIS

If you don't already, you need to have PostgreSQL installed & running with a PostGIS database setup within it. See the PostGIS documentation for full information on how to do this.

4. Import OpenStreetMap data

You will need an OSM database extract in one of the following formats:

  • .osm.pbf (binary; smallest & fastest)
  • .osm.bz2 (compressed xml)
  • .osm (xml)

You can find appropriate data extracts for a variety of regions at http://download.geofabrik.de or https://mapzen.com/metro-extracts/. See the OSM wiki for information about (very large) full-planet downloads.

You need to process this data and import it to your PostGIS database. You can do this with either Imposm or osm2pgsql; see their respective websites for installation instructions.

Using Imposm

If you are using Imposm, you should use the included mapping configuration which includes a few important tags compared to the default. The Imposm import command looks like this:

imposm -U <postgres_user> -d <postgis_database> \
  -m /path/to/osm-bright/imposm-mapping.py --read --write \
  --optimize --deploy-production-tables <data.osm.pbf>

See imposm --help or the online documentation for more details.

Using osm2pgsql

If you are using osm2pgsql the default style file should work well. The osm2pgsql import command looks like this:

osm2pgsql -c -G -U <postgres_user> -d <postgis_database> <data.osm.pbf>

See man osm2pgsql or the online documentation for more details.

5. Edit the configuration

You'll need to adjust some settings for things like your PostgreSQL connection information.

  1. Make a copy of configure.py.sample and name it configure.py.

    cp configure.py.sample configure.py

  2. Open configure.py in a text editor.

  3. Make sure the importer option matches the program you used to import your data (either imposm or osm2pgsql).

  4. Optionally change the name of your project from the default, 'OSM Bright'.

  5. Adjust, if needed, the path to point to your MapBox project folder.

  6. Make any adjustments to the PostgreSQL connection settings. Your database may be set up so that you require a password or different user name.

  7. Optionally adjust the query extents or shapefile locations. (Refer to the comments in the configuration file for more information.)

  8. Save & close the file.

6. Run make.py

./make.py

This will create a new folder called build with your new project, customized with the variables you set in configure.py and install a copy of this build to your MapBox project folder. If you open up TileMill you should see your new map in the project listing.

Click on the map to view it in the editing interface.

IMPORTANT

Have patience: the first time the project opens it needs to download very large shapefiles before the map can render. This can take 5-10 minutes on a fast connection and longer on a slow connection. Keep TileMill open and feel free to navigate back to the projects view then back to the project editor view to check on its loading status. You can also check the TileMill logs to see the download status of the remote files.

Once the map tiles show up, you're now ready to start editing the template in TileMill!

osm-bright open issues Ask a question     (View All Issues)
  • about 4 years Licence text still mentions "Development Seed, Inc."
  • about 4 years Missing a few object-types in OSMBright
  • about 4 years Clarify licence
  • over 4 years OSM Planet
  • over 4 years EACCES, mkdir '/home/webgis/Documents/MapBox/project/OSMBright/layers'
  • over 4 years I want to create a map of jeddah city of Saudi Arabia. How can I create boundaries of this particular city
  • over 4 years where i can find the shp directory ?
  • almost 5 years Rendering osm-bright tiles in english only
  • almost 5 years Issue during ./make.py
  • over 5 years Hard to tell where cycle / pedestrian paths are.
  • over 5 years Postgis Plugin: Bad connection ... 'landuse_gen0' in Layer
  • over 5 years OSMBright incredibly slow for osm2pgsql output
  • over 5 years Not all street labels are shown when using osm2pgsql
  • almost 6 years ENOENT, readdir '.../shp/land-polygons-split-3857'
  • almost 6 years TileMill fails to load Europe imported data as tiles. What am I doing wrong?
  • over 6 years Border between Spain and France missing
  • over 6 years imposm using osm-bright mapping roads view fields missing
  • almost 7 years OSM Bright documentation questions
  • about 7 years Invalid SQL query for #landuse_label
  • about 7 years support both python 2.x and 3.x in make.py
  • about 7 years simplify mml by using !pixel_width! and !pixel_height!
  • over 7 years no pg_hba.conf entry for host "30.30.30.1" but host should be 30.30.30.30
  • over 7 years imposm / osm-bright fails with UnicodeEncodeError
  • over 7 years One way arrows are not reversed correctly when oneway=-1
  • about 8 years osm2pgsql imported planet slow queries
  • over 8 years osm-bright does not render administrative boundaries when data is imported via osm2pgsql)
  • over 8 years POI Layer missing
  • over 8 years noauto roads
  • over 8 years tertiary_link
  • over 8 years render highway=*_link inlines below other inlines
osm-bright open pull requests (View All Pulls)
  • Fixed one way rendering.
  • Support arabic fonts
  • Some missing attributes for shapefiles
  • Extend configuration options to include the layer 'ne_places' shapefile location
  • Exclude non-buildings from buildings data set
  • extended oneway arrow support
  • Make uniform lighten/darken/fadeout syntax
  • train stations
  • updated osm-bright.imposm.mml so that make.py doesn't crash w/ imposm importer
  • An stack on docker for getting a tile server using this style
  • Updated the README - shp file directory
osm-bright questions on Stackoverflow (View All Questions)
  • Is there an easy way to get the config["postgis"]["extent"] values from a postgis database for osm-bright?
  • Getting osm2pgsql usage error while installing OSM Bright for TileMill
osm-bright list of languages used
Other projects in CartoCSS
Powered by Autocode - Instant Webhooks, Scripts and APIs
Autocode logo wordmark