gravitystorm / openstreetmap-carto

A general-purpose OpenStreetMap mapnik style, in CartoCSS
Other
1.53k stars 821 forks source link

Render amenity=prison over natural features #3841

Open LucFreitas opened 5 years ago

LucFreitas commented 5 years ago

Expected behavior

Render amenity=prison over natural features, like a landuse=military.

Actual behavior

Anotação 2019-08-11 130503 Natural features overlap the amenity=prison. https://www.openstreetmap.org/way/205946580#map=15/-20.3745/-40.5007

jeisenbe commented 5 years ago

In the linked example, there are 4 smaller amenity=prison areas inside the large amenity=prison, for example: https://www.openstreetmap.org/way/679283873. The surrounding scrub and wetland areas do seem to be enclosed in a larger fenced property, but each part of the prison is separate. On the east side there are other buildings which are not enclosed in a prison compound.

jeisenbe commented 4 years ago

This is subset of the similar issue #1285 "Render military areas and prisons on top of buildings and roads" but it is more limited, since it only mentions landcover, and this issue is more likely to be accepted (there are already 5 "thumbs up" responses , so I will leave it open. It would be possible to fix this by moving the amenity=prison pattern to the same layers as landuse=military - the layer called landuse-overlay in project.mml

This should be relatively easy to do, by following the example of how it works with landuse=military and military=danger_area

jeisenbe commented 4 years ago

@LucFreitas would you be interested in submitting a Pull Request to fix this issue?

LorenzoStucchi commented 4 years ago

Hi @jeisenbe, I'm trying to learn and I saw this simple issue to solve, I followed your suggestion and I wrote this code to insert I'm trying to visualize the results but I'm having some problem with Docker.

This is the code, it is correct?

project.mml

  - id: prison-overlay
  geometry: polygon
  <<: *extents
  Datasource:
    <<: *osm2pgsql
    table: |-
      (SELECT
          way,
          landuse,
          military,
          amenity,
          way_area/NULLIF(POW(!scale_denominator!*0.001*0.28,2),0) AS way_pixels
        FROM planet_osm_polygon
        WHERE (landuse = 'military'
          OR amenity = 'prison')
          AND building IS NULL
      ) AS prison_overlay
  properties:
    minzoom: 8

landcover.mss

#prison-overlay {
  [landuse = 'military'][zoom >= 8][way_pixels > 900],
  [landuse = 'military'][zoom >= 13],
  [amenity = 'prison'][zoom >= 10][way_pixels > 75] {
    polygon-pattern-file: url('symbols/grey_vertical_hatch.png');
    polygon-pattern-alignment: global;
    line-color: #888;
    line-width: 3;
    line-opacity: 0.329;
    line-offset: -0.5;
    [zoom >= 15] {
      [amenity = 'prison'][zoom >= 10] {
        polygon-pattern-file: url('symbols/grey_vertical_hatch.png');
        line-opacity: 0.2;
      }
      line-width: 2;
      line-offset: -1.0;
    }
  }
}
jeisenbe commented 4 years ago

It would be better to keep the name of the existing layer, - id: landuse-overlay.

What problems are you having with the Docker setup?

LorenzoStucchi commented 4 years ago

@jeisenbe so the suggestion is to keep only one element merging the existing landuse-overlay and the one that I have created prison-overlay? There other files that I have to change?

LorenzoStucchi commented 4 years ago

@jeisenbe I review, correct the code inserting all the elements inside the landuse-overlay and tested. I saw that the elements in conflicts were the amenity=prison with the natural=scrub.

But I saw that in the meanwhile the element has been deleted by @LucFreitas as it possible to check in the history of the element. Should I propose a pull request anyway?

Adamant36 commented 4 years ago

@LorenzoStucchi I would just do the PR anyway. I'm sure there's other examples and doing a PR tends to cause things like that to come to the surface. Plus, PRs get more attention generally and it helps to be able to browse the code.

LorenzoStucchi commented 4 years ago

@Adamant36 so your suggestion is to do the PR, to increase the attention on the issue and to be able to check the code, right?

Adamant36 commented 4 years ago

@Adamant36 so your suggestion is to do the PR, to increase the attention on the issue and to be able to check the code, right?

Exactly 👍