NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Using CartoCSS/Tilemill, I have one layer for the land polygons and one for urban areas, as follows:

#zoomed-polygons[zoom>7] {
  polygon-fill: white;
}

#urban[zoom>=4] {
  polygon-fill: #FFCC99;
  polygon-opacity: 0.66;
  polygon-smooth: 0.75;
}

I would like the urban areas to be clipped inside the land mass so they do not extend to water areas, unlike on the following screenshot:

map example

I believe comp-op: dst-in; is the correct way to go, but regardless of the comp-op value I set, I can't get anywhere near the desired result, unfortunately.

asked 20 Feb '16, 11:02

Vincent%20T's gravatar image

Vincent T
31113
accept rate: 0%


Bear in mind that when you set a map background-colour (i.e. the sea in your example) then every source image is fully opaque and most of the alpha-blending comp-ops become much less useful.

The tilemill comp-op documentation states:

"The dst-in comp-op will only draw parts of the destination that intersect with parts of the sources. The colors of the source will not be drawn, only the alpha channel (the shapes). If your source is completely solid, this operation will effectively be the same as dst, since all parts of the destination will intersect with the source."

The last sentence here is the most important - your source is completely solid. The approach that I would recommend is to use ocean polygons, not land polygons, and then draw land(background colour), city polygons and then ocean polygons on top.

permanent link

answered 22 Feb '16, 12:21

Andy%20Allan's gravatar image

Andy Allan
12.5k23128153
accept rate: 28%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×36
×23

question asked: 20 Feb '16, 11:02

question was seen: 2,750 times

last updated: 22 Feb '16, 12:21

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum