Git Product home page Git Product logo

osm-bright's Introduction

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's People

Contributors

aaronlidman avatar ajashton avatar amenk avatar artemp avatar bleach avatar ian29 avatar jasonsanford avatar jazzzz avatar kapouer avatar olt avatar ondryk avatar pnorman avatar rharmes avatar rnorris avatar royhodgman avatar samanpwbb avatar skorasaurus avatar tmcw avatar wilsaj avatar xowap avatar yohanboniface avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

osm-bright's Issues

noauto roads

until z14 the noauto roads have no case. You changed the color of those roads to one similar to the @land color. So they habe no contrast on land areas and you wont see them. In older versions from osm-bright you had a darker color for those ways so you could see them on land areas.

@poi_text references itself in palette.mss

In palette.mss there is a line:

@poi_text:          @poi_text;

When I tried to use this in a line:

#linz_address[zoom>=18] {
  text-name:"[house_number]";
  text-face-name:@sans_lt;
  text-size:8;
  text-wrap-width:30;
  text-fill: @poi_text;
}

If gives me an error Maximum call stack size exceeded.

I'm guessing that @poi_text is referencing itself which is causing an infinite loop of sorts?

Attribution

Hi, this is more of a support request than an actual issue. If there is a more appropriate forum for this, please direct me there.

We have forked OSM Bright and made significant changes to the style, to adapt it to another data set than OSM (the Swedish land survey's data).

We're trying to understand what we have to do with regards to attribution. The license talks about source and binary form, but it is not entirely clear to me if rendered tiles are to be considered as "binary form".

In summary: what is the appropriate way to follow the license regarding rendered tiles? Should we reference Mapbox, Development Seed or this repository, or is this only required when redistributing the source (CartoCSS)?

On a side note, we want to redistribute the changes we've made, but have some more work to do regarding the required data mangling for the code to be usable to anyone else.

Package pre-built versions?

Could be very helpful for people who aren't comfortable with the command line and aren't customizing the configuration too much.

add barriers

Mostly only for very high zoom levels, to avoid crowding the map.

lines: walls, fences, hedges...
points: gates, bollards...

amenities don't work with default imposm settings

Two things:

  1. there is no amenities layer in osm-bright template
  2. using .amenity[zoom>=15][amenity='bicycle_parking'] { } doesn't work because imposm uses type, changing the template to use .amenity[zoom>=15][type='bicycle_parking'] { } makes it work

Different themes

Hi guys,

I really love your work! The open source effort of MapBox is amazing :)

I was wondering if you had any plans, or even wanted, to expand osm-bright to support different themes? I've forked osm-bright and changed the sytlesheets to provide a different theme. See: https://github.com/jacobtoye/osm-bright

I'd love to hear your thoughts.

osm2pgsql.mml still references imposm tables

It appears the osm2pgsql template still references quite a few imposm tables osm_*, while there do appear to be some new definitions that look for the typical osm2pgsql tables planet_osm_*.

Or maybe I'm looking at things wrong?

osm2pgsql imported planet slow queries

I imported a full planet via osm2pgsql.

For example "SELECT way, way_area AS area, COALESCE(landuse, leisure, "natural", highway, amenity, tourism) AS type
FROM planet_osm_polygon
WHERE way_area > 100000
ORDER BY way_area DESC
) AS data" query

and

SELECT ST_AsBinary("way") AS geom,"area","name","type" from ( SELECT COALESCE(landuse, leisure, "natural", highway, amenity, tourism) AS type,
name, way_area AS area,
ST_PointOnSurface(way) AS way
FROM planet_osm_polygon
WHERE name IS NOT NULL
AND ST_SetSRID(way,900913) && ST_SetSRID('BOX3D(242458.2537205777 5068997.967759746,243681.2461731433 5070220.960212312)'::box3d, 900913)
AND ST_IsValid(way)
 UNION ALL

  SELECT 'building' AS type, name, way_area AS area,
    ST_PointOnSurface(way) AS way
  FROM planet_osm_polygon
  WHERE name IS NOT NULL
    AND building NOT IN ('', 'no', '0', 'false')
    AND ST_SetSRID(way,900913) && ST_SetSRID('BOX3D(242458.2537205777 5068997.967759746,243681.2461731433 5070220.960212312)'::box3d, 900913)
    AND ST_IsValid(way)
  ORDER BY area DESC
) AS data

hangs forever. Does anyone encounter this problem?

