ߏߔߌ߲ߛߑߕߙߌߕߑߡߊߔ ߛߌ߲ߞߐ߲ OpenStreetMap

overpass turbo now with MapCSS support

ߊ߬ ߟߊߦߟߍ߬ߣߍ߲߬ ߦߋ߫ tyr_asd ߓߟߏ߫ 15 April 2013 ߦߋ߫ English ߟߋ߬ ߘߐ߫ ߟߊ߬ߞߎ߬ߘߦߊ߬ߟߌ߬ ߞߐߟߕߊ 17 April 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

ߡߙߌߣߊ߲ ߞߊ߬ ߝߘߊ߫ Richard ߟߊ߫ 15 April 2013 at 15:46 ߘߐ߫

That’s crazily good - very impressed.

ߡߙߌߣߊ߲ ߞߊ߬ ߝߘߊ߫ Tom Chance ߟߊ߫ 15 April 2013 at 16:09 ߘߐ߫

This is great, thanks!

ߡߙߌߣߊ߲ ߞߊ߬ ߝߘߊ߫ ingalls ߟߊ߫ 15 April 2013 at 20:10 ߘߐ߫

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

ߡߙߌߣߊ߲ ߞߊ߬ ߝߘߊ߫ Tom Chance ߟߊ߫ 16 April 2013 at 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; }

ߡߙߌߣߊ߲ ߞߊ߬ ߝߘߊ߫ tyr_asd ߟߊ߫ 16 April 2013 at 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.

ߡߙߌߣߊ߲ ߞߊ߬ ߝߘߊ߫ Tom Chance ߟߊ߫ 16 April 2013 at 14:06 ߘߐ߫

No problem, thanks for your work so far.

ߡߙߌߣߊ߲ ߞߊ߬ ߝߘߊ߫ mikelmaron ߟߊ߫ 29 April 2013 at 23:00 ߘߐ߫

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

ߡߙߌߣߊ߲ ߞߊ߬ ߝߘߊ߫ tyr_asd ߟߊ߫ 30 April 2013 at 11:06 ߘߐ߫

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

ߡߙߌߣߊ߲ ߞߊ߬ ߝߘߊ߫ jotzt ߟߊ߫ 30 March 2014 at 17:36 ߘߐ߫

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

ߡߙߌߣߊ߲ ߞߊ߬ ߝߘߊ߫ tyr_asd ߟߊ߫ 30 March 2014 at 18:25 ߘߐ߫

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

ߡߙߌߣߊ߲ ߞߊ߬ ߝߘߊ߫ Robot8A ߟߊ߫ 16 December 2016 at 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?

ߡߙߌߣߊ߲ ߞߊ߬ ߝߘߊ߫ tyr_asd ߟߊ߫ 16 December 2016 at 20:51 ߘߐ߫

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

ߌ ߜߊ߲߬ߞߎ߲߫ ߞߊ߬ ߛߋ߫ ߡߙߌߣߊ߲ ߦߌ߬ߘߊ߬ ߟߊ߫