Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Standing up an OSM clone with GeoServer and CSS

Standing up an OSM clone with GeoServer and CSS

This presentation cover the work done by GeoSolutions to create an OSM clone using GeoServer and GeoCSS styling.

Notice that the underlying styling has been released during this presentation.

Simone Giannecchini
PRO

August 30, 2019
Tweet

More Decks by Simone Giannecchini

Other Decks in Technology

Transcript

  1. Standing up an OSM
    clone with GeoServer and CSS
    Ing. Andrea Aime
    GeoSolutions

    View Slide

  2. GeoSolutions

    Italian SME

    Expertise
    • Image Processing, GeoSpatial Data Fusion
    • Java, Java Enterprise, C++, Python
    • JPEG2000, JPIP, Advanced 2D visualization

    Supporting/Developing FOSS4G projects

    GeoServer, MapStore

    GeoNetwork, GeoNode, Ckan

    Clients

    Public Agencies

    Private Companies

    http://www.geo-solutions.it
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  3. What are we talking about?

    View Slide

  4. This
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  5. Or to be more precise, this
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  6. So you have OSM in your home page
    • https://maps.geo-
    solutions.it/geoserver/osm/osm/gwc/service
    /wmts?request=GetCapabilities
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  7. What's behind it?
    FOSS4G 2019, August 26th/30th, Bucharest
    { }
    GeoCSS
    Imposm3

    View Slide

  8. Motivation and history

    View Slide

  9. Several attempts on-line
    https://wiki.openstreetmap.org/wiki/OpenStr
    eetMap-in-a-Box
    https://github.com/melbsurfer/osm-
    geoserver-styles
    https://github.com/boundlessgeo/OSM/
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  10. Why start a new attempt
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  11. Because it's hard
    FOSS4G 2019, August 26th/30th, Bucharest
    "We choose to
    clone OSM, not
    because it's easy,
    but because it's
    hard"

    View Slide

  12. Going beyond the comfort zone
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  13. Timeline
    FOSS4G 2019, August 26th/30th, Bucharest
    github.com/aaime/osm
    2017

    View Slide

  14. Timeline
    FOSS4G 2019, August 26th/30th, Bucharest
    github.com/geosolutions.it/maps.geo-
    solutions.it
    2018

    View Slide

  15. Timeline
    FOSS4G 2019, August 26th/30th, Bucharest
    github.com/geosolutions.it/maps.geo-
    solutions.it
    2019

    View Slide

  16. Choosing the "right" style

    View Slide

  17. Which OSM-Bright?
    FOSS4G 2019, August 26th/30th, Bucharest
    • https://github.com/gravitystorm/openstreetm
    ap-carto

    View Slide

  18. Other options
    FOSS4G 2019, August 26th/30th, Bucharest
    • https://github.com/mapbox/osm-bright
    • https://github.com/openmaptiles/osm-
    bright-gl-style

    View Slide

  19. Side by side comparison
    FOSS4G 2019, August 26th/30th, Bucharest
    OSM MapBox
    OpenMapti
    les

    View Slide

  20. Side by side comparison
    FOSS4G 2019, August 26th/30th, Bucharest
    OSM
    OpenMaptiles

    View Slide

  21. Different objectives
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  22. Consequences
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  23. Challenges

    View Slide

  24. Approach
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  25. Issue: zoom vs scale
    FOSS4G 2019, August 26th/30th, Bucharest
    #roads-casing, #bridges, #tunnels {
    ::casing {
    [zoom >= 12] {
    [feature = 'highway_motorway'] {
    line-width: @motorway-width-z12;
    [zoom >= 13] { line-width: @motorway-width-z13; }
    [zoom >= 15] { line-width: @motorway-width-z15; }
    [zoom >= 17] { line-width: @motorway-width-z17; }
    [zoom >= 18] { line-width: @motorway-width-z18; }
    [zoom >= 19] { line-width: @motorway-width-z19; }
    [zoom >= 20] { line-width: @motorway-width-z20; }
    [link = 'yes'] {
    line-width: @motorway-link-width-z12;

    View Slide

  26. Going from zoom to scale
    FOSS4G 2019, August 26th/30th, Bucharest
    1 1:279.541.131
    1:139.770.565
    2
    1:200.000.000

    View Slide

  27. Going from zoom to scale
    FOSS4G 2019, August 26th/30th, Bucharest
    Level Scale denominator Middle cut Rounded mid cut
    0 559.082.263,95
    1 279.541.131,98 419.311.698 400.000.000
    2 139.770.565,99 209.655.849 200.000.000
    3 69.885.282,99 104.827.924 100.000.000
    4 34.942.641,50 52.413.962 50.000.000
    5 17.471.320,75 26.206.981 25.000.000
    6 8.735.660,37 13.103.491 12.500.000
    7 4.367.830,19 6.551.745 6.000.000
    8 2.183.915,09 3.275.873 3.000.000
    9 1.091.957,55 1.637.936 1.500.000
    10 545.978,77 818.968 800.000
    11 272.989,39 409.484 400.000
    12 136.494,69 204.742 200.000
    13 68.247,35 102.371 100.000
    14 34.123,67 51.186 50.000
    15 17.061,84 25.593 25.000
    16 8.530,92 12.796 12.500
    17 4.265,46 6.398 6.000
    18 2.132,73 3.199 3.000
    19 1.066,36 1.600 1.500
    20 533,18 800 800
    21 266,59 400 400
    22 133,30 200 200
    23 66,65 100 100

    View Slide

  28. Issue: the editor is too small
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  29. Solution: side by side fullscreen editor
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  30. Issue: scale dependencies verbosity
    FOSS4G 2019, August 26th/30th, Bucharest
    [@sd <= 400k] {
    [feature = 'highway_motorway'] {
    stroke-width: 5;
    [@sd < 200k] { stroke-width: 5.5; }
    [zoom < 100k] {stroke-width: 7; }
    ….

    View Slide

  31. Approach: use transform functions
    FOSS4G 2019, August 26th/30th, Bucharest
    [@sd < 400k] {
    ...
    stroke-width:
    categorize(@sd,
    9, 50k,
    7, 100k,
    5.5, 200k,
    5);
    }

    View Slide

  32. Issue: SVG icons colorized at runtime
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  33. Approach: SVGs as marks
    FOSS4G 2019, August 26th/30th, Bucharest
    [type = 'fast_food'][@sd < 6k] {
    mark: symbol('file://symbols/fast_food.svg');
    mark-size: 10;
    :mark { fill: #734a08 };
    };

    View Slide

  34. Issue: CSS translation times
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  35. First approach: profile and optimize
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  36. Going flat
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  37. Flat mode
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  38. Map is nice, but really slow
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  39. Pregeneralized for the win
    FOSS4G 2019, August 26th/30th, Bucharest

    dataSourceNameSpace="osm" version="1.0">

    baseFeatureName="osm_roads"
    featureName="roads">
    featureName="osm_roads_gen0"
    distance="200"/>
    featureName="osm_roads_gen1"
    distance="50"/>


    View Slide

  40. Give me eyes on the target!
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  41. Issues found, round one
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  42. Issues found, round two
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  43. And here we are!
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  44. That's all folks
    FOSS4G 2019, August 26th/30th, Bucharest

    View Slide

  45. That's all folks
    FOSS4G 2019, August 26th/30th, Bucharest
    Really, didn't you forget anything???

    View Slide

  46. Aaah, yeah, the styles!
    FOSS4G 2019, August 26th/30th, Bucharest
    • https://github.com/geosolutions-it/osm-
    styles

    View Slide

  47. That’s all folks! (for good this time)
    Questions?
    [email protected]

    View Slide