When I import only my city rendering also takes reasonable time.

bundle large shapefiles, or download as part of setup

As TileMill does not yet have the ability to warn users are long background downloads, we should avoid the common pitfall of osm-bright setup and require that the shapefiles are downloaded ahead of time, not during the first view in TileMill.

Country names don't render when using osm2pgsql

The SQL used to fetch places for the #place id in osm-bright.osm2pgsql.mml doesn't include the type of country. This means that no country names are rendered:

SELECT way, place AS type, name, z_order, population\n  FROM planet_osm_point\n  WHERE place in ('state', 'city', 'town', 'village', 'hamlet', 'suburb', 'neighbourhood', 'locality')\n  ORDER BY population DESC NULLS LAST\n) AS data

Adding country fixes the issue, and causes country names to be rendered:

SELECT way, place AS type, name, z_order, population\n  FROM planet_osm_point\n  WHERE place in ('country', 'state', 'city', 'town', 'village', 'hamlet', 'suburb', 'neighbourhood', 'locality')\n  ORDER BY population DESC NULLS LAST\n) AS data

Pull request incoming.

One way arrows are not reversed correctly when oneway=-1

Hi,

just had the problem, that the arrows on a oneway street where heading in the wrong direction. Turned out that it is a oneway=-1 street. The Carto code in OSM Bright is

  [oneway=-1] { marker-file: url(img/icon/oneway-reverse.svg); }

But the oneway-value is not stored as integer in my osm2pgsql import, so I fixed this using:

  [oneway='-1'] { marker-file: url(img/icon/oneway-reverse.svg); }

Thanks for the beautiful start-off-theme!
Tom

SRC Issue

I get this error when I try to install a copy of the project with this new configuration to your MapBox projects directory.

Traceback (most recent call last):
File "./make.py", line 116, in
build()
File "./make.py", line 26, in build
copy_tree("osm-bright", "build")
File "/home/katrina/Documents/osm-bright/lib/utils.py", line 21, in copy_tree
raise DistutilsFileError, "cannot copy tree '%s': not a directory" % src
distutils.errors.DistutilsFileError: cannot copy tree 'osm-bright': not a directory

What do I need to fix?

tunnels

Add support for tunnels on roads and railways

Missing icon swamp-16

When opening osm-bright in Mapbox I'm getting a missing image error showing up in the console:

Marker does not exist: /Users/barnaclebarnes/Documents/MapBox/project/OSMBright/img/swamp-16.png

I'm guessing we need a marker for this somewhere?

tertiary_link

Hi,

There are lots of tertiary_links at least in germany in the osm db. With the default imposm template they will not be imported and so these parts are totally missing in the map.

Beside it would be nice to have a separate style for tertiary roads in osm_bright

OSM Bright project does not contain any map

hi i have done every thing as according to instruction give in quick setup......nd now i have got osm bright project in tile mil but it does not contain any map
although it have layers like places,roads etc nd 4 .mss files....

i m making map of islamabad ohm data has taken by link given at guide....
following is preview of tile mill project
prview

Support osm2pgsql

There are a couple ways this could happen:

  1. Create an alternate mml in the root directory called osm-bright.osm2pgsql.mml. The SQL queries in these layers should coalesce/recast data so that the same filters can be used in the stylesheet as for the ImpOSM version. Then add an option to the configure.py script that lets you choose between setting up an imposm or osm2pgsql project.
  2. Require something like HighRoad to be set up on top of the osm2pgsql database so that it looks like an ImpOSM database. The advantage of this approach is no alternate version of the mml needs to be created or kept up to date.

mixed up osm2pgsql / imposm at http://mapbox.com/tilemill/docs/guides/osm-bright-ubuntu-quickstart/

I believe the following should say "with imposm" not "with osm2pgsql":

at: http://mapbox.com/tilemill/docs/guides/osm-bright-ubuntu-quickstart/

...
With a PBF file downloaded, you can import it with osm2pgsql. Assuming you downloaded the PBF to your Downloads folder, run the following command in the Terminal:
...

Also believe the following paragraph:

This will take something like 1 to 10 minutes, depending on the size of extract you downloaded. (If you downloaded a particularly large extract it may take much longer.) When its finished it will tell you something like “Osm2pgsql took 71s overall”.

should say something different... not quite sure what, as I'm not sure my output is correct!

While in tilemill nothing is showing up?

