Skip to content

Commit

Permalink
Proof of concept of ocean from static file
Browse files Browse the repository at this point in the history
  • Loading branch information
pnorman committed Sep 15, 2016
1 parent d501ba1 commit 0084a52
Show file tree
Hide file tree
Showing 4 changed files with 223 additions and 1 deletion.
14 changes: 13 additions & 1 deletion project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ _parts:
extents84: &extents84
extent: *world
srs-name: "WGS84"
srs: "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
srs: "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +over"
osm2pgsql: &osm2pgsql
type: "postgis"
dbname: "gis"
Expand Down Expand Up @@ -101,6 +101,18 @@ Layer:
minzoom: 1
maxzoom: 3
advanced: {}
- id: "ocean-text"
name: "ocean-text"
class: ""
geometry: "linestring"
<<: *extents84
Datasource:
file: "static/ocean.geojson"
type: "geojson"
properties:
minzoom: 1
maxzoom: 8
advanced: {}
- id: "landcover-low-zoom"
name: "landcover-low-zoom"
class: ""
Expand Down
11 changes: 11 additions & 0 deletions static/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Static data

This directory is for static data that is part of OpenStreetMap Carto

## sea.geojson

Hand-placed labels for oceans and major seas. Some data is derived from OpenStreetMap `place=sea` data and other is hand-placed.

Features crossing 180 degrees need to be repeated for each the west and east side of the map.

Data is licensed under the [ODbL](http://opendatacommons.org/licenses/odbl/). Copyright Paul Norman and [OpenStreetMap contributors](http://www.openstreetmap.org/copyright).
151 changes: 151 additions & 0 deletions static/ocean.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"type": "FeatureCollection",
"features": [
{
"geometry": {
"coordinates": [-150, 0],
"type": "Point"
},
"properties": {
"maxzoom": 3,
"minzoom": 1,
"name": "Pacific\nOcean",
"size": "bigger"
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [-40, 25],
"type": "Point"
},
"properties": {
"maxzoom": 3,
"minzoom": 1,
"name": "Atlantic\nOcean"
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [75, -20],
"type": "Point"
},
"properties": {
"minzoom": 1,
"maxzoom": 4,
"name": "Indian\nOcean"
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [-180, 80],
"type": "Point"
},
"properties": {
"minzoom": 1,
"maxzoom": 2,
"name": "Arctic Ocean"
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [180, 80],
"type": "Point"
},
"properties": {
"minzoom": 1,
"maxzoom": 2,
"name": "Arctic Ocean"
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[160, 77],
[190, 75],
[220, 77]
],
"type": "LineString"
},
"properties": {
"minzoom": 2,
"maxzoom": 3,
"name": "Arctic Ocean",
"size": "big"
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[-200, 77],
[-170, 75],
[-140, 77]
],
"type": "LineString"
},
"properties": {
"minzoom": 2,
"maxzoom": 3,
"name": "Arctic Ocean",
"size": "big"
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[5, 81],
[65, 83]
],
"type": "LineString"
},
"properties": {
"minzoom": 2,
"maxzoom": 3,
"name": "Arctic Ocean"
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [-5, -60],
"type": "Point"
},
"properties": {
"maxzoom": 3,
"minzoom": 1,
"name": "Southern Ocean"
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [-160, -65],
"type": "Point"
},
"properties": {
"maxzoom": 3,
"minzoom": 2,
"name": "Southern Ocean"
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [200, -65],
"type": "Point"
},
"properties": {
"maxzoom": 3,
"minzoom": 2,
"name": "Southern Ocean"
},
"type": "Feature"
}
]
}
48 changes: 48 additions & 0 deletions water.mss
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,51 @@
}
}
}

#ocean-text {
[zoom >= 1][minzoom = 1],
[zoom >= 2][minzoom = 2],
[zoom >= 3][minzoom = 3],
[zoom >= 4][minzoom = 4],
[minzoom=null] {
[zoom < 1][maxzoom = 1],
[zoom < 2][maxzoom = 2],
[zoom < 3][maxzoom = 3],
[zoom < 4][maxzoom = 4],
[maxzoom=null] {
text-name: "[name]";
// These are all large areas, so they get labeled with larger than normal labels
text-size: 15;
[size = 'big'] {
text-size: 18;
}
[size = 'bigger'] {
text-size: 24;
}
[zoom >= 2]{
text-size: 18;
[size = 'big'] {
text-size: 24;
}
[size = 'bigger'] {
text-size: 28;
}
}
text-fill: @water-text;
text-face-name: @landcover-face-name;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-placement: interior;
['mapnik::geometry_type'=2] {
text-placement: line;
text-smooth: 1;
// Debugging code
/*
line-color: red;
line-width: 1;
line-smooth: 1;
*/
}
}
}
}

0 comments on commit 0084a52

Please sign in to comment.