Logoja e OpenStreetMap OpenStreetMap

overpass turbo now with MapCSS support

Postuar nga tyr_asd më 15 Prill 2013 në English Last updated on 17 Prill 2013.

overpass turbo (overpass-turbo.eu) – “the” graphical user interface for Overpass API – just got a nice new feature: Now, you can use MapCSS to style the results of your Overpass queries.

MapCSS

MapCSS is a CSS-like language for map stylesheets. In overpass turbo, those stylesheets can be attached to a query by using a special curly-bracket “mustache” notation:

<osm-script>
  ... your overpass query here ...
</osm-script>
{{style:
  ... your mapcss stylesheet here ...
}}

MapCSS support is still somewhat limited (no text labels, no casings for lines, no layers - more information) but you can already achieve quite pleasant results: See (and try) the examples below.

Supported styling-properties include:

  • lines: color, width, opacity and dash-arrays
  • areas: fill-color, fill-opacity and casings
  • points: icons or symbols (circle)

Examples

Development

Next, I’d like to make MapCSS also available for the “interactive map” export. This would allow to easily create pretty nice interactive embeddable maps.

Then, apart from implementing missing MapCSS features (such as text-labels and line-casings), I think about letting the user customize the following things with MapCSS, too:

  • the content of the popups (and whether or not to show popups at all)
  • background tiles and overlays (currently MapCSS allows to set a background color only - but why stop there?)
  • more dynamic properties that are only relevant for interactive maps (:hover?)

Most of the MapCSS parsing code was written by Richard Fairhurst for an early version of the iD-editor, but abandoned and now resurrected for this project. I think, once this feature is stable, I could provide a vanilla-javascript version of this mapcss implementation as an independent ready-to-use library (“jsmapcss”).

Email icon Bluesky Icon Facebook Icon LinkedIn Icon Mastodon Icon Telegram Icon X Icon

Discussion

Koment nga Richard15 Prill 2013 te 15:46

That’s crazily good - very impressed.

Koment nga Tom Chance15 Prill 2013 te 16:09

This is great, thanks!

Koment nga ingalls15 Prill 2013 te 20:10

Wow, I’ve been playing around with it and can see it being very useful!! Really great job

Koment nga Tom Chance16 Prill 2013 te 08:59

Quick question - is it possible to render features several times dependent on different tags?

For example I was hoping this would result in big fat green lines with thin black ones overlaid on top, but it just rendered the black lines without the green underneath:

way[sidewalk=both] { width:8; color: green; } way[highway=residential] { color:black; width:2; opacity:1; }

Koment nga tyr_asd16 Prill 2013 te 09:15

@Tom: No, multiple layers are not supported yet. For this I’ll have to rewrite some of the data-rendering code, so it won’t be available very soon, I’m afraid.

Koment nga Tom Chance16 Prill 2013 te 14:06

No problem, thanks for your work so far.

Koment nga mikelmaron29 Prill 2013 te 23:00

awesome. hey, when can we get a simple link from osm.org export tab to overpass turbo?

Koment nga tyr_asd30 Prill 2013 te 11:06

@mikelmaron: Idk, could that be useful? I thought more about augmenting the “browse data” view with some overpass turbo features…

Koment nga jotzt30 Mars 2014 te 17:36

Is there a way to use the MapCSS-“metric()” function with overpass turbo?

Koment nga tyr_asd30 Mars 2014 te 18:25

@jotzt: no, I’m afraid, that’s not yet implemented.

Koment nga Robot8A16 Dhjetor 2016 te 20:00

Is there any way to not draw placeholders without clicking the option in Overpass settings? I mean, is there any command or parameter to do it automatically?

Koment nga tyr_asd16 Dhjetor 2016 te 20:51

@Robot8A: Unfortunately, that’s also one more thing on my to-to list.

Identifikohu për të lënë një koment