I am kind of new into this world of mapping, as a newcomer I have followed the path you have set to follow.
imported africa OSM data using osm2pgsql and used it as an importer (osm2pgsql).

Need your help.

imposm / osm-bright fails with UnicodeEncodeError

Using imposm fails with an UnicodeEncodeError when processing relations.

I processed an OSM file from Geofabrik (alps.osm.pbf). At the end it failed with the following error repeated 4 times, and the process hanged.

Last message was: relations: 10k/79k. TileMill complains about missing relations.

$ imposm -U postgres -d osm -m mapbox-osm-bright-c9bc5ee/imposm-mapping.py --read --write --optimize --deploy-production-tables alps_20130208.osm.pbf 
loading mapbox-osm-bright-c9bc5ee/imposm-mapping.py as mapping
password for postgres at localhost:
[11:38:55] ## reading alps_20130208.osm.pbf
[11:38:55] coords: 78954k nodes: 1579k ways: 11279k relations: 78k (estimated)
[11:51:19] coords: 103636k nodes: 365k ways: 12045k relations: 73k
[11:51:21] reading took 12m 25s
[11:51:21] ## dropping/creating tables
[11:51:25] ## writing data
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/imposm/dbimporter.py", line 87, in db_importer
    db.insert(mapping, insert_data)
  File "/usr/local/lib/python2.7/dist-packages/imposm/db/postgis.py", line 104, in insert
    self.cur.executemany(insert_stmt, insert_data)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 9: ordinal not in range(128)

Ubuntu and Windows tilemill crashing when loading OSM-Bright project

Hi,

I followed all steps for both ubuntu and windows and can't seem to get the osm-bright project to load in tilemill. I thought initially it was just downloading the necessary data, however both crash with the same error as soon as i load the project in tilemill now. The TileMill Error is:

[tilemill] Error: child process: "tile" failed with code "3"

Thanks in advance for any advice or help. BTW, total newbie to postgis, both importer tools (I've tried). I have used TileMill since the early releases on snow leopard.

scripting the way back to mapnik + mod_tile / renderd

after importing and styling a map, you may want to export it from tilemill again to use it in your map server.
If you export your project as "mapnik xml" you get the basics for that - but such a file does not run "out of the box". Images have to be copied, path adjusted, I get font errors for font '' and so on...

what about providing a script, that fixes / copies all things you need for deployment?

change setsrid to st_setsrid

Hi!

I've imported OSM data to postgis 2 db with imposm.
When trying to at through any layer attributes in TileMill, I've got an error:

Postgis Plugin: PSQL error:
ERROR: function setsrid(box3d, integer) does not exist
LINE 4: ) AS data WHERE "geometry" && SetSRID('BOX3D(-20037508.34 -2...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
Full sql was: 'SELECT ST_AsBinary("geometry") AS geom,"name","population","type","z_order" from ( SELECT geometry, type, name, z_order, population
FROM osm_places
ORDER BY z_order, population DESC NULLS LAST
) AS data WHERE "geometry" && SetSRID('BOX3D(-20037508.34 -20037508.34,20037508.34 20037508.34)'::box3d, 900913)'

I guess SetSRID function has to be changed to ST_SetSRID. SetSRID doesn't exist in default postgis installation.

@text_adjust doesn't have any effect?

I've just started using TileMill, so this could easily be a user issue.

I've tried changing the @text_adjust value, but I can't see any difference on the map. in palette.mss:

/* Some fonts are larger or smaller than others. Use this variable to
globally increase or decrease the font sizes. /
/
Note this is only implemented for certain things so far */
@text_adjust: 5;

Also, I was wondering what the value should be - does it correspond to a percentage increase?

Thanks.

no pg_hba.conf entry for host "30.30.30.1" but host should be 30.30.30.30

Postgis Plugin: FATAL:  no pg_hba.conf entry for host "30.30.30.1", user "vagrant", database "osm", SSL on
FATAL:  no pg_hba.conf entry for host "30.30.30.1", user "vagrant", database "osm", SSL off
host=30.30.30.30 port=5432 dbname=osm user=vagrant password=osm connect_timeout=4  encountered during parsing of layer 'landuse_gen0' in Layer at line 214

Why does TileMill tries to connect to 30.30.30.1 if 30.30.30.30 is configured as host?

configure.py

#...
config["postgis"]["host"]     = "30.30.30.30"
config["postgis"]["port"]     = "5432"
config["postgis"]["dbname"]   = "osm"
config["postgis"]["user"]     = "vagrant"
config["postgis"]["password"] = "osm"
#...

Any help appreciated.
Regards

Unicode rendering problem on waterways labels.

There seeems to be a bug in the waterways labels, with unicode.

I don't really know if this bug should be reported to you, or to mapnik.

The following label definition implicitly convert from unicode to "something-else", resulting in accented letters being replaced by the infamous interrogation mark:

[type='stream'][zoom=18] {
    text-name: "[name].replace('([\S\ ])','$1 ')";
}

This could be fixed on your side by not doubling the spaces, or by performing the work in-db, which doesn't lose the encoding.
This is the solution I implemented (by manually editing the mapnik xml export).

The following code demonstrates how this could be done in your json format:

 {
      "Datasource": {
        "dbname": "osm",
        "extent": "-20037508.34 -20037508.34 20037508.34 20037508.34",
        "geometry_field": "way",
        "id": "waterway_label",
        "key_field": "",
        "project": "foss4g-2011",
        "srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
        "table": "( SELECT way, waterway AS type, regexp_replace(name,  '(\s)', '\1 ', 'g')
 \n FROM planet_osm_line\n WHERE waterway IN ('canal', 'river', 'stream') \n AND name IS NOT NULL\n) AS data",
        "type": "postgis"
}

Windows path in configure.py isn't working

Currently is:
Line 14: ... %UserProfile%\MapBox\project ...
which isn't working for me.

Explicitly using something like:
C:\Users[user]\Documents\MapBox\project
seems to do the trick

Would have edited it directly in the file, but my gitwork still needs work...

Win 7, Py2.7, 64 bit

osm-bright does not render administrative boundaries when data is imported via osm2pgsql)

I have been attempting to render cities' boundaries (referred as 'administrative boundaries' in osm) in tilemill (using the osm-bright stylesheet) using the default style of osm2pgsql and osm-bright.

osm2pgsql's default stylesheet treats the tag admin-level with the data type 'text' (see https://github.com/openstreetmap/osm2pgsql/blob/master/default.style#L35 )

Currently, osm-bright's base.mss treats the admin-level field as a numerical, 'float' flavor. When a user is importing osm data into osm-bright via osm2pgsql, no administrative boundaries will be displayed.

To fix this, simply change admin[admin_level=2] to admin[admin_level='2'] in base.mss

Pull request was removed because there still may be conflicts with imposm.

bicycle and pedestrain ways

Hi,

Roads.mss states that it does bicycle and pedestrian ways, but it doesn't. There are no bicycle or pedestrian paths showing up. They are part of the minorroads table in a standard imposm import. And as far as I can tell they are completly ignored by osm-bright.

Compare http://osm.geodan.nl/tms/1.0.0/imposm_EPSG28992/11/936/1066.png with http://www.openstreetmap.org/?lat=52.31741&lon=4.83668&zoom=16&layers=M

ps. I'm working on adding them if I get anything satisfying I'll send a pull request

steven

New OSM-Bright is slow in rendering

I've pulled the new version and imported a new OSM set with the new imposm mapping and now it is incredibly slow in rendering. I've also updated TileMill (0.9.0) so I'm not sure if it is tilemill being slow, or the new queries of OSM-Bright.

Anyone noticed a performance decrease with the advanced tunnel/intersection rendering?

PSQL datasource error

after osm2pgsql import and build, the project renders in Tilemill. When zooming in to level 10, i get a PSQL error:

Postgis Plugin: PSQL error:
ERROR: column "oneway" does not exist
LINE 1: SELECT ST_AsBinary("way") AS geom,"name","oneway","reflen","...
^
Full sql was: 'SELECT ST_AsBinary("way") AS geom,"name","oneway","reflen","type" from ( SELECT way, highway AS type, name, ref, CHAR_LENGTH(ref) AS reflen
FROM planet_osm_line
WHERE highway IN ('motorway', 'trunk')
AND (name <> '' OR ref <> '')
) AS data WHERE "way" && SetSRID('BOX3D(-8707706.262247277 4598451.621636204,-8590298.986801246 4715858.897082234)'::box3d, 900913)'

Viewing the DB, the column 'oneway' in table 'planet_osm_line' does exist. Could this be a bb issue, or a specific to the osm extract that i tried? I tried the DC extract: http://metro.teczno.com/#dc-baltimore

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.