Porównaj commity

...

97 Commity

Autor SHA1 Wiadomość Data
Tomas Pohanka 1ff5145451
Pre-release update. (#1657)
Update documentation before release v3.15.
2024-04-29 13:16:59 +02:00
Tomas Pohanka e6faa69a70
Fix z7-z4 roads (#1656)
Some US roads were not included in tiles, because the `ST_AsMVTGeom` did not transform geometry (result was NULL). This PR is trying to fix the geometry for `ST_AsMVTGeom`, even if the geometry is marked as valid (`ST_IsValid`). The odd geometry was caused by simplification when it could create `LINESTRING(1 1, 2 2, 1 1)` linestring, which in some cases was not converted into MVT. 

Also, for the US (on zoom 4) keeps just the network `us-interstate` and the `highway=motorway` or `osm_national_network(network)` for the rest of the world.
2024-04-24 11:47:27 +02:00
Tomas Pohanka eae7d7e1ed
Documentation update. (#1654)
- Unifying `name_de` description for `mountain_peak` layer.
- Update the version of PostGIS for `generate-sqltomvt` function.
2024-04-03 15:26:59 +02:00
Tomas Pohanka 382b12ae8a
Drop osm_transportation_name_network table before recreation. (#1653)
Drop the main table for layer `transportation_name` layer before creation.

For the first SQL import, it is OK, but for the second import (e.g. for a different country by `import-osm area=yyy`) without dropping the whole database it will keep `osm_transportation_name_network` filled with data from the first import (after first `import-sql` step)

This PR will drop the already-filled table from the first import and insert data from the reimported area.
2024-04-03 13:43:28 +02:00
Tomas Pohanka 59692656bd
Preserving the highway network in Canada for z4. (#1652)
This PR reverts important Canada TransCanada road to zoom 4.

At zoom 4, the network `gb-trunk` is too dense, so it is moved to zoom 5+.
2024-04-02 14:22:37 +02:00
Tomas Pohanka ee19519905
Add network for GBR and IRL. (#1649)
Fix a missing e-road relation for the United Kingdom and Ireland.
2024-04-02 11:08:50 +02:00
Tomas Pohanka 8266197149
Revert `e-road` and `a-road`. (#1648)
Partial revert the `e-road` and `a-road` added in https://github.com/openmaptiles/openmaptiles/pull/1619.

This PR leads to breaking the change of `network` and `ref` attributes for roads, which are not included in `osm_route_member_network_type`.
2024-04-02 10:09:20 +02:00
zstadler 3f0ba7ceba
Replace `["geometry-type"]` with `"$type"` (#1646)
Related to https://github.com/maplibre/maplibre-style-spec/pull/519 and https://github.com/maplibre/maplibre-gl-js/issues/3516

According to the Style Spec, `["geometry-type"]` is expected to distinguish between LineString and MultiLineString, while `"$type"` does not. For the transportation layer, the distinction is harmful.

All of OMT style layers, except these two, use `"$type"`.
2024-03-28 10:52:38 +01:00
Adam Laža c2ae2503c8
Fix borders z0-z4 (#1647)
This PR fixes two things:
- remove disputed name like `ne_*m_ogc_fid` from lines
- use South Sudan disputed boundary from `ne_10m_admin_0_boundary_lines_land_disputed` so there is no gap.
2024-03-27 13:56:23 +01:00
Tomas Pohanka d709a51de6
Salt pond with class `pond` (#1645)
The salt pond is now under the class `lake`, this PR moves it into class `pond`.
2024-03-21 15:58:58 +01:00
Brian Sperlongano af6dc684ef
Reduce transportation_name segmentation (#1643)
This PR reduces transportation_name layer fragmentation by ensuring the short brunnel segments are merged rather than dropped from view.

---------

Co-authored-by: Tomas Pohanka <TomPohys@gmail.com>
2024-03-21 08:08:56 +01:00
Adam Laža 136e1db4d1
Fix maritime low zooms (#1644)
This PR fixes boundary layer at low zoom levels:

-z4 - remove maritime boundary (Peru, northern and southern end of boundary between Canada and Alaska).
-z1-z4 - do not mix disputed boundary from NE and OSM - linestrings got duplicated. Use only NE data (z0-z4), then OSM data (z5+)
2024-03-18 13:23:38 +01:00
Tomas Pohanka 585b71f666
More roads for z4 and z5. (#1642)
This PR adds more roads to the zoom 4 for the United Kingdom and Ireland. Adding more roads for the USA at zoom 5.
2024-03-13 10:12:03 +01:00
Brian Sperlongano d6fd5ef7cb
Change to pointonsurface (#1641)
Fixes #1640 

This ensures that place and poi points computed from areas result in a point node that is actually inside the area that it's derived from.  Unusual shaped areas (like a banana shape, for example) may produce points that aren't actually contained.
2024-02-29 14:39:13 +01:00
Andrea Mennillo 9f891b625a
Replace spritezero with spreet (#1631)
This updates `build-sprite` and `build-style` to use `spreet`.

It depends on https://github.com/openmaptiles/openmaptiles-tools/pull/442
2024-02-26 15:06:12 +01:00
Tomas Pohanka 5b00c496ef
New omt-tools version. (#1638) 2024-02-26 14:05:42 +01:00
Adam Laža a65495f264
Fix housenumber_display.sql - cast to bigint instead of integer. (#1637)
Fixes `housenumber_display.sql` function and further improves https://github.com/openmaptiles/openmaptiles/pull/1632

Parsing text values that contain `;`, the string was split into array of values which were casted to `integer`. However, that fails for housenumber that exceed Postgres `int` range `-2147483648` to `+2147483647`.
There are such housenumber, e.g.: https://www.openstreetmap.org/way/1091331906#map=19/-3.82721/-38.59269
2024-02-26 13:04:00 +01:00
Andrea Mennillo 2f170fbbd8
Improve poi shop style (#1634)
The main goal is to improve consistency and reduce the number of poi without an icon.

- Remove music from poi cultural, music has only two subclasses music and musical_instrument, both are styled as poi shop
- Remove arts_centre from poi shop, it's already styled as poi cultural
- Remove chocolate icon, chocolate uses confectionery icon (see: https://github.com/openmaptiles/openmaptiles/pull/1628)
- Remove references to ice_cream class from poi shop
- Add missing gallery icon and move it to poi cultural (see: https://wiki.openstreetmap.org/wiki/Tag:tourism%3Dgallery)
- Use the icons alcohol, newsagent, perfumery, trade respectively for wine, kiosk, perfume and wholesale.
- Add a generic fallback icon for shops
2024-02-21 16:25:54 +01:00
Tomas Pohanka de2fa04c37
Docs clean up. (#1636)
Update docs, license year and clean up `.env`.
2024-02-21 13:40:46 +01:00
Tomas Pohanka 44cf6c8e35
Default output filename as `tiles.mbtiles` (#1633)
Keep the default output filename as `tiles.mbtiles`. `tiles.mbtiles` is expected to start TileServer.

Using the `area` as the name causes TileServer not to run. The name could be changed by the user by
 - change `MBTILES_FILE` in `.env`
 - use MBTILES_FILE as an environmental variable before running `quickstart.sh` or `generate-tiles-pg` 

Co-authored-by: Adam Laza <@lazaa32>
2024-02-21 11:52:29 +01:00
Tomas Pohanka b057d5941e
Update GitHub Actions. (#1635)
Bump GitHub Actions from v2 to v4.
2024-02-21 09:08:16 +01:00
Brian Sperlongano b3c32321a3
[WIP] Expanded road route attributes (#1620)
This PR replaces the `route_N` attribute scheme with individual attributes for name and colour on routes.  Thus you will have:
* `route_N_network` to hold the route `network` value
* `route_N_ref` to hold the route `ref` value
* `route_N_name` to hold the route `name` value
* `route_N_colour` to hold the route `colour` or `ref:colour` value
2024-02-20 17:38:11 +01:00
Andrea Mennillo ee8259ced5
style: use red color for volcano (#1630)
Change the color used for a volcano label and icon to #d40000.
2024-02-20 08:56:29 +01:00
Tomas Pohanka 718fd359d3
House number range fix. (#1632)
Fix house number range conversion based on https://github.com/openmaptiles/openmaptiles/issues/1583#issuecomment-1940901006.
2024-02-19 21:27:52 +01:00
Michał Gwóźdź 8d6b95008d
Changed classification of ice_cream and chocolate (#1628)
According to [OpenMapTiles Schema](https://openmaptiles.org/schema/) ice_cream should be a class, not a subclass of the shop, so I think it makes more sense to remove ice_cream from the shop class. I tested this, and after the change, both amenity=ice_cream and shop=ice_cream OSM tags get class=ice_cream + subclass=ice_cream, which is fine, because both OSM tags shop=ice_cream and amenity=ice_cream represents the same thing

The next thing I did was to change the color of the ice_cream icon.
2024-02-19 08:19:15 +01:00
Michał Gwóźdź aa51a6c101
Moved confectionery from ice_cream class to shop (#1627)
Moved confectionery from ice_cream class to shop.
2024-01-31 17:16:11 +01:00
Makien Osman d54ce2e617
🐛 remove duplicate "requires" key (#1626)
Remove duplicate "requires" key from `place.yaml`
2024-01-31 07:38:04 +01:00
Brian Sperlongano 5fd186a311
Add missing NULLIF (#1625)
In some cases that empty aggregated brunnel attributes was coming through in the tiles in the transportation_name layer.
2024-01-30 09:25:58 +01:00
Tomas Pohanka 6d1cb63d8e
Add e-road and a-road for transportation z4. (#1619)
Adding [e-road](https://wiki.openstreetmap.org/wiki/WikiProject_Europe/E-road_network) and [AsianHighway](https://wiki.openstreetmap.org/wiki/Asia/Asian_Highway_Network) (as `a-road`) as part of the network to show up from zoom 4.
2024-01-30 07:31:12 +01:00
Peter Hanecak fe61912c09
Make sure areas above 160000000 get rank 2 or 1 (#1623)
This is a follow-up on https://github.com/openmaptiles/openmaptiles/pull/1604 . Seminole Nation is shown in the screenshot there with rank 3 while based on area it should be 1. This PR fixes `area_rank()` function to handle areas greater than 160000000, e.g. this fixes #1622 .

Co-authored-by: Paul Norman <penorman@mac.com>
2024-01-29 07:51:24 +01:00
Peter Hanecak bb154f4ee8
fix for problem with "James Bay" in water_name (water label) #1595 (#1621)
For important marine points distance between NE and OSM with the same name must by under 50km.
2024-01-25 16:01:39 +01:00
Brian Sperlongano e29827d76c
Move aboriginal lands boundaries to boundary layer (#1604)
This PR adds indigenous lands to the `boundary` layer by adding new area features for these objects, along with generalization up to z4. It borrows heavily from the technical processing chain of the `park` layer.

I added new `class`, `name`, and `name:xx` attributes to the boundary layer, in order to support the new area features. Should we (or someone extending this schema) come up with new objects to place in the boundary layer in the future, `class` would support additional categories.
2024-01-21 10:37:02 +01:00
Tomas Pohanka eb7f6be455
Adding source_ids column if not exists. (#1600)
Adding source_ids column if not exist in the table 
 - osm_transportation_merge_linestring_gen_z11
 - osm_transportation_merge_linestring_gen_z8
 - osm_transportation_name_linestring
 - osm_important_waterway_linestring
2024-01-16 14:03:46 +01:00
Brian Sperlongano a682d50d0d
Document name_* deprecation strategy (#1605)
This PR is a **documentation change only**. It documents the fact that `name:xx` values are present in the tiles and documents that `name_de` and `name_en` will be removed in a future release in favor of `name:de` and `name:en` respectively.
2023-12-30 08:14:35 +01:00
Brian Sperlongano d3a9b36873
Fix university office/amenity collision (#1607)
Fixes #1606
Unblocks ZeLonewolf/openstreetmap-americana#1022

This PR is a bugfix which ensures that `amenity=university` is encoded as `class=college` rather than `class=office`.  It's required because of a subclass collision for `university`, which exists under both class values.
2023-12-28 08:18:00 +01:00
Brian Sperlongano b9c9e69028
Remove expressway from ramps (#1602)
#1313 added `expressway` tagging to the transportation layer. However, this also added the `expressway` attributes to ramps where it doesn't make sense (ramps by definition are controlled-access roads in all cases).  This PR corrects this by dropping the `expressway` attribute from ramps where it doesn't make sense to do so.

See also ZeLonewolf/openstreetmap-americana#1017
2023-12-28 07:11:36 +01:00
Christopher Beddow e61442c49d
feat: add charging station to car POIs (#1544)
Adding charging station to class `fuel`.

Co-authored-by: Christopher Beddow <cbeddow>
Co-authored-by: Tomas Pohanka <TomPohys@gmail.com>
2023-12-12 13:58:03 +01:00
Martin Fischer 3cf77e2a54
Introduce `office` POI class (#1423)
Omitted values include:

* office=yes ... too generic
* office=vacant ... not really a POI
* deprecated values (like office=administrative)
* tags that don't have a clear meaning (like office=camping,
  office=healthcare, office=transport, office=design)
* tags where another tag is used more often, e.g:
  office=religion is used more often than office=parish
  office=construction_company is used more often than office=construction
  office=engineer is used more often than office=engineering

---------

Co-authored-by: Tomas Pohanka <TomPohys@gmail.com>
2023-12-01 17:43:58 +01:00
Brian Sperlongano 6c31841f46
Remove oneway from shipway/rail (#1591)
This PR removes the `oneway` attribute from ferry lines and rail lines.  These attributes don't really make sense for these feature classes and they are not typically rendered in general-purpose maps.
2023-11-09 16:56:28 +01:00
Zhongxiang Wang dfd20c647c
Fix unexpected error brought by typo: tigger -> trigger & fix `trigger_flag` was created on a wrong target (#1584)
1) The trigger name has a typo of `trigger`, which is incorrectly spelled as `tigger` and doesn't match the following create command: `CREATE TRIGGER trigger_flag`. This may result in an error when invoking `make import-sql`.

```
ERROR:  trigger "trigger_flag" for relation "osm_park_polygon_gen_z4" already exists
xargs: sh: exited with status 255; aborting
```

2) The `trigger_flag` may be created on the wrong target in line [#251](https://github.com/plainheart/openmaptiles/blob/master/layers/park/update_park_polygon.sql#L251).
2023-09-27 12:08:33 +02:00
Michał Gwóźdź febd1abbd2
Update README.md (#1581)
This workshop is extremely helpful in understanding how OpenMapTiles works, especially in creating new layers, which is not properly documented (or I just couldn't find any documentation).
2023-09-21 08:06:29 +02:00
Brian Sperlongano 9de3ff3921
Restore missing route zooms (#1579)
This PR restores missing transportation_name features that are missing from zoom 11 and improves the mechanism by which transportation_name features are merged through lower zooms. This prevents route features from being dropped due to bridge interleaving (when a bridge interrupts an otherwise continuous route).

This fix moves the length check to a later stage of processing and merges bridges/tunnels if they're too small.  This is similar to the work done in the transportation layer to merge bridges that are too small to render lines.  In this layer, bridges are merged when they're too small to justify a separate label.
2023-09-14 15:55:01 +02:00
Brian Sperlongano a7a50d84bc
Convert semi-colon separated house numbers to a range (#1562)
This PR collapses housenumber values into the form min(housenumber)-max(housenumber) for cases where housenumber is a semi-colon separated list. If the list is all numbers, the bounds are the smallest and largest numbers.  If the list includes non-numeric characters, it falls back to the first and last values in the list.
2023-09-13 11:09:41 +02:00
Brian Sperlongano 48a2b1af72
Convert PL/PGSQL to SQL (#1568)
This PR converts three plpgsql functions in the `transportation_name` layer to sql functions, which perform better.
2023-08-06 07:26:24 +02:00
Peter Hanecak 0ca096938e
Fix for classification of CA:ON:primary (#1564)
This PR changes classification of `CA:ON:primary`: "all else" should be `ca-provincial`.
2023-07-11 07:28:20 +02:00
benedikt-brandtner-bikemap a8e6573ba8
boundary.sql parallelization issue fix (#1551)
VectorTiles generated via the [openmaptiles-tools](https://github.com/openmaptiles/openmaptiles-tools) toolchain and using the OpenMaptiles-SQL-Layers as the query-source result in tiles which can contain duplicated keys.

This is because PostGIS `ST_AsMVT` is used to generate the Tiles and due to the way they [implemented parallelization](https://trac.osgeo.org/postgis/ticket/4310).

Although it is not prohibited by the Mapbox-Vector-Tile-Specification MapBox as well as MapLibre depending on version either throw a lot of warnings or even crash when encountering tiles with duplicated keys.
https://github.com/mapbox/vector-tile/issues/55
https://github.com/maplibre/maplibre-native/issues/795

After investigating I identified the boundary layer in zoom-leves 1 - 4 as the only layers containing duplicated keys.
2023-07-10 11:50:31 +02:00
Tomas Pohanka 103e37bd2c
Update readme links. (#1560)
Update links to Slack and lake lines.

Fix #1559
2023-07-05 13:03:42 +02:00
Andrea Mennillo a548093e08
transportation style: remove whitespace in color value (#1550)
Trivial fix for style validation failure with maplibre@3.0.1
2023-06-19 19:20:40 +02:00
benedikt-brandtner-bikemap 66731f3544
LineString Merging Updates (#1538)
This PR addresses two main issues introduced by the new ID-Based Merged-LineString Updates

1. Partial Indexes can only be accessed when the query matches more or less exactly and the query-planner will fail to use indexes when targeted via the join-condition and not the where-condition
    - `osm_transportation_merge_linestring_gen_z9`
    - `osm_transportation_name_network`
    - `osm_shipway_linestring`
    - `osm_aerialway_linestring`
    - `osm_waterway_linestring`
2. When intersecting updated Source-LineStrings with the existing Merged-LineStrings we join the Source-IDs of each existing Merged-LineString. This bloats the table unnecessarily and slows down bigger updates considerably.
    - This is addressed by aggregating the Source-IDs of each existing Merged-LineString into an array and concatinating these arrays when grouping them. Afterwards we add the IDs of updated SourceLineStrings and deduplicate the result before adding it to the Source-IDs-Table.
2023-06-19 10:12:57 +02:00
benedikt-brandtner-bikemap d8a264cd0c
remove leakproof attribute from functions; (#1535)
LEAKPROOF requires the executing user to have superuser privileges when creating the functions which would be the only statement required to be executed as a superuser.
2023-06-14 11:31:12 +02:00
benedikt-brandtner-bikemap d0d87e52d5
fixed analyzing of changes table in refresh_[shipway/aerialway]_linestring (#1536)
Fixes a typo analyzing the `name_changes` table during execution of `transportation_name.refresh_shipway_linestring` and `transportation_name.refresh_aerialway_linestring`
2023-06-13 18:13:17 +02:00
Christopher Beddow 80bc6518ab
Paint (#1435)
Paint shop is missing from the schema, so shops of this type do not appear on the map beside other POIs
---------

Co-authored-by: Tomas Pohanka <TomPohys@gmail.com>
2023-05-16 14:19:29 +02:00
Yaser Kalali 692b0a7afe
Fix issues in compose and quickstart.sh (#1530)
* Chore(quickstart.sh):

Handle spaces in fonts name when calculating their md5 digest

* Chore(Makefile):

Change docker pull to docker-compose pull to read image from compose file
2023-05-15 12:36:15 +02:00
Brian Sperlongano aea2b734da
Update park layer description to include indigenous lands addition (#1526)
This PR updates the park layer description to reflect #1489 and clarify why we chose to place them in this layer (technology reasons).
2023-05-10 10:25:31 +02:00
William Edmisten 5153dffe4a
Use area name for mbtiles in quickstart.sh (#1523)
Some parts of quickstart.sh reference `${area}.mbtiles`, but the file that gets created with the default `.env` is `tiles.mbtiles`. We should either reference `$MBTILES_FILE` instead, or override the filename with `${area}.mbtiles` (which is the approach taken by this PR).
2023-05-10 09:33:44 +02:00
Brian Sperlongano 9969c5c741
Remove unused indexes (#1520)
Based on analysis from planet builds for this layer as well as running updates via the integrity script as discussed in #1516, these three indexes are not used and can be removed.
2023-05-10 07:39:45 +02:00
benedikt-brandtner-bikemap 91dd853a89
Transportation_route_member_coalesced constraint errors
Multi-Column Primary-Keys (Unique-Constraints) must not contain NULL values in postgres up until version 15.

This PR coalesces NULL to empty strings for the primary columns during `transportation_route_member_coalesced` updates and import.

Additionally adds the missing `concurrency_index` to UPSERT statement of `transportation_route_member_coalesced`
2023-04-26 22:19:34 +02:00
Brian Sperlongano b3d67ed5b3
Add aboriginal lands (#1489)
This PR adds support for `boundary=aboriginal_lands` by adding it to the `park` layer. While these lands are certainly not "parks", they have similar treatment from a technology perspective and can benefit from the existing processing chain established in that layer. I set all of these objects to `class=aboriginal_lands` in the tiles, including at the lowest zoom in order to separate it from the protected area merging implemented in #1160. In order to distinguish these from general parks, I expose the `class` attribute for these objects at z4 and also ensure that the z4 generalization is performed separately for protected areas versus aboriginal lands.

This unblocks #ZeLonewolf/openstreetmap-americana#105, which describes why having indigenous land boundaries is an important general feature on the map. This is also consistent with my suggested implementation in https://github.com/openmaptiles/openmaptiles/issues/1296#issuecomment-967749403.
2023-04-04 13:20:41 +02:00
Brian Sperlongano 6f2b39e657
Fix index typo (#1522)
This PR fixes a copy/paste error which caused the z2 boundary layer index to be created twice and the z1 index to not be created at all.
2023-03-28 10:33:18 +02:00
benedikt-brandtner-bikemap f3dbb0a839
Refresh osm_park_polygon_dissolve_z4 materialized view after update in update_park_polygon.sql (#1515)
Refresh osm_park_polygon_dissolve_z4 materialized view after update in update_park_polygon.sql.
2023-03-23 13:30:23 +01:00
benedikt-brandtner-bikemap 54e24207a1
Improved update performance of waterway layer (#1514)
Improved update performance of waterway layer
- Refactored LineString-merging and diff updates in update_important_waterway.sql
2023-03-23 08:05:15 +01:00
benedikt-brandtner-bikemap d937705292
Update Performance water_name Layer (#1513)
Improved update performance of water_name layer
- Implemented diff updates for update_water_lakeline.sql and update_water_point.sql
- Unified update_water_lakeline.sql and update_water_point.sql to update_water_name.sql
- Refactored IDs to be unique in water_name_marine.osm_ids
- Restricted updates to INSERT and UPDATE operations during water_name_marine.refresh
- Added analyze statements before update queries during water_name_marine.refresh
2023-03-22 21:28:21 +01:00
benedikt-brandtner-bikemap b2a57b3755
Update Performance transportation_name Layer (#1512)
Improved update performance of transportation_name layer
- Refactored LineString-merging and diff updates in update_transportation_name.sql
- Refactored transportation_route_member_coalesced materialized view to table
- Added analyze statements before update queries during transportation_name.refresh_network and update_osm_route_member
2023-03-22 19:39:18 +01:00
benedikt-brandtner-bikemap 8321574565
Improved update performance of transportation layer (#1511)
Improved update performance of transportation layer
- Refactored LineString-merging and diff updates in update_transportation_merge.sql
2023-03-22 16:48:27 +01:00
benedikt-brandtner-bikemap 0e8e2512e8
Update Performance poi Layer (#1510)
Improved update performance of poi layer
- Refactored update_poi_point.sql to partial diff update
- Refactored IDs to be unique in poi_polygon.osm_ids
- Restricted updates to INSERT and UPDATE operations during poi_polygon.refresh
- Added analyze statements before update queries during poi_polygon.refresh
2023-03-22 15:07:10 +01:00
benedikt-brandtner-bikemap 3caa11aee9
Improved update performance of place layer (#1509)
Improved update performance of place layer
- Refactored IDs to be unique in the following tables
  - place_city.osm_ids
  - place_continent_point.osm_ids
  - place_country.osm_ids
  - place_island_point.osm_ids
  - place_island_polygon.osm_ids
  - place_state.osm_ids
- Added analyze statements before update queries and restricted updates to INSERT and UPDATE operations during execution of the following functions
  - place_city.refresh
  - place_continent_point.refresh
  - place_country.refresh
  - place_island_point.refresh
  - place_island_polygon.refresh
  - place_state.refresh
2023-03-22 14:00:10 +01:00
benedikt-brandtner-bikemap 1126e30d0d
Improved update performance of mountain_peak layer (#1508)
Improved update performance of mountain_peak layer
- Refactored IDs to be unique in mountain_linestring.osm_ids and mountain_peak_point.osm_ids
- Restricted updates to INSERT and UPDATE operations during mountain_linestring.refresh and mountain_peak_point.refresh
- Added analyze statements before update queries during mountain_linestring.refresh and mountain_peak_point.refresh
2023-03-22 12:13:05 +01:00
benedikt-brandtner-bikemap d97d86320b
Do not raise errors with diagnostics code after local test in order to let executors of the script propagate the appropriate status-code (#1519)
Propagate the appropriate status-code during failed unit-test runs. (eg.: CI-Runs)
2023-03-22 07:56:34 +01:00
benedikt-brandtner-bikemap 7bdf1ae409
Improved update performance of housenumber layer (#1507)
Improved update performance of housenumber layer
- Refactored IDs to be unique in housenumber.osm_ids
- Restricted updates to INSERT and UPDATE operations during housenumber.refresh
- Added analyze statements before update queries during housenumber.refresh
2023-03-21 20:24:47 +01:00
benedikt-brandtner-bikemap d8a8c81f79
Improved update performance of aerodrome_label layer (#1506)
Improved update performance of aerodrome_label layer
- Refactored IDs to be unique in aerodrome_label.osm_ids
- Restricted updates to INSERT and UPDATE operations during aerodrome_label.refresh
- Added analyze statements before update queries during aerodrome_label.refresh

See #1433 for more detailed discussion.
2023-03-21 18:09:32 +01:00
benedikt-brandtner-bikemap f918f4d607
Local Test Fixes (#1505)
This PR fixes local tests affected by the changes introduced in #1440 #1444 #1361 #1501
2023-03-21 11:33:50 +01:00
Brian Sperlongano 81d29fff2b
Add convenience script to run the integrity test locally (#1495)
This PR adds a script that allows a developer to run the "integrity" CI script without actually creating a PR.
2023-03-17 07:53:21 +01:00
William Edmisten 02dcc41e1f
Support new docker compose version (#1497)
Currently the Makefile and `quickstart.sh` expect the [deprecated docker compose V1](https://docs.docker.com/compose/#compose-v2-and-the-new-docker-compose-command) syntax, `docker-compose`.
The new V2 syntax uses `docker compose` instead.
2023-03-15 22:16:00 +01:00
Brian Sperlongano e5a5acfa99
Render long-distance ferries at longer zooms (#1486)
In some areas of the world, ship transportation is the main means of long-distance travel.  For example, in Alaska, the [Alaska Marine Highway System](https://dot.alaska.gov/amhs/route.shtml) is the principal means of transportation through the Alaska Panhandle and down the Aleutian island chain.  The AMHS carries the same importance that the Interstate Highway System has on land, and these ferry routes are exceptionally long distance.
2023-03-15 16:55:47 +01:00
Brian Sperlongano d8c367f42c
Remove bridge/tunnel attributes from tiny bridges (#1283)
This PR now removes bridge/tunnel/ford attributes from the `transportation` layer from sections of bridge/tunnel etc that are too small to be meaningfully visible at a particular zoom level.  This allows those segments to be generalized into geometries along with the surrounding sections of road, thereby dropping lots of useless little pieces of geometry in lower-zoom tiles.
2023-03-15 13:22:08 +01:00
Brian Sperlongano 0c6dd1fecb
Update Slack link (#1494)
This PR updates the link to Slack in the contributor's guide.
2023-03-06 19:14:01 +01:00
Brian Sperlongano b7edcf6153
Convert osm_route_member unique index to trigger (#1501)
This PR changes the three-column unique index to an on-insert trigger. This should fix the issues we're having with CI failures and still achieve the behavior of coalescing duplicate routes. 

I moved the concurrency_index calculation into an intermediate materialized view to separate the de-duplication capability from both DENSE_RANK() and from imposm updates.
2023-03-06 17:10:30 +01:00
Tomas Pohanka 624cf7a8a3
Minor docs enhancement. (#1481)
Update docs, links, and comments.
2023-01-30 14:04:47 +01:00
Brian Sperlongano 5e9b7c475d
Add grade 1 tracks to paved (#1485)
This PR sets `surface=paved` for `highway=track` + `tracktype=grade1` if no other value of `surface` is set.  Roads tagged in this way are [generally paved](https://wiki.openstreetmap.org/wiki/Key:tracktype) and therefore encoding them as a paved road is appropriate.
2023-01-26 19:24:44 +01:00
Tomas Pohanka d2c69b0d45
Fix stops aggregation in osm_poi_point. (#1480)
This PR fixing the stops aggregations which now returns always `NULL` and wasn't reflected in the tiles.
2023-01-26 17:57:31 +01:00
Brian Sperlongano bc9bbd2e67
Coalesce duplicate route concurrencies (#1361)
# Problem description
#1128 introduced route relation concurrency information in OpenMapTiles via the `route_X` attributes.  The original implementation assumed that there would be a single route relation for each `network` and `ref` pair.  However, it is increasingly common practice to tag a separate route relation for each direction of a route in order to provide awareness to routers and other data consumers of the directionality of a route.  This standard and growing practice is described on the [OSM wiki page on route directions](https://wiki.openstreetmap.org/wiki/Route_directions).  Thus, the naïve implementation of #1128 caused duplicate entries to be added as `route_X` attributes in the case where separate route relations were used for directional routes.

# Solution description
This PR adds grouping when computing route concurrency information, such that duplicate entries are coalesced in a predictable way.  Since this grouping is done only within a route membership join of a single member way, the computational complexity should be trivial.
2023-01-26 16:15:47 +01:00
Brian Sperlongano efa6b27fba
Render POIs for large universities at low zoom (#1479)
This PR adapts the code used in #1457 to allow POIs to render up to z10 for very large features. I set the threshold at a very conservative value of 10% of a tile. Thus, it will render if an area POI covers at least 10% of a tile at a given zoom. Only for 'university' and  'college'.

Additionally, this consolidates a double UNION ALL on the same table with a WHERE/CASE combination, which is simpler.
2023-01-19 19:29:29 +01:00
Brian Sperlongano f9e358c962
Add substantial missing languages in the US (#1477)
This PR adds eight missing languages, all of which are among the top 25 languages spoken in the United States, as discussed in ZeLonewolf/openstreetmap-americana#586, and have at least 10,000 `name:xx` usages in the database. Additionally, most of these languages are the primary or national language in the countries where they are most commonly spoken.
2023-01-17 10:38:31 +01:00
ttomasz 3b4650fca1
Tile duplicate housenumber filtering (#1391)
This PR introduces simple filtering of duplicate housenumbers.

Simple means that filtering is done withing the tile.
Duplicates are defined as same housenumber, street, block_number[1].

Duplicates are usually caused by POIs. People like to add addresses to them. Most POIs have names so to prioritize addresses we pick features without names first.

Formula is: `row_number() OVER(PARTITION BY concat(street, block_number, housenumber) ORDER BY has_name ASC) == 1`
2023-01-17 09:34:27 +01:00
Brian Sperlongano 168e8300c0
Allow lakelines at native sizes (#1475)
This PR reduces the minimum lake line zoom to z3, allowing the largest lakes to show a renderable label. The lakeline function is restricted by the LineLabel() function, which limits lakelines to only those that are big enough to render a text label.  Therefore, further restricting lakelines by zoom is not necessary.
2023-01-16 11:33:43 +01:00
Brian Sperlongano edb42f2db3
Routes of Ireland (#1466)
This PR follows #1465 to implement pseudo-route relations for Republic of Ireland road routes as described in the [OSM wiki](https://wiki.openstreetmap.org/wiki/Ireland/Roads). Irish road routes work in the same way as UK road routes in that signage is derived from highway classification on a 1:1 basis. The scheme described in the OSM wiki is confirmed via [overpass query](https://overpass-turbo.eu/s/1por).

This feature follows the implementation currently used for UK road routes, in which a 10m Natural Earth polygon is used to determine which roads are located within Ireland to apply this processing.

This PR implements 3 classes of routes:
* M-roads, which are `highway=motorway` and signed with blue/white lettering.
* N-roads ("national roads"), which are `highway=trunk` or `highway=primary` and are signed with green/yellow lettering.
* R- and L-roads ("regional and local roads"), which are `highway=secondary`, `highway=tertiary` or `highway=unclassified`, and signed with white/black lettering
2023-01-15 13:52:43 +01:00
Brian Sperlongano 8b5aa3273e
Add other river-like water area features to class=river (#1467)
Currently, river areas (`natural=water` + `water=river`) are rendered in the tiles as `class=river`.  However, canal, stream, ditch, and drain water areas are rendered as `class=lake`.  Since these types of objects are all flowing water, they should be grouped together into `class=river`, which allows for styles that render flowing water differently to do so on a consistent basis.
2023-01-14 13:36:02 +01:00
James Westman 569e9cd5b4
Add borough to supported place classes (#1470)
Adds a new class value for the place layer, `borough`, and adds it to the OSM style with the same appearance as hamlets and suburbs.
2023-01-10 16:36:08 +01:00
Brian Sperlongano 5f7b2c11b3
Add GB primary/secondary routes (#1465)
This PR adds an additional pseudo-network for UK non-primary [routes](https://en.wikipedia.org/wiki/Great_Britain_road_numbering_scheme), which are signed with black on white signage with "A" and "B" prefixes. This scheme is described on the [OSM wiki](https://wiki.openstreetmap.org/wiki/Roads_in_the_United_Kingdom). Adding this third psuedo network is needed for generating shields for UK white/black signage for non-primary routes. 
Additionally, this fixes a minor bug under which single-digit refs would have been included.  Single-digit refs don't exist in the UK, because the numbering scheme is always prefixed by a letter, e.g. "A4".

I also included documentation updates and fixed the typo where a view was named "bg" instead of "gb".
2023-01-10 14:50:24 +01:00
Brian Sperlongano af8c6883dd
Revamp water label display logic (#1457)
* At zooms 9-13, water labels will now be rendered for water features that are at least 0.25 tiles in size.  This means that water features that are the same size as a 128x128 pixel square will get a point label.
* Labels for large water features are now shown at the lowest zoom at which it's appropriate to show a label.
* Bay and strait names (`natural=bay` and `natural=strait`) are included. 
* Large seas modeled as areas (e.g. Caspian Sea) render as `class=sea` rather than `class=lake`
2023-01-10 13:39:54 +01:00
Daniel Schep cd77b07e46
improve `class=path` styling (#1450)
This PR addresses that by:

* rendering oneway arrows on more than `subclass=cycleway`
* less opacity for path/footway casing
* adding the thin black casing to bridges
* adding `subclass=steps` & `subclass=bridleway` rendering
* render `bicycle=designated` as `subclass=cycleway` and `horse=designated` as `subclass=bridleway` (bike taking priority)
* improved tunnel rendering with double casing & adding main line
* made casing min zoom consistent across subclasses

All of these changes were made to mimic OSM Carto.
2023-01-06 10:08:03 +01:00
Brian Sperlongano 4d5fa84184
Add class=pond to the water layer (#1456)
This PR proposes to add a new class, "pond" to the water layer, which allows for a style to de-emphasize minor bodies of water (tagged `water=pond,basin,wastewater`) when compared to more significant objects tagged reservoir/lake.  This PR retains the default behavior of classifying a water body as a "lake" if more specific tagging is not added.
2023-01-06 08:44:11 +01:00
Brian Sperlongano 29e49f9424
Sub-national routes in Canada and refactor national network list (#1446)
This PR defines the set of routes in Canada which are equivalent in national importance to the US Interstate Highway System, and are therefore appropriate to render at zoom 4. This creates a sane, connected highway network at this zoom level across the USA and Canada.

This adds two additional network types for Canadian highways, ca-provincial for provincial-level roads, and ca-provincial-arterial for "highest importance" roads that are not part of the Trans-Canada highway but should be regarded as equivalent for low-zoom rendering purposes.

Additionally, this extracts out the country-specific network checks to a separate function in order to define "equivalent top-level networks" by country, providing a place to add additional national definitions as they're added by contributors.
2023-01-05 17:36:36 +01:00
Brian Sperlongano c4d86d44a6
Fix zoom ordering (#1444)
This PR improves the behavior introduced in #1440, which inadvertently included all motorways at z4, which was unintended.  Instead, this PR provides an appropriate progression from z4 to z5 with the highest national-importance highways being rendered at z4 (including where they degrade to trunk, as in Canada), and all motorways being added to the mix at z5.
2022-11-28 19:19:29 +01:00
Adam Laža aa9c39ba3b
Add `build-style` and `download-fonts` targets. (#1445)
This PR adds `build-style` and `download-fonts` targets to `start-tileserver` target. 

Calling `build-style` and `download-fonts` ensures that there is the OSM OpenMapTiles style build and ready and fonts downloaded.
2022-11-28 15:56:00 +01:00
Brian Sperlongano ca4a64ba72
Add transcanada highway to z4 (#1440)
This adds support to show the Trans-Canada Highway at zoom 4.  Despite being the most important highway network in Canada, portions are `highway=trunk` due to the remoteness of the countryside.  However, it's still important to show a connected highway network at the lowest zoom without showing all trunk roads at this zoom.

This change also adds support for US Interstate Highways to be drawn at z4 when they're tagged as trunks.  There's only a few examples of this, but it removes those (tiny) gaps from the generalized road geometries. As we identify additional countries which should have their most important road network rendered at the lowest road zoom even if they're trunk, we can add them to the list of networks that get this treatment.
2022-11-15 17:33:29 +01:00
Thomas Helmrich 567939b5ce
added information about how to prevent a possible error during 'generate-tiles-pg' (#1432)
Added a comment within docker-compose.yml to prevent an error during `make generate-tiles-pg`
2022-10-20 11:11:44 +02:00
106 zmienionych plików z 6130 dodań i 2254 usunięć

12
.env
Wyświetl plik

@ -4,7 +4,7 @@
TILESET_FILE=openmaptiles.yaml
# Use 3-part patch version to ignore patch updates, e.g. 7.0.0
TOOLS_VERSION=7.0
TOOLS_VERSION=7.1
# Make sure these values are in sync with the ones in .env-postgres file
PGDATABASE=openmaptiles
@ -29,21 +29,13 @@ MAX_ZOOM=7
# Use true (case sensitive) to allow data updates
DIFF_MODE=false
# Some area data like openstreetmap.fr can contain invalid references
# that must be cleaned up before using it for borders -- set it to true.
BORDERS_CLEANUP=false
# The current setup assumes this file is placed inside the data/ dir
MBTILES_FILE=tiles.mbtiles
# This is the current repl_config.json location, pre-configured in the tools Dockerfile
# Makefile and quickstart replace it with the dynamically generated one, but we keep it here in case some other method is used to run.
IMPOSM_CONFIG_FILE=/usr/src/app/config/repl_config.json
# import-borders temp files - set them here to defaults, and override in the Makefile based on the area
BORDERS_CLEANUP_FILE=data/borders/cleanup.pbf
BORDERS_PBF_FILE=data/borders/filtered.pbf
BORDERS_CSV_FILE=data/borders/lines.csv
# Number of parallel processes to use when importing sql files
MAX_PARALLEL_PSQL=5

Wyświetl plik

@ -15,7 +15,7 @@ jobs:
steps:
- name: Checkout the changes
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Run quickstart for a small area
env:
@ -27,7 +27,7 @@ jobs:
./quickstart.sh $area
- name: Save quickstart.log
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: quickstart.log
path: quickstart.log

Wyświetl plik

@ -45,7 +45,7 @@ jobs:
- name: Cache test data download
id: cache-testdata
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ci_cache
key: "v2-${{ env.TEST_DATA_URL }}"
@ -58,7 +58,7 @@ jobs:
curl --silent --show-error --location --output ci_cache/perf-test-areas-latest.osm.pbf "$TEST_DATA_URL"
- name: Get code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
# Fetch the last two commits in case this is a PR,
# and we need to profile the base branch first
@ -76,10 +76,10 @@ jobs:
# Take the first parent of the grafted commit (cannot use HEAD^1 with shallow clones)
REV_HASH=$(git cat-file -p $REV_HASH | awk 'NR > 1 {if(/^parent/){print $2; exit}}')
fi
echo "::set-output name=hash::$REV_HASH"
echo "hash=$REV_HASH" >> $GITHUB_OUTPUT
- name: Set up caching for the performance results
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: perf_cache
# If profiling result cache has incompatible format, increase this "v" number
@ -287,14 +287,14 @@ jobs:
fi
- name: Save performance artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: performance_results
path: artifacts
- name: Save PR message artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: pr_message
path: pr_message

Wyświetl plik

@ -15,7 +15,7 @@ jobs:
steps:
- name: Checkout the changes
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Run unit tests
run: |

Wyświetl plik

@ -1,6 +1,6 @@
# Introduction
Thank you for considering contributing to OpenMapTiles. It's people like you that make OpenMapTiles such a great project. Talk to us at the OSM Slack **#openmaptiles** channel ([join](https://osmus-slack.herokuapp.com/)).
Thank you for considering contributing to OpenMapTiles. It's people like you that make OpenMapTiles such a great project. Talk to us at the OSM Slack **#openmaptiles** channel ([join](https://slack.openstreetmap.us/)).
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests.

Wyświetl plik

@ -1,4 +1,4 @@
Copyright (c) 2022, MapTiler.com & OpenMapTiles contributors.
Copyright (c) 2024, MapTiler.com & OpenMapTiles contributors.
All rights reserved.
The vector tile schema has been developed by Klokan Technologies GmbH and

Wyświetl plik

@ -25,13 +25,23 @@ export TPORT
STYLE_FILE := build/style/style.json
STYLE_HEADER_FILE := style/style-header.json
# Support newer `docker compose` syntax in addition to `docker-compose`
ifeq (, $(shell which docker-compose))
DOCKER_COMPOSE_COMMAND := docker compose
$(info Using docker compose V2 (docker compose))
else
DOCKER_COMPOSE_COMMAND := docker-compose
$(info Using docker compose V1 (docker-compose))
endif
# Allow a custom docker-compose project name
DC_PROJECT := $(or $(DC_PROJECT),$(shell (. .env; echo $${DC_PROJECT})))
ifeq ($(DC_PROJECT),)
DC_PROJECT := $(notdir $(shell pwd))
DOCKER_COMPOSE := docker-compose
DOCKER_COMPOSE := $(DOCKER_COMPOSE_COMMAND)
else
DOCKER_COMPOSE := docker-compose --project-name $(DC_PROJECT)
DOCKER_COMPOSE := $(DOCKER_COMPOSE_COMMAND) --project-name $(DC_PROJECT)
endif
# Make some operations quieter (e.g. inside the test script)
@ -166,7 +176,7 @@ TPORT := $(or $(TPORT),$(shell (. .env; echo $${TPORT})),7)
define HELP_MESSAGE
==============================================================================
OpenMapTiles https://github.com/openmaptiles/openmaptiles
OpenMapTiles https://github.com/openmaptiles/openmaptiles
Hints for testing areas
make list-geofabrik # list actual geofabrik OSM extracts for download -> <<your-area>>
@ -279,20 +289,20 @@ ifeq (,$(wildcard build/sql/run_last.sql))
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c \
'generate-sql $(TILESET_FILE) --dir ./build/sql \
&& generate-sqltomvt $(TILESET_FILE) \
--key --gzip --postgis-ver 3.0.1 \
--key --gzip --postgis-ver 3.3.4 \
--function --fname=getmvt >> ./build/sql/run_last.sql'
endif
.PHONY: build-sprite
build-sprite: init-dirs
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c 'spritezero build/style/sprite /style/icons && \
spritezero --retina build/style/sprite@2x /style/icons'
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c 'spreet /style/icons build/style/sprite && \
spreet --retina /style/icons build/style/sprite@2x'
.PHONY: build-style
build-style: init-dirs
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c 'style-tools recompose $(TILESET_FILE) $(STYLE_FILE) \
$(STYLE_HEADER_FILE) && \
spritezero build/style/sprite /style/icons && spritezero --retina build/style/sprite@2x /style/icons'
spreet /style/icons build/style/sprite && spreet --retina /style/icons build/style/sprite@2x'
.PHONY: download-fonts
download-fonts:
@ -480,7 +490,7 @@ generate-changed-tiles: data/tiles.txt
fi
.PHONY: start-tileserver
start-tileserver: init-dirs
start-tileserver: init-dirs build-style download-fonts
@echo " "
@echo "***********************************************************"
@echo "* "
@ -489,7 +499,7 @@ start-tileserver: init-dirs
@echo "* "
@echo "***********************************************************"
@echo " "
docker pull maptiler/tileserver-gl
$(DOCKER_COMPOSE_COMMAND) pull tileserver-gl
@echo " "
@echo "***********************************************************"
@echo "* "
@ -606,9 +616,9 @@ else
@echo "Refreshing docker images... Use NO_REFRESH=1 to skip."
ifneq ($(USE_PRELOADED_IMAGE),)
POSTGIS_IMAGE=openmaptiles/postgis-preloaded \
docker-compose pull --ignore-pull-failures $(QUIET_FLAG) openmaptiles-tools generate-vectortiles postgres
$(DOCKER_COMPOSE_COMMAND) pull --ignore-pull-failures $(QUIET_FLAG) openmaptiles-tools generate-vectortiles postgres
else
docker-compose pull --ignore-pull-failures $(QUIET_FLAG) openmaptiles-tools generate-vectortiles postgres import-data
$(DOCKER_COMPOSE_COMMAND) pull --ignore-pull-failures $(QUIET_FLAG) openmaptiles-tools generate-vectortiles postgres import-data
endif
endif
@ -633,7 +643,7 @@ test-perf-null: init-dirs
.PHONY: build-test-pbf
build-test-pbf: init-dirs
docker-compose run $(DC_OPTS) openmaptiles-tools /tileset/.github/workflows/build-test-data.sh
$(DOCKER_COMPOSE_COMMAND) run $(DC_OPTS) openmaptiles-tools /tileset/.github/workflows/build-test-data.sh
.PHONY: debug
debug: ## Use this target when developing Makefile itself to verify loaded environment variables
@ -675,11 +685,13 @@ test-sql: clean refresh-docker-images destroy-db start-db-nowait build/import-te
awk '1{print; fflush()} $$0~".*ERROR" {txt=$$0} END{ if(txt){print "\n*** ERROR detected, aborting:"; print txt; exit(1)} }'
@echo "Test SQL output for Import Test Data"
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-import.sql'
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-import.sql' 2>&1 | \
awk -v s="ERROR:" '1{print; fflush()} $$0~s{print "*** ERROR detected, aborting"; exit(1)}'
@echo "Run UPDATE process on test data..."
sed -ir "s/^[#]*\s*DIFF_MODE=.*/DIFF_MODE=true/" .env
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && import-diff'
@echo "Test SQL output for Update Test Data"
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-update.sql'
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-update.sql' 2>&1 | \
awk -v s="ERROR:" '1{print; fflush()} $$0~s{print "*** ERROR detected, aborting"; exit(1)}'

Wyświetl plik

@ -2,7 +2,7 @@
### Req:
* CPU: AMD64 ( = Intel 64 bit)
* The base docker debian images are x86_64 based, so the ARM,MIPS currently not supported!
* The base docker debian images are x86_64 based, so the ARM, MIPS currently not supported!
* Operating system
* Linux is suggested
* The development and the testing platform is Linux.
@ -423,9 +423,11 @@ Hints for testing areas
Hints for designers:
make start-maputnik # start Maputnik Editor + dynamic tile server [ see http://localhost:8088 ]
make stop-maputnik # stop Maputnik Editor + dynamic tile server
make start-postserve # start dynamic tile server [ see http://localhost:8090 ]
make stop-postserve # stop dynamic tile server
make start-tileserver # start maptiler/tileserver-gl [ see http://localhost:8080 ]
make stop-tileserver # stop maptiler/tileserver-gl
Hints for developers:
make # build source code
@ -435,6 +437,7 @@ Hints for developers:
make generate-qa # statistics for a given layer's field
make generate-tiles-pg # generate vector tiles based on .env settings using PostGIS ST_MVT()
make generate-tiles # generate vector tiles based on .env settings using Mapnik (obsolete)
make generate-changed-tiles # Generate tiles changed by import-diff
make test-sql # run unit tests on the OpenMapTiles SQL schema
cat .env # list PG database and MIN_ZOOM and MAX_ZOOM information
cat quickstart.log # transcript of the last ./quickstart.sh run
@ -449,6 +452,7 @@ Hints for downloading & importing data:
make download-bbbike area=Amsterdam # download OSM data from bbbike.org and create config file
make import-data # Import data from OpenStreetMapData, Natural Earth and OSM Lake Labels.
make import-osm # Import OSM data with the mapping rules from build/mapping.yaml
make import-diff # Import OSM updates from data/changes.osc.gz
make import-wikidata # Import labels from Wikidata
make import-sql # Import layers (run this after modifying layer SQL)

Wyświetl plik

@ -1,4 +1,4 @@
## OpenMapTiles [![Build Status](https://github.com/openmaptiles/openmaptiles/workflows/OMT_CI/badge.svg?branch=master)](https://github.com/openmaptiles/openmaptiles/actions)
## OpenMapTiles [![Build Status](https://github.com/openmaptiles/openmaptiles/workflows/OpenMapTiles%20Integrity%20CI/badge.svg?branch=master)](https://github.com/openmaptiles/openmaptiles/actions)
OpenMapTiles is an extensible and open tile schema based on the OpenStreetMap. This project is used to generate vector tiles for online zoomable maps. OpenMapTiles is about creating a beautiful basemaps with general layers containing topographic information. More information [openmaptiles.org](https://openmaptiles.org/) and [maptiler.com/data/](https://www.maptiler.com/data/).
@ -11,7 +11,8 @@ Please keep in mind that OpenMapTiles schema should display general topographic
- :link: Data for download: https://www.maptiler.com/data/
- :link: Hosting https://www.maptiler.com/cloud/
- :link: Create own layer https://github.com/openmaptiles/openmaptiles-skiing
- :link: Discuss at the #openmaptiles channel at [OSM Slack](https://osmus-slack.herokuapp.com/)
- :link: Practical usage of OpenMapTiles https://github.com/maptiler/foss4g-workshop
- :link: Discuss at the #openmaptiles channel at [OSM Slack](https://slack.openstreetmap.us/)
## Styles
@ -88,7 +89,7 @@ make
```
You can execute the following manual steps (for better understanding)
or use the provided `quickstart.sh` script to automatically download and import given area. If area is not given, albania will be imported.
or use the provided `quickstart.sh` script to automatically download and import given area. If area is not given, Albania will be imported. List of available areas `make list-geofabrik`.
```
./quickstart.sh <area>
@ -102,7 +103,7 @@ Now start up the database container.
make start-db
```
Import external data from [OpenStreetMapData](http://osmdata.openstreetmap.de/), [Natural Earth](http://www.naturalearthdata.com/) and [OpenStreetMap Lake Labels](https://github.com/lukasmartinelli/osm-lakelines). Natural Earth country boundaries are used in the few lowest zoom levels.
Import external data from [OpenStreetMapData](http://osmdata.openstreetmap.de/), [Natural Earth](http://www.naturalearthdata.com/) and [OpenStreetMap Lake Labels](https://github.com/openmaptiles/osm-lakelines). Natural Earth country boundaries are used in the few lowest zoom levels.
```bash
make import-data
@ -114,8 +115,8 @@ Download OpenStreetMap data extracts from any source like [Geofabrik](http://dow
make download area=albania
```
[Import OpenStreetMap data](https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-osm) with the mapping rules from
`build/mapping.yaml` (which has been created by `make`). Run after any change in layers definition.
[Import OpenStreetMap data](https://github.com/openmaptiles/openmaptiles-tools/blob/master/bin/import-osm) with the mapping rules from
`build/mapping.yaml` (which has been created by `make`). Run after any change in layers definition (any change in `mapping.yaml`).
```bash
make import-osm
@ -159,7 +160,7 @@ make build-style
Now you are ready to **generate the vector tiles**. By default, `./.env` specifies the entire planet BBOX for zooms 0-7, but running `generate-bbox-file` will analyze the data file and set the `BBOX` param to limit tile generation.
```
make generate-bbox-file # compute data bbox -- not needed for the whole planet
make generate-bbox-file # compute data bbox -- not needed for the whole planet or for downloaded area by `make download`
make generate-tiles-pg # generate tiles
```
@ -174,17 +175,19 @@ make download area=albania # download albania .osm.pbf file -- can be skipped i
make import-osm # import data into postgres
make import-wikidata # import Wikidata
make import-sql # create / import sql functions
make generate-bbox-file # compute data bbox -- not needed for the whole planet
make generate-bbox-file # compute data bbox -- not needed for the whole planet or for downloaded area by `make download`
make generate-tiles-pg # generate tiles
```
Instead of calling `make download area=albania` you can add a .osm.pbf file in the `data` folder `openmaptiles/data/your_area_file.osm.pbf`
To change the name of the output filename, you can modify the variable `MBTILES_FILE` in the `.env` file or set up the environment variable `MBTILES_FILE` before running `./quickstart.sh` or `make generate-tiles-pg` (e.g., `MBTILES_FILENAME=monaco.mbtiles ./quickstart.sh monaco`).
## License
All code in this repository is under the [BSD license](./LICENSE.md). Design and the cartography decisions encoded in the schema and SQL are licensed under [CC-BY](./LICENSE.md).
Products or services using maps derived from OpenMapTiles schema need to visibly credit "OpenMapTiles.org" or reference "OpenMapTiles" with a link to https://openmaptiles.org/. Exceptions to attribution requirement can be granted on request.
Products or services using maps derived from OpenMapTiles schema need to **visibly credit "OpenMapTiles.org"** or **reference "OpenMapTiles"** with a link to https://openmaptiles.org/. Exceptions to attribution requirement can be granted on request.
For a browsable electronic map based on OpenMapTiles and OpenStreetMap data, the
credit should appear in the corner of the map. For example:

Wyświetl plik

@ -13,6 +13,7 @@ services:
postgres:
image: "${POSTGIS_IMAGE:-openmaptiles/postgis}:${TOOLS_VERSION}"
# Use "command: postgres -c jit=off" for PostgreSQL 11+ because of slow large MVT query processing
# Use "shm_size: 512m" if you want to prevent a possible 'No space left on device' during 'make generate-tiles-pg'
volumes:
- pgdata:/var/lib/postgresql/data
networks:

37
integrity.sh 100755
Wyświetl plik

@ -0,0 +1,37 @@
#!/bin/sh
# A script to run the "integrity" continuous integration script.
area=monaco
echo MIN_ZOOM=0 >> .env
echo MAX_ZOOM=14 >> .env
./quickstart.sh $area
export TEST_MODE=yes
make generate-devdoc
area=europe/monaco
echo DIFF_MODE=true >> .env
# Cleanup
rm -fr data build cache
# Create data/$area.repl.json
make download-geofabrik area=$area
# Download 2+ month old data
export old_date=$(date --date="$(date +%Y-%m-15) -2 month" +'%y%m01')
echo Downloading $old_date extract of $area
docker-compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "wget -O data/$area.osm.pbf http://download.geofabrik.de/$area-$old_date.osm.pbf"
# Initial import and tile generation
./quickstart.sh $area
sleep 2
echo Downloading updates
# Loop to recover from potential "ERROR 429: Too Many Requests"
docker-compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "
while ! osmupdate --keep-tempfiles --base-url=$(sed -n 's/ *\"replication_url\": //p' data/$area.repl.json) data/$area.osm.pbf data/changes.osc.gz ; do
sleep 2;
echo Sleeping...;
sleep 630;
done"
echo Downloading updates completed
echo Importing updates
make import-diff
echo Generating new tiles
make generate-tiles-pg

Wyświetl plik

@ -5,9 +5,9 @@ layer:
buffer_size: 64
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
fields:
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the aerodrome.
name_en: English name `name:en` if available, otherwise `name`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the aerodrome. Language-specific values are in `name:xx`.
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
class:
description: |
Distinguish between more and less important aerodromes.

Wyświetl plik

@ -63,7 +63,7 @@
"iata"
]
],
"order": 181
"order": 190
}
]
}

Wyświetl plik

@ -12,7 +12,7 @@ CREATE SCHEMA IF NOT EXISTS aerodrome_label;
CREATE TABLE IF NOT EXISTS aerodrome_label.osm_ids
(
osm_id bigint
osm_id bigint PRIMARY KEY
);
-- etldoc: osm_aerodrome_label_point -> osm_aerodrome_label_point
@ -48,11 +48,7 @@ SELECT update_aerodrome_label_point(true);
CREATE OR REPLACE FUNCTION aerodrome_label.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO aerodrome_label.osm_ids VALUES (OLD.osm_id);
ELSE
INSERT INTO aerodrome_label.osm_ids VALUES (NEW.osm_id);
END IF;
INSERT INTO aerodrome_label.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@ -77,6 +73,11 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh aerodrome_label';
-- Analyze tracking and source tables before performing update
ANALYZE aerodrome_label.osm_ids;
ANALYZE osm_aerodrome_label_point;
PERFORM update_aerodrome_label_point(false);
-- noinspection SqlWithoutWhere
DELETE FROM aerodrome_label.osm_ids;
@ -89,13 +90,13 @@ END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_aerodrome_label_point
FOR EACH ROW
EXECUTE PROCEDURE aerodrome_label.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_aerodrome_label_point
FOR EACH STATEMENT
EXECUTE PROCEDURE aerodrome_label.flag();

Wyświetl plik

@ -157,7 +157,7 @@
"taxiway"
]
],
"order": 182
"order": 191
},
{
"id": "airport_gate",
@ -197,7 +197,7 @@
"gate"
]
],
"order": 183
"order": 192
}
]
}

Wyświetl plik

@ -150,38 +150,10 @@ CREATE MATERIALIZED VIEW osm_border_linestring_gen_z4 AS
(
SELECT ST_Simplify(geometry, ZRes(5)) AS geometry, adm0_l, adm0_r, admin_level, disputed, name, claimed_by, maritime
FROM osm_border_linestring_gen_z5
WHERE admin_level = 2 AND (maritime OR disputed)
WHERE admin_level = 2 AND maritime
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen_z4_idx ON osm_border_linestring_gen_z4 USING gist (geometry);
-- etldoc: osm_border_linestring_gen_z4 -> osm_border_disp_linestring_gen_z3
DROP MATERIALIZED VIEW IF EXISTS osm_border_disp_linestring_gen_z3 CASCADE;
CREATE MATERIALIZED VIEW osm_border_disp_linestring_gen_z3 AS
(
SELECT ST_Simplify(geometry, ZRes(4)) AS geometry, adm0_l, adm0_r, admin_level, TRUE AS disputed, name, claimed_by, maritime
FROM osm_border_linestring_gen_z4
WHERE disputed -- AND admin_level = 2
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
CREATE INDEX IF NOT EXISTS osm_border_disp_linestring_gen_z3_idx ON osm_border_disp_linestring_gen_z3 USING gist (geometry);
-- etldoc: osm_border_disp_linestring_gen_z3 -> osm_border_disp_linestring_gen_z2
DROP MATERIALIZED VIEW IF EXISTS osm_border_disp_linestring_gen_z2 CASCADE;
CREATE MATERIALIZED VIEW osm_border_disp_linestring_gen_z2 AS
(
SELECT ST_Simplify(geometry, ZRes(3)) AS geometry, adm0_l, adm0_r, admin_level, TRUE AS disputed, name, claimed_by, maritime
FROM osm_border_disp_linestring_gen_z3
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
CREATE INDEX IF NOT EXISTS osm_border_disp_linestring_gen_z2_idx ON osm_border_disp_linestring_gen_z2 USING gist (geometry);
-- etldoc: osm_border_disp_linestring_gen_z2 -> osm_border_disp_linestring_gen_z1
DROP MATERIALIZED VIEW IF EXISTS osm_border_disp_linestring_gen_z1 CASCADE;
CREATE MATERIALIZED VIEW osm_border_disp_linestring_gen_z1 AS
(
SELECT ST_Simplify(geometry, ZRes(2)) AS geometry, adm0_l, adm0_r, admin_level, TRUE AS disputed, name, claimed_by, maritime
FROM osm_border_disp_linestring_gen_z2
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
CREATE INDEX IF NOT EXISTS osm_border_disp_linestring_gen_z2_idx ON osm_border_disp_linestring_gen_z2 USING gist (geometry);
-- ne_10m_admin_0_boundary_lines_land
-- etldoc: ne_10m_admin_0_boundary_lines_land -> ne_10m_admin_0_boundary_lines_land_gen_z4
DROP MATERIALIZED VIEW IF EXISTS ne_10m_admin_0_boundary_lines_land_gen_z4 CASCADE;
@ -190,7 +162,7 @@ CREATE MATERIALIZED VIEW ne_10m_admin_0_boundary_lines_land_gen_z4 AS
SELECT ST_Simplify(geometry, ZRes(6)) as geometry,
2 AS admin_level,
(CASE WHEN featurecla LIKE 'Disputed%' THEN TRUE ELSE FALSE END) AS disputed,
(CASE WHEN featurecla LIKE 'Disputed%' THEN 'ne10m_' || ogc_fid ELSE NULL::text END) AS disputed_name,
NULL::text AS disputed_name,
NULL::text AS claimed_by,
FALSE AS maritime
FROM ne_10m_admin_0_boundary_lines_land
@ -198,6 +170,21 @@ WHERE featurecla <> 'Lease limit'
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_land_gen_z4_idx ON ne_10m_admin_0_boundary_lines_land_gen_z4 USING gist (geometry);
-- etldoc: ne_10m_admin_0_boundary_lines_land -> ne_10m_admin_0_boundary_lines_land_disputed
DROP MATERIALIZED VIEW IF EXISTS ne_10m_admin_0_boundary_lines_land_disputed CASCADE;
CREATE MATERIALIZED VIEW ne_10m_admin_0_boundary_lines_land_disputed AS
(
SELECT geometry,
2 AS admin_level,
(CASE WHEN featurecla LIKE 'Disputed%' THEN TRUE ELSE FALSE END) AS disputed,
NULL::text AS disputed_name,
NULL::text AS claimed_by,
FALSE AS maritime
FROM ne_10m_admin_0_boundary_lines_land
WHERE featurecla LIKE 'Disputed%' AND adm0_left = 'South Sudan' AND adm0_right = 'Kenya'
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_land_disputed_idx ON ne_10m_admin_0_boundary_lines_land_disputed USING gist (geometry);
-- ne_10m_admin_1_states_provinces_lines
-- etldoc: ne_10m_admin_1_states_provinces_lines -> ne_10m_admin_1_states_provinces_lines_gen_z4
DROP MATERIALIZED VIEW IF EXISTS ne_10m_admin_1_states_provinces_lines_gen_z4 CASCADE;
@ -267,7 +254,7 @@ CREATE MATERIALIZED VIEW ne_50m_admin_0_boundary_lines_land_gen_z3 AS
SELECT ST_Simplify(geometry, ZRes(5)) as geometry,
2 AS admin_level,
(CASE WHEN featurecla LIKE 'Disputed%' THEN TRUE ELSE FALSE END) AS disputed,
(CASE WHEN featurecla LIKE 'Disputed%' THEN 'ne50m_' || ogc_fid ELSE NULL::text END) AS disputed_name,
NULL::text AS disputed_name,
NULL::text AS claimed_by,
FALSE AS maritime
FROM ne_50m_admin_0_boundary_lines_land
@ -310,7 +297,7 @@ CREATE MATERIALIZED VIEW ne_110m_admin_0_boundary_lines_land_gen_z0 AS
SELECT ST_Simplify(geometry, ZRes(2)) as geometry,
2 AS admin_level,
(CASE WHEN featurecla LIKE 'Disputed%' THEN TRUE ELSE FALSE END) AS disputed,
(CASE WHEN featurecla LIKE 'Disputed%' THEN 'ne110m_' || ogc_fid ELSE NULL::text END) AS disputed_name,
NULL::text AS disputed_name,
NULL::text AS claimed_by,
FALSE AS maritime
FROM ne_110m_admin_0_boundary_lines_land
@ -347,8 +334,10 @@ FROM ne_110m_admin_0_boundary_lines_land_gen_z0
-- etldoc: ne_50m_admin_0_boundary_lines_land_gen_z1 -> boundary_z1
-- etldoc: ne_10m_admin_1_states_provinces_lines_gen_z1 -> boundary_z1
-- etldoc: ne_10m_admin_0_boundary_lines_land_disputed -> boundary_z1
-- etldoc: osm_border_disp_linestring_gen_z1 -> boundary_z1
CREATE OR REPLACE VIEW boundary_z1 AS
DROP MATERIALIZED VIEW IF EXISTS boundary_z1 CASCADE;
CREATE MATERIALIZED VIEW boundary_z1 AS
(
SELECT geometry,
admin_level,
@ -374,18 +363,21 @@ SELECT geometry,
admin_level,
NULL::text AS adm0_l,
NULL::text AS adm0_r,
TRUE AS disputed,
edit_name(name) AS disputed_name,
disputed,
disputed_name,
claimed_by,
maritime
FROM osm_border_disp_linestring_gen_z1
FROM ne_10m_admin_0_boundary_lines_land_disputed
);
CREATE INDEX IF NOT EXISTS boundary_z1_idx ON boundary_z1 USING gist (geometry);
-- etldoc: ne_50m_admin_0_boundary_lines_land_gen_z2 -> boundary_z2
-- etldoc: ne_10m_admin_1_states_provinces_lines_gen_z2 -> boundary_z2
-- etldoc: ne_10m_admin_0_boundary_lines_land_disputed -> boundary_z2
-- etldoc: osm_border_disp_linestring_gen_z2 -> boundary_z2
CREATE OR REPLACE VIEW boundary_z2 AS
DROP MATERIALIZED VIEW IF EXISTS boundary_z2 CASCADE;
CREATE MATERIALIZED VIEW boundary_z2 AS
(
SELECT geometry,
admin_level,
@ -411,17 +403,20 @@ SELECT geometry,
admin_level,
NULL::text AS adm0_l,
NULL::text AS adm0_r,
TRUE AS disputed,
edit_name(name) AS disputed_name,
disputed,
disputed_name,
claimed_by,
maritime
FROM osm_border_disp_linestring_gen_z2
FROM ne_10m_admin_0_boundary_lines_land_disputed
);
CREATE INDEX IF NOT EXISTS boundary_z2_idx ON boundary_z2 USING gist (geometry);
-- etldoc: ne_50m_admin_0_boundary_lines_land_gen_z3 -> boundary_z3
-- etldoc: ne_10m_admin_1_states_provinces_lines_gen_z3 -> boundary_z3
-- etldoc: ne_10m_admin_0_boundary_lines_land_disputed -> boundary_z3
-- etldoc: osm_border_disp_linestring_gen_z3 -> boundary_z3
CREATE OR REPLACE VIEW boundary_z3 AS
DROP MATERIALIZED VIEW IF EXISTS boundary_z3 CASCADE;
CREATE MATERIALIZED VIEW boundary_z3 AS
(
SELECT geometry,
admin_level,
@ -447,17 +442,19 @@ SELECT geometry,
admin_level,
NULL::text AS adm0_l,
NULL::text AS adm0_r,
TRUE AS disputed,
edit_name(name) AS disputed_name,
disputed,
disputed_name,
claimed_by,
maritime
FROM osm_border_disp_linestring_gen_z3
FROM ne_10m_admin_0_boundary_lines_land_disputed
);
CREATE INDEX IF NOT EXISTS boundary_z3_idx ON boundary_z3 USING gist (geometry);
-- etldoc: ne_10m_admin_0_boundary_lines_land_gen_z4 -> boundary_z4
-- etldoc: ne_10m_admin_1_states_provinces_lines_gen_z4 -> boundary_z4
-- etldoc: osm_border_linestring_gen_z4 -> boundary_z4
CREATE OR REPLACE VIEW boundary_z4 AS
DROP MATERIALIZED VIEW IF EXISTS boundary_z4 CASCADE;
CREATE MATERIALIZED VIEW boundary_z4 AS
(
SELECT geometry,
admin_level,
@ -489,6 +486,7 @@ SELECT geometry,
maritime
FROM osm_border_linestring_gen_z4
);
CREATE INDEX IF NOT EXISTS boundary_z4_idx ON boundary_z4 USING gist (geometry);
-- etldoc: osm_border_linestring_gen_z5 -> boundary_z5
CREATE OR REPLACE VIEW boundary_z5 AS
@ -624,7 +622,7 @@ FROM osm_border_linestring_gen_z13
);
-- etldoc: layer_boundary[shape=record fillcolor=lightpink, style="rounded,filled",
-- etldoc: label="<sql> layer_boundary |<z0> z0 |<z1> z1 |<z2> z2 | <z3> z3 | <z4> z4 | <z5> z5 | <z6> z6 | <z7> z7 | <z8> z8 | <z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13+"]
-- etldoc: label="<sql> layer_boundary |<z0> z0 |<z1> z1 |<z2> z2 | <z3> z3 | <z4> z4 | <z5> z5 | <z6> z6 | <z7> z7 | <z8> z8 | <z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13|<z14> z14+"]
CREATE OR REPLACE FUNCTION layer_boundary(bbox geometry, zoom_level int)
RETURNS TABLE
(
@ -635,11 +633,14 @@ CREATE OR REPLACE FUNCTION layer_boundary(bbox geometry, zoom_level int)
disputed int,
disputed_name text,
claimed_by text,
maritime int
maritime int,
class text,
name text,
tags hstore
)
AS
$$
SELECT geometry, admin_level, adm0_l, adm0_r, disputed::int, disputed_name, claimed_by, maritime::int
SELECT geometry, admin_level, adm0_l, adm0_r, disputed::int, disputed_name, claimed_by, maritime::int, NULL::text, NULL::text, NULL::hstore
FROM (
-- etldoc: boundary_z0 -> layer_boundary:z0
SELECT *
@ -724,7 +725,134 @@ FROM (
FROM boundary_z13
WHERE geometry && bbox
AND zoom_level >= 13
) AS zoom_levels;
) AS segment_zoom_levels
UNION ALL
SELECT geometry, NULL::int, NULL::text, NULL::text, NULL::int, NULL::text, NULL::text, NULL::int, class, name, tags
FROM (
-- etldoc: osm_boundary_polygon_gen_z4 -> layer_boundary:z4
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z4
WHERE zoom_level = 4
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z5 -> layer_boundary:z5
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z5
WHERE zoom_level = 5
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z6 -> layer_boundary:z6
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z6
WHERE zoom_level = 6
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z7 -> layer_boundary:z7
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z7
WHERE zoom_level = 7
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z8 -> layer_boundary:z8
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z8
WHERE zoom_level = 8
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z9 -> layer_boundary:z9
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z9
WHERE zoom_level = 9
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z10 -> layer_boundary:z10
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z10
WHERE zoom_level = 10
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z11 -> layer_boundary:z11
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z11
WHERE zoom_level = 11
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z12 -> layer_boundary:z12
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z12
WHERE zoom_level = 12
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z13 -> layer_boundary:z13
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z13
WHERE zoom_level = 13
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon -> layer_boundary:z14
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon
WHERE zoom_level = 14
AND geometry && bbox
) AS area_zoom_levels
$$ LANGUAGE SQL STABLE
-- STRICT
PARALLEL SAFE;

Wyświetl plik

@ -9,13 +9,17 @@ layer:
- ne_50m_admin_0_boundary_lines_land
- ne_110m_admin_0_boundary_lines_land
description: |
Contains administrative boundaries as linestrings.
Contains administrative boundaries as linestrings and aboriginal lands as polygons.
Until z4 [Natural Earth data](http://www.naturalearthdata.com/downloads/) is used after which
OSM boundaries ([`boundary=administrative`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative))
are present from z5 to z14 (also for maritime boundaries with `admin_level <= 2` at z4).
OSM data contains several [`admin_level`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#admin_level)
but for most styles it makes sense to just style `admin_level=2` and `admin_level=4`.
fields:
class:
description: |
Use the **class** to differentiate between different kinds of boundaries. The class for `boundary=aboriginal_lands` is `aboriginal_lands`.
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value (area features only).
admin_level: |
OSM [admin_level](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#admin_level)
indicating the level of importance of this boundary.
@ -58,8 +62,9 @@ layer:
buffer_size: 4
datasource:
geometry_field: geometry
query: (SELECT geometry, admin_level, adm0_l, adm0_r, disputed, disputed_name, claimed_by, maritime FROM layer_boundary(!bbox!, z(!scale_denominator!))) AS t
query: (SELECT geometry, admin_level, adm0_l, adm0_r, disputed, disputed_name, claimed_by, maritime, class, name, {name_languages} FROM layer_boundary(!bbox!, z(!scale_denominator!))) AS t
schema:
- ./update_boundary_polygon.sql
- ./boundary_name.sql
- ./boundary.sql
datasources:

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 552 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 750 KiB

Wyświetl plik

@ -4,6 +4,67 @@ generalized_tables:
source: border_linestring
sql_filter: ST_GeometryType(geometry) = 'ST_LineString' AND (disputed OR dispute OR border_status = 'disputed' OR disputed_by <> '') AND admin_level = 2
# etldoc: osm_boundary_polygon_gen_z5 -> osm_boundary_polygon_gen_z4
boundary_polygon_gen_z4:
source: boundary_polygon_gen_z5
sql_filter: area>power(ZRES3,2)
tolerance: ZRES4
# etldoc: osm_boundary_polygon_gen_z6 -> osm_boundary_polygon_gen_z5
boundary_polygon_gen_z5:
source: boundary_polygon_gen_z6
sql_filter: area>power(ZRES4,2)
tolerance: ZRES5
# etldoc: osm_boundary_polygon_gen_z7 -> osm_boundary_polygon_gen_z6
boundary_polygon_gen_z6:
source: boundary_polygon_gen_z7
sql_filter: area>power(ZRES5,2)
tolerance: ZRES6
# etldoc: osm_boundary_polygon_gen_z8 -> osm_boundary_polygon_gen_z7
boundary_polygon_gen_z7:
source: boundary_polygon_gen_z8
sql_filter: area>power(ZRES6,2)
tolerance: ZRES7
# etldoc: osm_boundary_polygon_gen_z9 -> osm_boundary_polygon_gen_z8
boundary_polygon_gen_z8:
source: boundary_polygon_gen_z9
sql_filter: area>power(ZRES7,2)
tolerance: ZRES8
# etldoc: osm_boundary_polygon_gen_z10 -> osm_boundary_polygon_gen_z9
boundary_polygon_gen_z9:
source: boundary_polygon_gen_z10
sql_filter: area>power(ZRES8,2)
tolerance: ZRES9
# etldoc: osm_boundary_polygon_gen_z11 -> osm_boundary_polygon_gen_z10
boundary_polygon_gen_z10:
source: boundary_polygon_gen_z11
sql_filter: area>power(ZRES9,2)
tolerance: ZRES10
# etldoc: osm_boundary_polygon_gen_z12 -> osm_boundary_polygon_gen_z11
boundary_polygon_gen_z11:
source: boundary_polygon_gen_z12
sql_filter: area>power(ZRES10,2)
tolerance: ZRES11
# etldoc: osm_boundary_polygon_gen_z13 -> osm_boundary_polygon_gen_z12
boundary_polygon_gen_z12:
source: boundary_polygon_gen_z13
sql_filter: area>power(ZRES11,2)
tolerance: ZRES12
# etldoc: osm_boundary_polygon -> osm_boundary_polygon_gen_z13
boundary_polygon_gen_z13:
source: boundary_polygon
sql_filter: area>power(ZRES12,2) AND ST_IsValid(geometry)
tolerance: ZRES13
tables:
# etldoc: imposm3 -> osm_border_linestring
border_linestring:
@ -71,3 +132,29 @@ tables:
- dispute
boundary_type:
- maritime
# etldoc: imposm3 -> osm_boundary_polygon
boundary_polygon:
type: polygon
filters:
require:
type: [boundary]
boundary: [aboriginal_lands]
columns:
- name: osm_id
type: id
- name: geometry
type: validated_geometry
- name: name
key: name
type: string
- name: tags
type: hstore_tags
- name: boundary
key: boundary
type: string
- name: area
type: area
mapping:
boundary:
- aboriginal_lands

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 14 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 22 KiB

Wyświetl plik

@ -61,7 +61,7 @@
0
]
],
"order": 137
"order": 146
},
{
"id": "boundary_2",
@ -114,7 +114,7 @@
0
]
],
"order": 138
"order": 147
},
{
"id": "boundary_2_disputed",
@ -171,7 +171,7 @@
0
]
],
"order": 139
"order": 148
},
{
"id": "boundary_2_disputed_maritime",
@ -228,7 +228,7 @@
1
]
],
"order": 140
"order": 149
},
{
"id": "boundary_2_maritime",
@ -281,7 +281,7 @@
1
]
],
"order": 141
"order": 150
}
]
}

Wyświetl plik

@ -0,0 +1,221 @@
ALTER TABLE osm_boundary_polygon
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z13
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z12
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z11
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z10
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z9
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z8
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z7
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z6
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z5
ADD COLUMN IF NOT EXISTS geometry_point geometry;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z13;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z12;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z11;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z10;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z9;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z8;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z7;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z6;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z5;
DROP TRIGGER IF EXISTS trigger_flag ON osm_boundary_polygon;
DROP TRIGGER IF EXISTS trigger_refresh ON boundary_polygon.updates;
-- etldoc: osm_boundary_polygon -> osm_boundary_polygon
-- etldoc: osm_boundary_polygon_gen_z13 -> osm_boundary_polygon_gen_z13
-- etldoc: osm_boundary_polygon_gen_z12 -> osm_boundary_polygon_gen_z12
-- etldoc: osm_boundary_polygon_gen_z11 -> osm_boundary_polygon_gen_z11
-- etldoc: osm_boundary_polygon_gen_z10 -> osm_boundary_polygon_gen_z10
-- etldoc: osm_boundary_polygon_gen_z9 -> osm_boundary_polygon_gen_z9
-- etldoc: osm_boundary_polygon_gen_z8 -> osm_boundary_polygon_gen_z8
-- etldoc: osm_boundary_polygon_gen_z7 -> osm_boundary_polygon_gen_z7
-- etldoc: osm_boundary_polygon_gen_z6 -> osm_boundary_polygon_gen_z6
-- etldoc: osm_boundary_polygon_gen_z5 -> osm_boundary_polygon_gen_z5
CREATE OR REPLACE FUNCTION update_osm_boundary_polygon() RETURNS void AS
$$
BEGIN
UPDATE osm_boundary_polygon
SET tags = update_tags(tags, geometry),
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_boundary_polygon_gen_z13
SET tags = update_tags(tags, geometry),
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_boundary_polygon_gen_z12
SET tags = update_tags(tags, geometry),
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_boundary_polygon_gen_z11
SET tags = update_tags(tags, geometry),
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_boundary_polygon_gen_z10
SET tags = update_tags(tags, geometry),
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_boundary_polygon_gen_z9
SET tags = update_tags(tags, geometry),
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_boundary_polygon_gen_z8
SET tags = update_tags(tags, geometry),
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_boundary_polygon_gen_z7
SET tags = update_tags(tags, geometry),
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_boundary_polygon_gen_z6
SET tags = update_tags(tags, geometry),
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_boundary_polygon_gen_z5
SET tags = update_tags(tags, geometry),
geometry_point = ST_PointOnSurface(geometry);
END;
$$ LANGUAGE plpgsql;
SELECT update_osm_boundary_polygon();
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_point_geom_idx ON osm_boundary_polygon USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z13_point_geom_idx ON osm_boundary_polygon_gen_z13 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z12_point_geom_idx ON osm_boundary_polygon_gen_z12 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z11_point_geom_idx ON osm_boundary_polygon_gen_z11 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z10_point_geom_idx ON osm_boundary_polygon_gen_z10 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z9_point_geom_idx ON osm_boundary_polygon_gen_z9 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z8_point_geom_idx ON osm_boundary_polygon_gen_z8 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z7_point_geom_idx ON osm_boundary_polygon_gen_z7 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z6_point_geom_idx ON osm_boundary_polygon_gen_z6 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z5_point_geom_idx ON osm_boundary_polygon_gen_z5 USING gist (geometry_point);
CREATE SCHEMA IF NOT EXISTS boundary_polygon;
CREATE TABLE IF NOT EXISTS boundary_polygon.updates
(
id serial PRIMARY KEY,
t text,
UNIQUE (t)
);
CREATE OR REPLACE FUNCTION boundary_polygon.flag() RETURNS trigger AS
$$
BEGIN
INSERT INTO boundary_polygon.updates(t) VALUES ('y') ON CONFLICT(t) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION boundary_polygon.refresh() RETURNS trigger AS
$$
DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh boundary_polygon';
-- Analyze tracking and source tables before performing update
ANALYZE osm_boundary_polygon_gen_z5;
REFRESH MATERIALIZED VIEW osm_boundary_polygon_gen_z5;
-- noinspection SqlWithoutWhere
DELETE FROM boundary_polygon.updates;
RAISE LOG 'Refresh boundary_polygon done in %', age(clock_timestamp(), t);
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION update_osm_boundary_polygon_row()
RETURNS trigger
AS
$$
BEGIN
NEW.tags = update_tags(NEW.tags, NEW.geometry);
NEW.geometry_point = ST_PointOnSurface(NEW.geometry);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z13
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z12
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z11
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z10
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z9
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z8
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z7
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z6
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z5
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
ON osm_boundary_polygon
FOR EACH STATEMENT
EXECUTE PROCEDURE boundary_polygon.flag();
CREATE CONSTRAINT TRIGGER trigger_refresh
AFTER INSERT
ON boundary_polygon.updates
INITIALLY DEFERRED
FOR EACH ROW
EXECUTE PROCEDURE boundary_polygon.refresh();

Wyświetl plik

@ -14,10 +14,20 @@ SELECT
-- etldoc: osm_housenumber_point -> layer_housenumber:z14_
osm_id,
geometry,
housenumber
FROM osm_housenumber_point
WHERE zoom_level >= 14
AND geometry && bbox;
display_housenumber(housenumber)
FROM (
SELECT
osm_id,
geometry,
housenumber,
row_number() OVER(PARTITION BY concat(street, block_number, housenumber) ORDER BY has_name ASC) as rn
FROM osm_housenumber_point
WHERE 1=1
AND zoom_level >= 14
AND geometry && bbox
) t
WHERE rn = 1;
$$ LANGUAGE SQL STABLE
-- STRICT
PARALLEL SAFE;

Wyświetl plik

@ -3,15 +3,18 @@ layer:
description: |
Everything in OpenStreetMap which contains a `addr:housenumber` tag useful for labelling housenumbers on a map.
This adds significant size to *z14*. For buildings the centroid of the building is used as housenumber.
Duplicates within a tile are dropped if they have the same street/block_number (records without name tag are prioritized for preservation).
buffer_size: 8
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
fields:
housenumber: Value of the [`addr:housenumber`](http://wiki.openstreetmap.org/wiki/Key:addr) tag.
housenumber: Value of the [`addr:housenumber`](http://wiki.openstreetmap.org/wiki/Key:addr) tag.
If there are multiple values separated by semi-colons, the first and last value separated by a dash.
datasource:
geometry_field: geometry
srid: 900913
query: (SELECT geometry, housenumber FROM layer_housenumber(!bbox!, z(!scale_denominator!))) AS t
schema:
- ./housenumber_display.sql
- ./housenumber_centroid.sql
- ./housenumber.sql
datasources:

Wyświetl plik

@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS housenumber;
CREATE TABLE IF NOT EXISTS housenumber.osm_ids
(
osm_id bigint
osm_id bigint PRIMARY KEY
);
-- etldoc: osm_housenumber_point -> osm_housenumber_point
@ -22,6 +22,16 @@ $$
WHERE (full_update OR osm_id IN (SELECT osm_id FROM housenumber.osm_ids))
AND ST_GeometryType(geometry) <> 'ST_Point'
AND ST_IsValid(geometry);
-- we don't need exact name just to know if it's present
UPDATE osm_housenumber_point
SET has_name =
CASE
WHEN has_name = '' THEN '0'
ELSE '1'
END
WHERE (full_update OR osm_id IN (SELECT osm_id FROM housenumber.osm_ids));
$$ LANGUAGE SQL;
SELECT convert_housenumber_point(true);
@ -31,11 +41,7 @@ SELECT convert_housenumber_point(true);
CREATE OR REPLACE FUNCTION housenumber.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO housenumber.osm_ids VALUES (OLD.osm_id);
ELSE
INSERT INTO housenumber.osm_ids VALUES (NEW.osm_id);
END IF;
INSERT INTO housenumber.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@ -60,6 +66,11 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh housenumber';
-- Analyze tracking and source tables before performing update
ANALYZE housenumber.osm_ids;
ANALYZE osm_housenumber_point;
PERFORM convert_housenumber_point(false);
-- noinspection SqlWithoutWhere
DELETE FROM housenumber.osm_ids;
@ -72,13 +83,13 @@ END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_housenumber_point
FOR EACH ROW
EXECUTE PROCEDURE housenumber.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_housenumber_point
FOR EACH STATEMENT
EXECUTE PROCEDURE housenumber.flag();

Wyświetl plik

@ -0,0 +1,20 @@
CREATE OR REPLACE FUNCTION display_housenumber_nonnumeric(raw_housenumber text)
RETURNS text AS $$
-- Find the position of the semicolon in the input string
-- and extract the first and last value
SELECT substring(raw_housenumber from 1 for position(';' in raw_housenumber) - 1)
|| ''
|| substring(raw_housenumber from position(';' in raw_housenumber) + 1);
$$ LANGUAGE SQL IMMUTABLE;
CREATE OR REPLACE FUNCTION display_housenumber(raw_housenumber text)
RETURNS text AS $$
SELECT CASE
WHEN raw_housenumber !~ ';' THEN raw_housenumber
WHEN raw_housenumber ~ '[^0-9;]' THEN display_housenumber_nonnumeric(raw_housenumber)
ELSE
(SELECT min(value)::text || '' || max(value)::text
FROM unnest(array_remove(string_to_array(raw_housenumber, ';'), '')::bigint[]) AS value)
END
$$ LANGUAGE SQL IMMUTABLE;

Wyświetl plik

@ -12,6 +12,15 @@ tables:
- name: housenumber
key: addr:housenumber
type: string
- name: street
key: addr:street
type: string
- name: block_number
key: addr:block_number
type: string
- name: has_name
key: name
type: string
type_mappings:
points:
addr:housenumber:

Wyświetl plik

@ -34,7 +34,7 @@
"text-halo-color": "rgba(255,255,255,0.8)",
"text-halo-width": 1
},
"order": 145
"order": 154
}
]
}

Wyświetl plik

@ -8,9 +8,9 @@ layer:
buffer_size: 64
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
fields:
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the peak.
name_en: English name `name:en` if available, otherwise `name`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the peak. Language-specific values are in `name:xx`.
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
class:
description: |
Use the **class** to differentiate between natural objects.

Wyświetl plik

@ -6,6 +6,15 @@
"source": "openmaptiles",
"source-layer": "mountain_peak",
"maxzoom": 16,
"filter": [
"all",
[
"!in",
"class",
"cliff",
"volcano"
]
],
"layout": {
"text-size": 10,
"icon-image": "peak",
@ -38,15 +47,55 @@
"text-halo-color": "rgba(255, 255, 255, .8)",
"text-halo-width": 1
},
"order": 197
},
{
"id": "mountain_peak_volcano",
"type": "symbol",
"source": "openmaptiles",
"source-layer": "mountain_peak",
"maxzoom": 16,
"filter": [
"all",
[
"!=",
"==",
"class",
"cliff"
"volcano"
]
],
"order": 188
"layout": {
"text-size": 10,
"icon-image": "volcano",
"text-field": {
"stops": [
[
6,
" "
],
[
12,
"{name} {ele}m"
]
]
},
"text-anchor": "top",
"text-offset": [
0,
0.5
],
"text-max-width": 6,
"text-line-height": 1.1,
"text-font": [
"Noto Sans Regular",
"Noto Sans Italic"
]
},
"paint": {
"text-color": "#d40000",
"text-halo-color": "rgba(255, 255, 255, .8)",
"text-halo-width": 1
},
"order": 198
}
]
}

Wyświetl plik

@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS mountain_linestring;
CREATE TABLE IF NOT EXISTS mountain_linestring.osm_ids
(
osm_id bigint
osm_id bigint PRIMARY KEY
);
-- etldoc: osm_mountain_linestring -> osm_mountain_linestring
@ -26,11 +26,7 @@ SELECT update_osm_mountain_linestring(true);
CREATE OR REPLACE FUNCTION mountain_linestring.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO mountain_linestring.osm_ids VALUES (OLD.osm_id);
ELSE
INSERT INTO mountain_linestring.osm_ids VALUES (NEW.osm_id);
END IF;
INSERT INTO mountain_linestring.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@ -55,6 +51,11 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh mountain_linestring';
-- Analyze tracking and source tables before performing update
ANALYZE mountain_linestring.osm_ids;
ANALYZE osm_mountain_linestring;
PERFORM update_osm_mountain_linestring(false);
-- noinspection SqlWithoutWhere
DELETE FROM mountain_linestring.osm_ids;
@ -67,13 +68,13 @@ END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_mountain_linestring
FOR EACH ROW
EXECUTE PROCEDURE mountain_linestring.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_mountain_linestring
FOR EACH STATEMENT
EXECUTE PROCEDURE mountain_linestring.flag();

Wyświetl plik

@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS mountain_peak_point;
CREATE TABLE IF NOT EXISTS mountain_peak_point.osm_ids
(
osm_id bigint
osm_id bigint PRIMARY KEY
);
-- etldoc: osm_peak_point -> osm_peak_point
@ -26,11 +26,7 @@ SELECT update_osm_peak_point(true);
CREATE OR REPLACE FUNCTION mountain_peak_point.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO mountain_peak_point.osm_ids VALUES (OLD.osm_id);
ELSE
INSERT INTO mountain_peak_point.osm_ids VALUES (NEW.osm_id);
END IF;
INSERT INTO mountain_peak_point.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@ -55,6 +51,11 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh mountain_peak_point';
-- Analyze tracking and source tables before performing update
ANALYZE mountain_peak_point.osm_ids;
ANALYZE osm_peak_point;
PERFORM update_osm_peak_point(false);
-- noinspection SqlWithoutWhere
DELETE FROM mountain_peak_point.osm_ids;
@ -67,13 +68,13 @@ END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_peak_point
FOR EACH ROW
EXECUTE PROCEDURE mountain_peak_point.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_peak_point
FOR EACH STATEMENT
EXECUTE PROCEDURE mountain_peak_point.flag();

Wyświetl plik

@ -27,10 +27,10 @@ FROM (
SELECT osm_id,
geometry,
COALESCE(
LOWER(REPLACE(NULLIF(protection_title, ''), ' ', '_')),
NULLIF(boundary, ''),
NULLIF(leisure, '')
) AS class,
LOWER(REPLACE(NULLIF(protection_title, ''), ' ', '_')),
NULLIF(boundary, ''),
NULLIF(leisure, ''))
AS class,
name,
name_en,
name_de,

Wyświetl plik

@ -1,25 +1,25 @@
layer:
id: "park"
description: |
The park layer contains parks from OpenStreetMap tagged with
[`boundary=national_park`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dnational_park),
[`boundary=protected_area`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dprotected_area),
or [`leisure=nature_reserve`](http://wiki.openstreetmap.org/wiki/Tag:leisure%3Dnature_reserve).
The park layer in OpenMapTiles contains natural and protected areas from OpenStreetMap,
such as parks tagged with [`boundary=national_park`](https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dnational_park),
[`boundary=protected_area`](https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dprotected_area),
or [`leisure=nature_reserve`](https://wiki.openstreetmap.org/wiki/Tag:leisure%3Dnature_reserve).
buffer_size: 4
fields:
class:
description: |
Use the **class** to differentiate between different parks.
The class for `boundary=protected_area` parks is the lower-case of the
[`protection_title`](http://wiki.openstreetmap.org/wiki/key:protection_title)
value with blanks replaced by `_`.
`national_park` is the class of `protection_title=National Park` and `boundary=national_park`.
`nature_reserve` is the class of `protection_title=Nature Reserve` and `leisure=nature_reserve`.
The class for other [`protection_title`](http://wiki.openstreetmap.org/wiki/key:protection_title)
values is similarly assigned.
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the park (point features only).
name_en: English name `name:en` if available, otherwise `name` (point features only).
name_de: German name `name:de` if available, otherwise `name` or `name:en` (point features only).
Use the **class** to differentiate between different kinds of features in the `parks` layer.
The class for `boundary=protected_area` parks is the lower-case of the
[`protection_title`](http://wiki.openstreetmap.org/wiki/key:protection_title)
value with blanks replaced by `_`.
`national_park` is the class of `protection_title=National Park` and `boundary=national_park`.
`nature_reserve` is the class of `protection_title=Nature Reserve` and `leisure=nature_reserve`.
The class for other [`protection_title`](http://wiki.openstreetmap.org/wiki/key:protection_title)
values is similarly assigned.
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the park (point features only). Language-specific values are in `name:xx`.
name_en: English name `name:en` if available, otherwise `name` (point features only). This is deprecated and will be removed in a future release in favor of `name:en`.
name_de: German name `name:de` if available, otherwise `name` or `name:en` (point features only). This is deprecated and will be removed in a future release in favor of `name:de`.
rank: Rank of the park within one tile, starting at 1 that is the most important park (point features only).
datasource:
geometry_field: geometry

Wyświetl plik

@ -105,7 +105,7 @@
2
]
],
"order": 186
"order": 195
}
]
}

Wyświetl plik

@ -24,14 +24,16 @@ DROP MATERIALIZED VIEW IF EXISTS osm_park_polygon_dissolve_z4 CASCADE;
CREATE MATERIALIZED VIEW osm_park_polygon_dissolve_z4 AS
(
SELECT min(osm_id) AS osm_id,
ST_Union(geometry) AS geometry
ST_Union(geometry) AS geometry,
boundary
FROM (
SELECT ST_ClusterDBSCAN(geometry, 0, 1) OVER() AS cluster,
osm_id,
geometry
geometry,
boundary
FROM osm_park_polygon_gen_z4
) park_cluster
GROUP BY cluster
GROUP BY boundary, cluster
);
CREATE UNIQUE INDEX IF NOT EXISTS osm_park_polygon_dissolve_idx ON osm_park_polygon_dissolve_z4 (osm_id);
@ -46,6 +48,8 @@ DROP TRIGGER IF EXISTS update_row ON osm_park_polygon_gen_z7;
DROP TRIGGER IF EXISTS update_row ON osm_park_polygon_gen_z6;
DROP TRIGGER IF EXISTS update_row ON osm_park_polygon_gen_z5;
DROP TRIGGER IF EXISTS update_row ON osm_park_polygon_gen_z4;
DROP TRIGGER IF EXISTS trigger_flag ON osm_park_polygon;
DROP TRIGGER IF EXISTS trigger_refresh ON park_polygon.updates;
-- etldoc: osm_park_polygon -> osm_park_polygon
-- etldoc: osm_park_polygon_gen_z13 -> osm_park_polygon_gen_z13
@ -63,43 +67,43 @@ $$
BEGIN
UPDATE osm_park_polygon
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_park_polygon_gen_z13
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_park_polygon_gen_z12
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_park_polygon_gen_z11
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_park_polygon_gen_z10
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_park_polygon_gen_z9
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_park_polygon_gen_z8
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_park_polygon_gen_z7
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_park_polygon_gen_z6
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
geometry_point = ST_PointOnSurface(geometry);
UPDATE osm_park_polygon_gen_z5
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
geometry_point = ST_PointOnSurface(geometry);
REFRESH MATERIALIZED VIEW CONCURRENTLY osm_park_polygon_dissolve_z4;
END;
@ -119,13 +123,49 @@ CREATE INDEX IF NOT EXISTS osm_park_polygon_gen_z5_point_geom_idx ON osm_park_po
CREATE INDEX IF NOT EXISTS osm_park_polygon_gen_z4_polygon_geom_idx ON osm_park_polygon_gen_z4 USING gist (geometry);
CREATE INDEX IF NOT EXISTS osm_park_polygon_dissolve_z4_polygon_geom_idx ON osm_park_polygon_dissolve_z4 USING gist (geometry);
CREATE SCHEMA IF NOT EXISTS park_polygon;
CREATE TABLE IF NOT EXISTS park_polygon.updates
(
id serial PRIMARY KEY,
t text,
UNIQUE (t)
);
CREATE OR REPLACE FUNCTION park_polygon.flag() RETURNS trigger AS
$$
BEGIN
INSERT INTO park_polygon.updates(t) VALUES ('y') ON CONFLICT(t) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION park_polygon.refresh() RETURNS trigger AS
$$
DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh park_polygon';
-- Analyze tracking and source tables before performing update
ANALYZE osm_park_polygon_gen_z4;
REFRESH MATERIALIZED VIEW osm_park_polygon_dissolve_z4;
-- noinspection SqlWithoutWhere
DELETE FROM park_polygon.updates;
RAISE LOG 'Refresh park_polygon done in %', age(clock_timestamp(), t);
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION update_osm_park_polygon_row()
RETURNS trigger
AS
$$
BEGIN
NEW.tags = update_tags(NEW.tags, NEW.geometry);
NEW.geometry_point = st_centroid(NEW.geometry);
NEW.geometry_point = ST_PointOnSurface(NEW.geometry);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
@ -206,3 +246,15 @@ CREATE TRIGGER update_row
FOR EACH ROW
EXECUTE PROCEDURE update_osm_park_dissolved_polygon_row();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
ON osm_park_polygon
FOR EACH STATEMENT
EXECUTE PROCEDURE park_polygon.flag();
CREATE CONSTRAINT TRIGGER trigger_refresh
AFTER INSERT
ON park_polygon.updates
INITIALLY DEFERRED
FOR EACH ROW
EXECUTE PROCEDURE park_polygon.refresh();

Wyświetl plik

@ -0,0 +1,14 @@
CREATE OR REPLACE FUNCTION area_rank(area real) RETURNS int AS
$$
SELECT CASE
WHEN area > 640000000 THEN 1
WHEN area > 160000000 THEN 2
WHEN area > 40000000 THEN 3
WHEN area > 15000000 THEN 4
WHEN area > 10000000 THEN 5
WHEN area > 0 THEN 6
ELSE 7
END;
$$ LANGUAGE SQL IMMUTABLE
STRICT
PARALLEL SAFE;

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 136 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 152 KiB

Wyświetl plik

@ -1,12 +0,0 @@
CREATE OR REPLACE FUNCTION island_rank(area real) RETURNS int AS
$$
SELECT CASE
WHEN area < 10000000 THEN 6
WHEN area BETWEEN 1000000 AND 15000000 THEN 5
WHEN area BETWEEN 15000000 AND 40000000 THEN 4
WHEN area > 40000000 THEN 3
ELSE 7
END;
$$ LANGUAGE SQL IMMUTABLE
STRICT
PARALLEL SAFE;

Wyświetl plik

@ -177,6 +177,7 @@ tables:
- town
- village
- hamlet
- borough
- suburb
- quarter
- neighbourhood

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 53 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 55 KiB

Wyświetl plik

@ -109,17 +109,39 @@ FROM (
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
tags,
'island' AS class,
island_rank(area) AS "rank",
area_rank(area) AS "rank",
NULL::int AS capital,
NULL::text AS iso_a2
FROM osm_island_polygon
WHERE geometry && bbox
AND ((zoom_level = 8 AND island_rank(area) <= 3)
OR (zoom_level = 9 AND island_rank(area) <= 4)
AND ((zoom_level = 8 AND area_rank(area) <= 3)
OR (zoom_level = 9 AND area_rank(area) <= 4)
OR (zoom_level >= 10))
UNION ALL
SELECT
-- etldoc: osm_boundary_polygon -> layer_place:z6_11
-- etldoc: osm_boundary_polygon -> layer_place:z12_14
osm_id * 10 AS osm_id,
geometry_point,
name,
NULL::text AS name_en, -- deprecated
NULL::text AS name_de, -- deprecated
tags,
'aboriginal_lands' AS class,
area_rank(area) AS "rank",
NULL::int AS capital,
NULL::text AS iso_a2
FROM osm_boundary_polygon
WHERE geometry_point && bbox
AND ((zoom_level = 6 AND area_rank(area) <= 1)
OR (zoom_level = 7 AND area_rank(area) <= 2)
OR (zoom_level = 8 AND area_rank(area) <= 3)
OR (zoom_level = 9 AND area_rank(area) <= 4)
OR (zoom_level >= 10))
UNION ALL
SELECT
-- etldoc: layer_city -> layer_place:z0_3
-- etldoc: layer_city -> layer_place:z4_7

Wyświetl plik

@ -5,6 +5,8 @@ layer:
- ne_10m_admin_1_states_provinces
- ne_10m_admin_0_countries
- ne_10m_populated_places
layers:
- boundary
description: |
The place layer consists out of [countries](http://wiki.openstreetmap.org/wiki/Tag:place%3Dcountry),
[states](http://wiki.openstreetmap.org/wiki/Tag:place%3Dstate), [cities](http://wiki.openstreetmap.org/wiki/Key:place)
@ -12,9 +14,9 @@ layer:
Apart from the roads this is also one of the more important layers to create a beautiful map.
We suggest you use different font styles and sizes to create a text hierarchy.
fields:
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI.
name_en: English name `name:en` if available, otherwise `name`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the place. Language-specific values are in `name:xx`.
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
capital:
description: |
The **capital** field marks the
@ -28,7 +30,9 @@ layer:
Distinguish between continents, countries, states, islands and
places like settlements or smaller entities.
Use **class** to separately style the different places and build
a text hierarchy according to their importance.
a text hierarchy according to their importance. For places derived
from boundaries, the original value of the
[`boundary`](http://wiki.openstreetmap.org/wiki/Key:boundary) tag.
values:
- continent
- country
@ -38,11 +42,13 @@ layer:
- town
- village
- hamlet
- borough
- suburb
- quarter
- neighbourhood
- isolated_dwelling
- island
- aboriginal_lands
iso_a2:
description: |
Two-letter country code [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). Available only for `class=country`.
@ -74,7 +80,7 @@ schema:
- ./types.sql
- ./capital.sql
- ./city.sql
- ./island_rank.sql
- ./area_rank.sql
- ./update_continent_point.sql
- ./update_country_point.sql
- ./update_island_polygon.sql

Wyświetl plik

@ -82,10 +82,11 @@
"island",
"islet",
"neighbourhood",
"suburb"
"suburb",
"borough"
]
],
"order": 184
"order": 193
},
{
"id": "place_village",
@ -128,7 +129,7 @@
"village"
]
],
"order": 189
"order": 199
},
{
"id": "place_town",
@ -176,7 +177,7 @@
"town"
]
],
"order": 190
"order": 200
},
{
"id": "place_state",
@ -227,7 +228,7 @@
3
]
],
"order": 191
"order": 201
},
{
"id": "place_city",
@ -310,7 +311,7 @@
1
]
],
"order": 192
"order": 202
},
{
"id": "place_capital",
@ -395,7 +396,7 @@
2
]
],
"order": 193
"order": 203
},
{
"id": "country_other",
@ -448,7 +449,7 @@
"iso_a2"
]
],
"order": 194
"order": 204
},
{
"id": "country_3",
@ -517,7 +518,7 @@
"iso_a2"
]
],
"order": 195
"order": 205
},
{
"id": "country_2",
@ -586,7 +587,7 @@
"iso_a2"
]
],
"order": 196
"order": 206
},
{
"id": "country_1",
@ -655,7 +656,7 @@
"iso_a2"
]
],
"order": 197
"order": 207
}
]
}

Wyświetl plik

@ -4,7 +4,7 @@ $$
PERFORM 'city_place'::regtype;
EXCEPTION
WHEN undefined_object THEN
CREATE TYPE city_place AS enum ('city', 'town', 'village', 'hamlet', 'suburb', 'quarter', 'neighbourhood', 'isolated_dwelling');
CREATE TYPE city_place AS enum ('city', 'town', 'village', 'hamlet', 'borough', 'suburb', 'quarter', 'neighbourhood', 'isolated_dwelling');
END
$$;

Wyświetl plik

@ -8,7 +8,7 @@ CREATE SCHEMA IF NOT EXISTS place_city;
CREATE TABLE IF NOT EXISTS place_city.osm_ids
(
osm_id bigint
osm_id bigint PRIMARY KEY
);
CREATE OR REPLACE FUNCTION update_osm_city_point(full_update boolean) RETURNS void AS
@ -49,18 +49,12 @@ $$ LANGUAGE SQL;
SELECT update_osm_city_point(true);
CREATE INDEX IF NOT EXISTS osm_city_point_rank_idx ON osm_city_point ("rank");
-- Handle updates
CREATE OR REPLACE FUNCTION place_city.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO place_city.osm_ids VALUES (OLD.osm_id);
ELSE
INSERT INTO place_city.osm_ids VALUES (NEW.osm_id);
END IF;
INSERT INTO place_city.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@ -85,6 +79,11 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh place_city rank';
-- Analyze tracking and source tables before performing update
ANALYZE place_city.osm_ids;
ANALYZE osm_city_point;
PERFORM update_osm_city_point(false);
-- noinspection SqlWithoutWhere
DELETE FROM place_city.osm_ids;
@ -97,13 +96,13 @@ END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_city_point
FOR EACH ROW
EXECUTE PROCEDURE place_city.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_city_point
FOR EACH STATEMENT
EXECUTE PROCEDURE place_city.flag();

Wyświetl plik

@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS place_continent_point;
CREATE TABLE IF NOT EXISTS place_continent_point.osm_ids
(
osm_id bigint
osm_id bigint PRIMARY KEY
);
-- etldoc: osm_continent_point -> osm_continent_point
@ -26,11 +26,7 @@ SELECT update_osm_continent_point(true);
CREATE OR REPLACE FUNCTION place_continent_point.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO place_continent_point.osm_ids VALUES (OLD.osm_id);
ELSE
INSERT INTO place_continent_point.osm_ids VALUES (NEW.osm_id);
END IF;
INSERT INTO place_continent_point.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@ -55,6 +51,11 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh place_continent_point';
-- Analyze tracking and source tables before performing update
ANALYZE place_continent_point.osm_ids;
ANALYZE osm_continent_point;
PERFORM update_osm_continent_point(false);
-- noinspection SqlWithoutWhere
DELETE FROM place_continent_point.osm_ids;
@ -67,13 +68,13 @@ END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_continent_point
FOR EACH ROW
EXECUTE PROCEDURE place_continent_point.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_continent_point
FOR EACH STATEMENT
EXECUTE PROCEDURE place_continent_point.flag();

Wyświetl plik

@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS place_country;
CREATE TABLE IF NOT EXISTS place_country.osm_ids
(
osm_id bigint
osm_id bigint PRIMARY KEY
);
-- etldoc: ne_10m_admin_0_countries -> osm_country_point
@ -98,18 +98,12 @@ $$ LANGUAGE SQL;
SELECT update_osm_country_point(true);
CREATE INDEX IF NOT EXISTS osm_country_point_rank_idx ON osm_country_point ("rank");
-- Handle updates
CREATE OR REPLACE FUNCTION place_country.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO place_country.osm_ids VALUES (OLD.osm_id);
ELSE
INSERT INTO place_country.osm_ids VALUES (NEW.osm_id);
END IF;
INSERT INTO place_country.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@ -134,6 +128,11 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh place_country rank';
-- Analyze tracking and source tables before performing update
ANALYZE place_country.osm_ids;
ANALYZE osm_country_point;
PERFORM update_osm_country_point(false);
-- noinspection SqlWithoutWhere
DELETE FROM place_country.osm_ids;
@ -146,13 +145,13 @@ END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_country_point
FOR EACH ROW
EXECUTE PROCEDURE place_country.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_country_point
FOR EACH STATEMENT
EXECUTE PROCEDURE place_country.flag();

Wyświetl plik

@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS place_island_point;
CREATE TABLE IF NOT EXISTS place_island_point.osm_ids
(
osm_id bigint
osm_id bigint PRIMARY KEY
);
-- etldoc: osm_island_point -> osm_island_point
@ -26,11 +26,7 @@ SELECT update_osm_island_point(true);
CREATE OR REPLACE FUNCTION place_island_point.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO place_island_point.osm_ids VALUES (OLD.osm_id);
ELSE
INSERT INTO place_island_point.osm_ids VALUES (NEW.osm_id);
END IF;
INSERT INTO place_island_point.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@ -55,6 +51,11 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh place_island_point';
-- Analyze tracking and source tables before performing update
ANALYZE place_island_point.osm_ids;
ANALYZE osm_island_point;
PERFORM update_osm_island_point(false);
-- noinspection SqlWithoutWhere
DELETE FROM place_island_point.osm_ids;
@ -67,13 +68,13 @@ END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_island_point
FOR EACH ROW
EXECUTE PROCEDURE place_island_point.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_island_point
FOR EACH STATEMENT
EXECUTE PROCEDURE place_island_point.flag();

Wyświetl plik

@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS place_island_polygon;
CREATE TABLE IF NOT EXISTS place_island_polygon.osm_ids
(
osm_id bigint
osm_id bigint PRIMARY KEY
);
-- etldoc: osm_island_polygon -> osm_island_polygon
@ -33,11 +33,7 @@ SELECT update_osm_island_polygon(true);
CREATE OR REPLACE FUNCTION place_island_polygon.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO place_island_polygon.osm_ids VALUES (OLD.osm_id);
ELSE
INSERT INTO place_island_polygon.osm_ids VALUES (NEW.osm_id);
END IF;
INSERT INTO place_island_polygon.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@ -62,6 +58,11 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh place_island_polygon';
-- Analyze tracking and source tables before performing update
ANALYZE place_island_polygon.osm_ids;
ANALYZE osm_island_polygon;
PERFORM update_osm_island_polygon(false);
-- noinspection SqlWithoutWhere
DELETE FROM place_island_polygon.osm_ids;
@ -74,13 +75,13 @@ END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_island_polygon
FOR EACH ROW
EXECUTE PROCEDURE place_island_polygon.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_island_polygon
FOR EACH STATEMENT
EXECUTE PROCEDURE place_island_polygon.flag();

Wyświetl plik

@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS place_state;
CREATE TABLE IF NOT EXISTS place_state.osm_ids
(
osm_id bigint
osm_id bigint PRIMARY KEY
);
-- etldoc: ne_10m_admin_1_states_provinces -> osm_state_point
@ -60,18 +60,12 @@ $$ LANGUAGE SQL;
SELECT update_osm_state_point(true);
CREATE INDEX IF NOT EXISTS osm_state_point_rank_idx ON osm_state_point ("rank");
-- Handle updates
CREATE OR REPLACE FUNCTION place_state.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO place_state.osm_ids VALUES (OLD.osm_id);
ELSE
INSERT INTO place_state.osm_ids VALUES (NEW.osm_id);
END IF;
INSERT INTO place_state.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@ -96,6 +90,11 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh place_state rank';
-- Analyze tracking and source tables before performing update
ANALYZE place_state.osm_ids;
ANALYZE osm_state_point;
PERFORM update_osm_state_point(false);
-- noinspection SqlWithoutWhere
DELETE FROM place_state.osm_ids;
@ -108,13 +107,13 @@ END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_state_point
FOR EACH ROW
EXECUTE PROCEDURE place_state.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_state_point
FOR EACH STATEMENT
EXECUTE PROCEDURE place_state.flag();

Wyświetl plik

@ -33,6 +33,8 @@ CREATE OR REPLACE FUNCTION poi_class(subclass text, mapping_key text)
RETURNS text AS
$$
SELECT CASE
-- Special case subclass collision between office=university and amenity=university
WHEN mapping_key = 'amenity' AND subclass = 'university' THEN 'college'
%%FIELD_MAPPING: class %%
ELSE subclass
END;

Wyświetl plik

@ -18,6 +18,7 @@ def_poi_mapping_amenity: &poi_mapping_amenity
- biergarten
- bus_station
- cafe
- charging_station
- cinema
- clinic
- college
@ -118,7 +119,66 @@ def_poi_mapping_leisure: &poi_mapping_leisure
# office values , see http://taginfo.openstreetmap.org/keys/office#values
def_poi_mapping_office: &poi_mapping_office
- accountant
- advertising_agency
- architect
- association
- bail_bond_agent
- charity
- company
- construction_company
- consulting
- cooperative
- courier
- coworking
- diplomatic
- educational_institution
- employment_agency
- energy_supplier
- engineer
- estate_agent
- financial
- financial_advisor
- forestry
- foundation
- geodesist
- government
- graphic_design
- guide
- harbour_master
- health_insurance
- insurance
- interior_design
- it
- lawyer
- logistics
- marketing
- moving_company
- newspaper
- ngo
- notary
- physician
- political_party
- private_investigator
- property_management
- publisher
- quango
- religion
- research
- security
- surveyor
- tax_advisor
- taxi
- telecommunication
- therapist
- translator
- travel_agent
- tutoring
- union
- university
- water_utility
- web_design
- wedding_planner
# railway values , see http://taginfo.openstreetmap.org/keys/railway#values
def_poi_mapping_railway: &poi_mapping_railway
@ -193,6 +253,7 @@ def_poi_mapping_shop: &poi_mapping_shop
- newsagent
- optician
- outdoor
- paint
- perfume
- perfumery
- pet
@ -327,6 +388,8 @@ def_poi_fields: &poi_fields
type: id
- name: geometry
type: geometry
- name: area
type: area
- name: name
key: name
type: string

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 1.4 MiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.7 MiB

Wyświetl plik

@ -68,20 +68,6 @@ FROM (
-- etldoc: osm_poi_polygon -> layer_poi:z12
-- etldoc: osm_poi_polygon -> layer_poi:z13
SELECT *,
NULL::integer AS agg_stop,
CASE
WHEN osm_id < 0 THEN -osm_id * 10 + 4
ELSE osm_id * 10 + 1
END AS osm_id_hash
FROM osm_poi_polygon
WHERE geometry && bbox
AND zoom_level BETWEEN 12 AND 13
AND ((subclass = 'station' AND mapping_key = 'railway')
OR subclass IN ('halt', 'ferry_terminal'))
UNION ALL
-- etldoc: osm_poi_polygon -> layer_poi:z14_
SELECT *,
NULL::integer AS agg_stop,
@ -90,8 +76,21 @@ FROM (
ELSE osm_id * 10 + 1
END AS osm_id_hash
FROM osm_poi_polygon
WHERE geometry && bbox
AND zoom_level >= 14
WHERE geometry && bbox AND
CASE
WHEN zoom_level >= 14 THEN TRUE
WHEN zoom_level >= 12 AND
((subclass = 'station' AND mapping_key = 'railway')
OR subclass IN ('halt', 'ferry_terminal')) THEN TRUE
WHEN zoom_level BETWEEN 10 AND 14 THEN
subclass IN ('university', 'college') AND
POWER(4,zoom_level)
-- Compute percentage of the earth's surface covered by this feature (approximately)
-- The constant below is 111,842^2 * 180 * 180, where 111,842 is the length of one degree of latitude at the equator in meters.
* area / (405279708033600 * COS(ST_Y(ST_Transform(geometry,4326))*PI()/180))
-- Match features that are at least 10% of a tile at this zoom
> 0.10
ELSE FALSE END
) AS poi_union
ORDER BY "rank"
$$ LANGUAGE SQL STABLE

Wyświetl plik

@ -6,9 +6,9 @@ layer:
buffer_size: 64
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
fields:
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI.
name_en: English name `name:en` if available, otherwise `name`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI. Language-specific values are in `name:xx`.
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
class:
description: |
More general classes of POIs. If there is no more general `class` for the `subclass`
@ -17,14 +17,24 @@ layer:
and `kindergarten`. Or use the class `shop` to style all shops.
values:
shop:
subclass: ['accessories', 'antiques', 'beauty', 'bed', 'boutique', 'camera', 'carpet', 'charity', 'chemist',
'coffee', 'computer', 'convenience', 'copyshop', 'cosmetics', 'garden_centre', 'doityourself',
subclass: ['accessories', 'antiques', 'beauty', 'bed', 'boutique', 'camera', 'carpet', 'charity', 'chemist', 'chocolate',
'coffee', 'computer', 'convenience', 'confectionery', 'copyshop', 'cosmetics', 'garden_centre', 'doityourself',
'erotic', 'electronics', 'fabric', 'florist', 'frozen_food', 'furniture', 'video_games', 'video',
'general', 'gift', 'hardware', 'hearing_aids', 'hifi', 'ice_cream', 'interior_decoration',
'jewelry', 'kiosk', 'locksmith', 'lamps', 'mall', 'massage', 'motorcycle', 'mobile_phone',
'newsagent', 'optician', 'outdoor', 'perfumery', 'perfume', 'pet', 'photo', 'second_hand',
'shoes', 'sports', 'stationery', 'tailor', 'tattoo', 'ticket', 'tobacco', 'toys', 'travel_agency',
'general', 'gift', 'hardware', 'hearing_aids', 'hifi', 'interior_decoration',
'jewelry', 'kiosk', 'locksmith', 'lamps', 'mall', 'massage', 'motorcycle', 'mobile_phone',
'newsagent', 'optician', 'outdoor', 'paint', 'perfumery', 'perfume', 'pet', 'photo', 'second_hand',
'shoes', 'sports', 'stationery', 'tailor', 'tattoo', 'ticket', 'tobacco', 'toys', 'travel_agency',
'watches', 'weapons', 'wholesale']
office:
subclass: ['accountant', 'advertising_agency', 'architect', 'association', 'bail_bond_agent', 'charity',
'company', 'construction_company', 'consulting', 'cooperative', 'courier', 'coworking', 'diplomatic',
'educational_institution', 'employment_agency', 'energy_supplier', 'engineer', 'estate_agent', 'financial',
'financial_advisor', 'forestry', 'foundation', 'geodesist', 'government', 'graphic_design', 'guide',
'harbour_master', 'health_insurance', 'insurance', 'interior_design', 'it', 'lawyer', 'logistics', 'marketing',
'moving_company', 'newspaper', 'ngo', 'notary', 'physician', 'political_party', 'private_investigator',
'property_management', 'publisher', 'quango', 'religion', 'research', 'security', 'surveyor', 'tax_advisor',
'taxi', 'telecommunication', 'therapist', 'translator', 'travel_agent', 'tutoring', 'union', 'university',
'water_utility', 'web_design', 'wedding_planner']
town_hall:
subclass: ['townhall', 'public_building', 'courthouse', 'community_centre']
golf:
@ -59,7 +69,7 @@ layer:
lodging:
subclass: ['hotel', 'motel', 'bed_and_breakfast', 'guest_house', 'hostel', 'chalet', 'alpine_hut', 'dormitory']
ice_cream:
subclass: ['chocolate', 'confectionery']
subclass: ['ice_cream']
post:
subclass: ['post_box', 'post_office', 'parcel_locker']
cafe:
@ -96,6 +106,8 @@ layer:
subclass: ['castle', 'ruins']
atm:
subclass: ['atm']
fuel:
subclass: ['fuel', 'charging_station']
subclass:
description: |
Original value of either the

Wyświetl plik

@ -22,7 +22,37 @@
]
]
},
"icon-image": "{subclass}",
"icon-image": [
"coalesce",
[
"image",
[
"match",
[
"get",
"subclass"
],
"chocolate",
"confectionery",
"wine",
"alcohol",
"kiosk",
"newsagent",
"perfume",
"perfumery",
"wholesale",
"trade",
[
"get",
"subclass"
]
]
],
[
"image",
"shop"
]
],
"text-field": "{name:latin}\n{name:nonlatin}",
"visibility": "visible",
"text-anchor": "top",
@ -35,16 +65,7 @@
"icon-allow-overlap": true
},
"paint": {
"text-color": [
"match",
[
"get",
"class"
],
"ice_cream",
"#C77400",
"#939"
],
"text-color": "#939",
"icon-opacity": 1,
"icon-halo-blur": 1,
"text-halo-blur": 0.5,
@ -72,10 +93,12 @@
"subclass",
"mall",
"library",
"artwork"
"artwork",
"arts_centre",
"gallery"
]
],
"order": 146
"order": 155
},
{
"id": "poi_shop-z15",
@ -99,7 +122,19 @@
]
]
},
"icon-image": "{subclass}",
"icon-image": [
"match",
[
"get",
"subclass"
],
"chocolate",
"confectionery",
[
"get",
"subclass"
]
],
"text-field": "{name:latin}\n{name:nonlatin}",
"visibility": "visible",
"text-anchor": "top",
@ -112,16 +147,7 @@
"icon-allow-overlap": true
},
"paint": {
"text-color": [
"match",
[
"get",
"class"
],
"ice_cream",
"#C77400",
"#939"
],
"text-color": "#939",
"icon-opacity": 1,
"icon-halo-blur": 1,
"text-halo-blur": 0.5,
@ -139,7 +165,7 @@
"supermarket"
]
],
"order": 147
"order": 156
},
{
"id": "poi_waste",
@ -197,7 +223,7 @@
"toilets"
]
],
"order": 148
"order": 157
},
{
"id": "poi_cemetery",
@ -253,7 +279,7 @@
"cemetery"
]
],
"order": 149
"order": 158
},
{
"id": "poi_school",
@ -312,7 +338,7 @@
"school"
]
],
"order": 150
"order": 159
},
{
"id": "poi_outdoor",
@ -367,7 +393,7 @@
"gate"
]
],
"order": 151
"order": 160
},
{
"id": "poi_parking",
@ -433,7 +459,7 @@
"parking"
]
],
"order": 152
"order": 161
},
{
"id": "poi_golf",
@ -488,7 +514,7 @@
"golf"
]
],
"order": 153
"order": 162
},
{
"id": "poi_sport",
@ -544,7 +570,7 @@
"water_park"
]
],
"order": 154
"order": 163
},
{
"id": "poi_ferry",
@ -604,7 +630,7 @@
"ferry_terminal"
]
],
"order": 155
"order": 164
},
{
"id": "poi_food",
@ -664,7 +690,7 @@
"restaurant"
]
],
"order": 156
"order": 165
},
{
"id": "poi_water",
@ -719,7 +745,7 @@
"ice_rink"
]
],
"order": 157
"order": 166
},
{
"id": "poi_public",
@ -743,7 +769,27 @@
]
]
},
"icon-image": "{subclass}",
"icon-image": [
"coalesce",
[
"image",
[
"get",
"subclass"
]
],
[
"image",
[
"get",
"class"
]
],
[
"image",
""
]
],
"text-field": "{name:latin}\n{name:nonlatin}",
"visibility": "visible",
"text-anchor": "top",
@ -778,7 +824,8 @@
"information",
"cinema",
"theatre",
"fire_station"
"fire_station",
"office"
],
[
"!=",
@ -786,7 +833,7 @@
"books"
]
],
"order": 158
"order": 167
},
{
"id": "poi_cultural",
@ -840,7 +887,6 @@
"class",
"cinema",
"library",
"music",
"museum",
"castle",
"monument",
@ -850,12 +896,10 @@
"!in",
"subclass",
"books",
"musical_instrument",
"art",
"gallery"
"art"
]
],
"order": 159
"order": 168
},
{
"id": "poi_attraction",
@ -910,7 +954,7 @@
"attraction"
]
],
"order": 160
"order": 169
},
{
"id": "poi_car",
@ -976,10 +1020,11 @@
"class",
"car",
"bicycle_parking",
"fuel"
"fuel",
"charging_station"
]
],
"order": 161
"order": 170
},
{
"id": "poi_health",
@ -1037,7 +1082,7 @@
"veterinary"
]
],
"order": 162
"order": 171
},
{
"id": "poi_hospital",
@ -1103,7 +1148,7 @@
"hospital"
]
],
"order": 163
"order": 172
},
{
"id": "poi_campsite",
@ -1158,7 +1203,7 @@
"campsite"
]
],
"order": 164
"order": 173
},
{
"id": "poi_accommodation",
@ -1225,7 +1270,7 @@
"campsite"
]
],
"order": 165
"order": 174
},
{
"id": "poi_place_of_worship",
@ -1289,7 +1334,7 @@
"place_of_worship"
]
],
"order": 166
"order": 175
},
{
"id": "poi_busstop",
@ -1350,7 +1395,7 @@
"bus"
]
],
"order": 167
"order": 176
},
{
"id": "poi_bus",
@ -1410,7 +1455,7 @@
"bus_stop"
]
],
"order": 168
"order": 177
},
{
"id": "poi_harbor",
@ -1460,7 +1505,7 @@
"harbor"
]
],
"order": 169
"order": 178
},
{
"id": "poi_mall",
@ -1519,7 +1564,7 @@
"mall"
]
],
"order": 170
"order": 179
},
{
"id": "poi_train",
@ -1578,7 +1623,7 @@
"railway"
]
],
"order": 171
"order": 180
},
{
"id": "park-local",
@ -1638,7 +1683,7 @@
"park"
]
],
"order": 185
"order": 194
},
{
"id": "poi_zoo",
@ -1698,7 +1743,7 @@
"zoo"
]
],
"order": 187
"order": 196
}
]
}

Wyświetl plik

@ -1,18 +1,28 @@
DROP TRIGGER IF EXISTS trigger_flag ON osm_poi_point;
DROP TRIGGER IF EXISTS trigger_refresh ON poi_point.updates;
DROP TRIGGER IF EXISTS trigger_store ON osm_poi_point;
CREATE SCHEMA IF NOT EXISTS poi_point;
CREATE TABLE IF NOT EXISTS poi_point.osm_ids
(
osm_id bigint PRIMARY KEY
);
-- etldoc: osm_poi_point -> osm_poi_point
CREATE OR REPLACE FUNCTION update_osm_poi_point() RETURNS void AS
CREATE OR REPLACE FUNCTION update_osm_poi_point(full_update bool) RETURNS void AS
$$
BEGIN
UPDATE osm_poi_point
SET subclass = 'subway'
WHERE station = 'subway'
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
AND station = 'subway'
AND subclass = 'station';
UPDATE osm_poi_point
SET subclass = 'halt'
WHERE funicular = 'yes'
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
AND funicular = 'yes'
AND subclass = 'station';
-- ATM without name
@ -23,7 +33,8 @@ BEGIN
COALESCE(tags -> 'operator', tags -> 'network'),
tags || hstore('name', COALESCE(tags -> 'operator', tags -> 'network'))
)
WHERE subclass = 'atm'
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
AND subclass = 'atm'
AND name = ''
AND COALESCE(tags -> 'operator', tags -> 'network') IS NOT NULL;
@ -32,22 +43,24 @@ BEGIN
-- (using name for parcel lockers is discouraged, see osm wiki)
UPDATE osm_poi_point
SET (name, tags) = (
CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref')),
tags || hstore('name', CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref')))
TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))),
tags || hstore('name', TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))))
)
WHERE subclass = 'parcel_locker'
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
AND subclass IN ('parcel_locker', 'charging_station')
AND name = ''
AND COALESCE(tags -> 'brand', tags -> 'operator') IS NOT NULL;
UPDATE osm_poi_point
SET tags = update_tags(tags, geometry)
WHERE COALESCE(tags->'name:latin', tags->'name:nonlatin', tags->'name_int') IS NULL
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
AND COALESCE(tags->'name:latin', tags->'name:nonlatin', tags->'name_int') IS NULL
AND tags != update_tags(tags, geometry);
END;
$$ LANGUAGE plpgsql;
SELECT update_osm_poi_point();
SELECT update_osm_poi_point(TRUE);
-- etldoc: osm_poi_stop_rank -> osm_poi_point
CREATE OR REPLACE FUNCTION update_osm_poi_point_agg() RETURNS void AS
@ -60,7 +73,7 @@ BEGIN
THEN 1
END
WHERE
agg_stop != CASE
agg_stop IS DISTINCT FROM CASE
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
THEN 1
END;
@ -70,15 +83,15 @@ BEGIN
agg_stop = (
CASE
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
AND r.rk IS NULL OR r.rk = 1
AND (r.rk IS NULL OR r.rk = 1)
THEN 1
END)
FROM osm_poi_stop_rank r
WHERE p.osm_id = r.osm_id AND
agg_stop != (
agg_stop IS DISTINCT FROM (
CASE
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
AND r.rk IS NULL OR r.rk = 1
AND (r.rk IS NULL OR r.rk = 1)
THEN 1
END);
@ -91,7 +104,13 @@ SELECT update_osm_poi_point_agg();
-- Handle updates
CREATE SCHEMA IF NOT EXISTS poi_point;
CREATE OR REPLACE FUNCTION poi_point.store() RETURNS trigger AS
$$
BEGIN
INSERT INTO poi_point.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE TABLE IF NOT EXISTS poi_point.updates
(
@ -113,11 +132,18 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh poi_point';
PERFORM update_osm_poi_point();
-- Analyze tracking and source tables before performing update
ANALYZE poi_point.osm_ids;
ANALYZE osm_poi_point;
PERFORM update_osm_poi_point(FALSE);
REFRESH MATERIALIZED VIEW osm_poi_stop_centroid;
REFRESH MATERIALIZED VIEW osm_poi_stop_rank;
PERFORM update_osm_poi_point_agg();
-- noinspection SqlWithoutWhere
DELETE FROM poi_point.osm_ids;
-- noinspection SqlWithoutWhere
DELETE FROM poi_point.updates;
RAISE LOG 'Refresh poi_point done in %', age(clock_timestamp(), t);
@ -125,8 +151,14 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE
ON osm_poi_point
FOR EACH ROW
EXECUTE PROCEDURE poi_point.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_poi_point
FOR EACH STATEMENT
EXECUTE PROCEDURE poi_point.flag();

Wyświetl plik

@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS poi_polygon;
CREATE TABLE IF NOT EXISTS poi_polygon.osm_ids
(
osm_id bigint
osm_id bigint PRIMARY KEY
);
-- etldoc: osm_poi_polygon -> osm_poi_polygon
@ -36,6 +36,19 @@ $$
AND funicular = 'yes'
AND subclass = 'station';
-- Parcel locker and charging_station without name
-- use either brand or operator and add ref if present
-- (using name for parcel lockers is discouraged, see osm wiki)
UPDATE osm_poi_polygon
SET (name, tags) = (
TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))),
tags || hstore('name', TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))))
)
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_polygon.osm_ids))
AND subclass IN ('parcel_locker', 'charging_station')
AND name = ''
AND COALESCE(tags -> 'brand', tags -> 'operator') IS NOT NULL;
UPDATE osm_poi_polygon
SET tags = update_tags(tags, geometry)
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_polygon.osm_ids))
@ -51,11 +64,7 @@ SELECT update_poi_polygon(true);
CREATE OR REPLACE FUNCTION poi_polygon.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO poi_polygon.osm_ids VALUES (OLD.osm_id);
ELSE
INSERT INTO poi_polygon.osm_ids VALUES (NEW.osm_id);
END IF;
INSERT INTO poi_polygon.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@ -80,6 +89,11 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh poi_polygon';
-- Analyze tracking and source tables before performing update
ANALYZE poi_polygon.osm_ids;
ANALYZE osm_poi_polygon;
PERFORM update_poi_polygon(false);
-- noinspection SqlWithoutWhere
DELETE FROM poi_polygon.osm_ids;
@ -92,13 +106,13 @@ END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_poi_polygon
FOR EACH ROW
EXECUTE PROCEDURE poi_polygon.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_poi_polygon
FOR EACH STATEMENT
EXECUTE PROCEDURE poi_polygon.flag();

Wyświetl plik

@ -48,7 +48,7 @@ CREATE OR REPLACE FUNCTION surface_value(surface text) RETURNS text AS
$$
SELECT CASE
WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'concrete', 'concrete:lanes', 'concrete:plates', 'metal',
'paving_stones', 'sett', 'unhewn_cobblestone', 'wood') THEN 'paved'
'paving_stones', 'sett', 'unhewn_cobblestone', 'wood', 'grade1') THEN 'paved'
WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel',
'gravel_turf', 'ground', 'ice', 'mud', 'pebblestone', 'salt', 'sand', 'snow', 'woodchips')
THEN 'unpaved'

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 538 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 865 KiB

Wyświetl plik

@ -31,6 +31,48 @@ generalized_tables:
sql_filter: ST_IsValid(geometry)
tolerance: ZRES13
# etldoc: osm_shipway_linestring_gen_z5 -> osm_shipway_linestring_gen_z4
shipway_linestring_gen_z4:
source: shipway_linestring_gen_z5
sql_filter: ST_Length(geometry)>2*ZRES0
tolerance: ZRES5
# etldoc: osm_shipway_linestring_gen_z6 -> osm_shipway_linestring_gen_z5
shipway_linestring_gen_z5:
source: shipway_linestring_gen_z6
sql_filter: ST_Length(geometry)>ZRES0
tolerance: ZRES6
# etldoc: osm_shipway_linestring_gen_z7 -> osm_shipway_linestring_gen_z6
shipway_linestring_gen_z6:
source: shipway_linestring_gen_z7
sql_filter: ST_Length(geometry)>ZRES1
tolerance: ZRES7
# etldoc: osm_shipway_linestring_gen_z8 -> osm_shipway_linestring_gen_z7
shipway_linestring_gen_z7:
source: shipway_linestring_gen_z8
sql_filter: ST_Length(geometry)>ZRES2
tolerance: ZRES8
# etldoc: osm_shipway_linestring_gen_z9 -> osm_shipway_linestring_gen_z8
shipway_linestring_gen_z8:
source: shipway_linestring_gen_z9
sql_filter: ST_Length(geometry)>ZRES3
tolerance: ZRES9
# etldoc: osm_shipway_linestring_gen_z10 -> osm_shipway_linestring_gen_z9
shipway_linestring_gen_z9:
source: shipway_linestring_gen_z10
sql_filter: ST_Length(geometry)>ZRES4
tolerance: ZRES10
# etldoc: osm_shipway_linestring_gen_z11 -> osm_shipway_linestring_gen_z10
shipway_linestring_gen_z10:
source: shipway_linestring_gen_z11
sql_filter: ST_Length(geometry)>ZRES5
tolerance: ZRES11
# etldoc: osm_shipway_linestring_gen_z12 -> osm_shipway_linestring_gen_z11
shipway_linestring_gen_z11:
source: shipway_linestring_gen_z12
@ -60,10 +102,6 @@ name_de_field: &name_de
name: name_de
key: name:de
type: string
short_name_field: &short_name
key: short_name
name: short_name
type: string
tunnel_field: &tunnel
key: tunnel
name: is_tunnel
@ -180,6 +218,9 @@ tables:
- name: construction
key: construction
type: string
- name: tracktype
key: tracktype
type: string
- *ref
- *network
- *z_order
@ -191,7 +232,6 @@ tables:
- *name_de
- name: tags
type: hstore_tags
- *short_name
- *tunnel
- *bridge
- *ramp
@ -271,12 +311,10 @@ tables:
- *name_de
- name: tags
type: hstore_tags
- *short_name
- *tunnel
- *bridge
- *ramp
- *ford
- *oneway
- *area
- *service
- *usage
@ -310,7 +348,6 @@ tables:
- *name_de
- name: tags
type: hstore_tags
- *short_name
- *tunnel
- *bridge
- *ramp
@ -349,12 +386,10 @@ tables:
- *name_de
- name: tags
type: hstore_tags
- *short_name
- *tunnel
- *bridge
- *ramp
- *ford
- *oneway
- *area
- *service
- *usage
@ -448,6 +483,9 @@ tables:
- name: colour
key: colour
type: string
- name: ref_colour
key: ref:colour
type: string
mapping:
route:
- road

Wyświetl plik

@ -15,20 +15,43 @@ $$
WHEN undefined_object THEN
CREATE TYPE route_network_type AS enum (
'us-interstate', 'us-highway', 'us-state',
'ca-transcanada',
'gb-motorway', 'gb-trunk'
'ca-transcanada', 'ca-provincial-arterial', 'ca-provincial',
'gb-motorway', 'gb-trunk', 'gb-primary',
'ie-motorway', 'ie-national', 'ie-regional',
'e-road',
'a-road'
);
END
$$;
DO
-- Top-level national route networks that should display at the lowest zooms
CREATE OR REPLACE FUNCTION osm_national_network(network text) RETURNS boolean AS
$$
BEGIN
BEGIN
ALTER TABLE osm_route_member
ADD COLUMN network_type route_network_type;
EXCEPTION
WHEN duplicate_column THEN RAISE NOTICE 'column network_type already exists in network_type.';
END;
END;
$$;
SELECT network <> '' AND network IN (
-- Canada
'ca-transcanada', 'ca-provincial-arterial',
-- United States
'us-interstate', 'us-highway',
-- UK
'gb-motorway', 'gb-trunk',
-- Ireland
'ie-motorway', 'ie-national',
-- Europe
'e-road',
-- Asia
'a-road'
);
$$ LANGUAGE sql IMMUTABLE
PARALLEL SAFE;
CREATE OR REPLACE FUNCTION create_route_hstore(network TEXT, ref TEXT, name TEXT, colour TEXT, ref_colour TEXT)
RETURNS hstore AS $$
SELECT CASE
WHEN network = '' THEN hstore('')
ELSE hstore(
ARRAY['network', 'ref', 'name', 'colour'],
ARRAY[network, NULLIF(ref, ''), NULLIF(name, ''), COALESCE(NULLIF(colour, ''), NULLIF(ref_colour, ''))]
)
END;
$$ LANGUAGE sql IMMUTABLE
PARALLEL SAFE;

Wyświetl plik

@ -62,7 +62,7 @@ SELECT osm_id,
NULLIF(service, '') AS service,
access,
CASE WHEN toll = TRUE THEN 1 END AS toll,
CASE WHEN highway NOT IN ('', 'motorway') AND expressway = TRUE THEN 1 END AS expressway,
CASE WHEN highway NOT IN ('', 'motorway') AND NOT is_ramp AND expressway = TRUE THEN 1 END AS expressway,
NULLIF(layer, 0) AS layer,
"level",
CASE WHEN indoor = TRUE THEN 1 END AS indoor,
@ -368,7 +368,7 @@ FROM (
foot,
horse,
mtb_scale,
surface_value(surface) AS "surface",
surface_value(COALESCE(NULLIF(surface, ''), tracktype)) AS "surface",
hl.z_order
FROM osm_highway_linestring hl
LEFT OUTER JOIN osm_transportation_name_network n ON hl.osm_id = n.osm_id
@ -483,7 +483,7 @@ FROM (
is_ford,
NULL::boolean AS expressway,
is_ramp,
is_oneway,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
@ -518,7 +518,7 @@ FROM (
is_ford,
NULL::boolean AS expressway,
is_ramp,
is_oneway,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
@ -553,7 +553,7 @@ FROM (
is_ford,
NULL::boolean AS expressway,
is_ramp,
is_oneway,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
@ -589,7 +589,7 @@ FROM (
is_ford,
NULL::boolean AS expressway,
is_ramp,
is_oneway,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
@ -625,7 +625,7 @@ FROM (
is_ford,
NULL::boolean AS expressway,
is_ramp,
is_oneway,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
@ -659,7 +659,7 @@ FROM (
is_ford,
NULL::boolean AS expressway,
is_ramp,
is_oneway,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
@ -674,6 +674,237 @@ FROM (
WHERE zoom_level >= 13
UNION ALL
-- etldoc: osm_shipway_linestring_gen_z4 -> layer_transportation:z4
SELECT osm_id,
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
NULL AS aerialway,
shipway,
NULL AS public_transport,
service_value(service) AS service,
NULL::text AS access,
NULL::boolean AS toll,
is_bridge,
is_tunnel,
is_ford,
NULL::boolean AS expressway,
is_ramp,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
NULL::boolean AS indoor,
NULL AS bicycle,
NULL AS foot,
NULL AS horse,
NULL AS mtb_scale,
NULL AS surface,
z_order
FROM osm_shipway_linestring_gen_z4
WHERE zoom_level = 4
UNION ALL
-- etldoc: osm_shipway_linestring_gen_z5 -> layer_transportation:z5
SELECT osm_id,
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
NULL AS aerialway,
shipway,
NULL AS public_transport,
service_value(service) AS service,
NULL::text AS access,
NULL::boolean AS toll,
is_bridge,
is_tunnel,
is_ford,
NULL::boolean AS expressway,
is_ramp,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
NULL::boolean AS indoor,
NULL AS bicycle,
NULL AS foot,
NULL AS horse,
NULL AS mtb_scale,
NULL AS surface,
z_order
FROM osm_shipway_linestring_gen_z5
WHERE zoom_level = 5
UNION ALL
-- etldoc: osm_shipway_linestring_gen_z6 -> layer_transportation:z6
SELECT osm_id,
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
NULL AS aerialway,
shipway,
NULL AS public_transport,
service_value(service) AS service,
NULL::text AS access,
NULL::boolean AS toll,
is_bridge,
is_tunnel,
is_ford,
NULL::boolean AS expressway,
is_ramp,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
NULL::boolean AS indoor,
NULL AS bicycle,
NULL AS foot,
NULL AS horse,
NULL AS mtb_scale,
NULL AS surface,
z_order
FROM osm_shipway_linestring_gen_z6
WHERE zoom_level = 6
UNION ALL
-- etldoc: osm_shipway_linestring_gen_z7 -> layer_transportation:z7
SELECT osm_id,
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
NULL AS aerialway,
shipway,
NULL AS public_transport,
service_value(service) AS service,
NULL::text AS access,
NULL::boolean AS toll,
is_bridge,
is_tunnel,
is_ford,
NULL::boolean AS expressway,
is_ramp,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
NULL::boolean AS indoor,
NULL AS bicycle,
NULL AS foot,
NULL AS horse,
NULL AS mtb_scale,
NULL AS surface,
z_order
FROM osm_shipway_linestring_gen_z7
WHERE zoom_level = 7
UNION ALL
-- etldoc: osm_shipway_linestring_gen_z8 -> layer_transportation:z8
SELECT osm_id,
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
NULL AS aerialway,
shipway,
NULL AS public_transport,
service_value(service) AS service,
NULL::text AS access,
NULL::boolean AS toll,
is_bridge,
is_tunnel,
is_ford,
NULL::boolean AS expressway,
is_ramp,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
NULL::boolean AS indoor,
NULL AS bicycle,
NULL AS foot,
NULL AS horse,
NULL AS mtb_scale,
NULL AS surface,
z_order
FROM osm_shipway_linestring_gen_z8
WHERE zoom_level = 8
UNION ALL
-- etldoc: osm_shipway_linestring_gen_z9 -> layer_transportation:z9
SELECT osm_id,
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
NULL AS aerialway,
shipway,
NULL AS public_transport,
service_value(service) AS service,
NULL::text AS access,
NULL::boolean AS toll,
is_bridge,
is_tunnel,
is_ford,
NULL::boolean AS expressway,
is_ramp,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
NULL::boolean AS indoor,
NULL AS bicycle,
NULL AS foot,
NULL AS horse,
NULL AS mtb_scale,
NULL AS surface,
z_order
FROM osm_shipway_linestring_gen_z9
WHERE zoom_level = 9
UNION ALL
-- etldoc: osm_shipway_linestring_gen_z10 -> layer_transportation:z10
SELECT osm_id,
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
NULL AS aerialway,
shipway,
NULL AS public_transport,
service_value(service) AS service,
NULL::text AS access,
NULL::boolean AS toll,
is_bridge,
is_tunnel,
is_ford,
NULL::boolean AS expressway,
is_ramp,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
NULL::boolean AS indoor,
NULL AS bicycle,
NULL AS foot,
NULL AS horse,
NULL AS mtb_scale,
NULL AS surface,
z_order
FROM osm_shipway_linestring_gen_z10
WHERE zoom_level = 10
UNION ALL
-- etldoc: osm_shipway_linestring_gen_z11 -> layer_transportation:z11
SELECT osm_id,
geometry,
@ -692,7 +923,7 @@ FROM (
is_ford,
NULL::boolean AS expressway,
is_ramp,
is_oneway,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
@ -725,7 +956,7 @@ FROM (
is_ford,
NULL::boolean AS expressway,
is_ramp,
is_oneway,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,
@ -759,7 +990,7 @@ FROM (
is_ford,
NULL::boolean AS expressway,
is_ramp,
is_oneway,
NULL::int AS is_oneway,
NULL AS man_made,
layer,
NULL::int AS level,

Wyświetl plik

@ -127,7 +127,8 @@ layer:
The network type derived mainly from [`network`](http://wiki.openstreetmap.org/wiki/Key:network) tag of the road.
See more info about [`us-*`](http://wiki.openstreetmap.org/wiki/Road_signs_in_the_United_States),
[`ca-transcanada`](https://en.wikipedia.org/wiki/Trans-Canada_Highway),
or [`gb-*`](http://wiki.openstreetmap.org/wiki/United_Kingdom_Tagging_Guidelines#UK_roads).
[`gb-*`](http://wiki.openstreetmap.org/wiki/United_Kingdom_Tagging_Guidelines#UK_roads),
or [`ie-*`](http://wiki.openstreetmap.org/wiki/Ireland/Roads).
brunnel:
description: |
Mark whether way is a tunnel or bridge.

Wyświetl plik

@ -1,118 +1,196 @@
CREATE TABLE IF NOT EXISTS ne_10m_admin_0_bg_buffer AS
DROP TRIGGER IF EXISTS trigger_store_transportation_highway_linestring ON osm_highway_linestring;
-- Create bounding windows for country-specific processing
-- etldoc: ne_10m_admin_0_countries -> ne_10m_admin_0_gb_buffer
CREATE TABLE IF NOT EXISTS ne_10m_admin_0_gb_buffer AS
SELECT ST_Buffer(geometry, 10000)
FROM ne_10m_admin_0_countries
WHERE iso_a2 = 'GB';
CREATE OR REPLACE VIEW gbr_route_members_view AS
SELECT 0,
osm_id,
substring(ref FROM E'^[AM][0-9AM()]+'),
CASE WHEN highway = 'motorway' THEN 'omt-gb-motorway' ELSE 'omt-gb-trunk' END
FROM osm_highway_linestring
WHERE length(ref) > 0
AND ST_Intersects(geometry, (SELECT * FROM ne_10m_admin_0_bg_buffer))
AND highway IN ('motorway', 'trunk')
;
-- Create GBR relations (so we can use it in the same way as other relations)
DELETE
FROM osm_route_member
WHERE network IN ('omt-gb-motorway', 'omt-gb-trunk');
-- etldoc: osm_highway_linestring -> osm_route_member
INSERT INTO osm_route_member (osm_id, member, ref, network)
SELECT *
FROM gbr_route_members_view;
-- etldoc: ne_10m_admin_0_countries -> ne_10m_admin_0_ie_buffer
CREATE TABLE IF NOT EXISTS ne_10m_admin_0_ie_buffer AS
SELECT ST_Buffer(geometry, 10000)
FROM ne_10m_admin_0_countries
WHERE iso_a2 = 'IE';
CREATE OR REPLACE FUNCTION osm_route_member_network_type(network text) RETURNS route_network_type AS
-- Assign pseudo-networks based highway classification
-- etldoc: osm_highway_linestring -> gbr_route_members_view
-- etldoc: ne_10m_admin_0_gb_buffer -> gbr_route_members_view
CREATE OR REPLACE VIEW gbr_route_members_view AS
SELECT osm_id AS member,
substring(ref FROM E'^[ABM][0-9ABM()]+') AS ref,
-- See https://wiki.openstreetmap.org/wiki/Roads_in_the_United_Kingdom
CASE WHEN highway = 'motorway' THEN 'omt-gb-motorway'
WHEN highway = 'trunk' THEN 'omt-gb-trunk'
WHEN highway IN ('primary','secondary') THEN 'omt-gb-primary' END AS network
FROM osm_highway_linestring
WHERE length(ref) > 1
AND ST_Intersects(geometry, (SELECT * FROM ne_10m_admin_0_gb_buffer))
AND highway IN ('motorway', 'trunk', 'primary', 'secondary')
;
-- etldoc: osm_highway_linestring -> ire_route_members_view
-- etldoc: ne_10m_admin_0_ie_buffer -> ire_route_members_view
CREATE OR REPLACE VIEW ire_route_members_view AS
SELECT osm_id AS member,
substring(ref FROM E'^[MNRL][0-9]+') AS ref,
-- See https://wiki.openstreetmap.org/wiki/Ireland/Roads
CASE WHEN highway = 'motorway' THEN 'omt-ie-motorway'
WHEN highway IN ('trunk','primary') THEN 'omt-ie-national'
ELSE 'omt-ie-regional' END AS network
FROM osm_highway_linestring
WHERE length(ref) > 1
AND ST_Intersects(geometry, (SELECT * FROM ne_10m_admin_0_ie_buffer))
AND highway IN ('motorway', 'trunk', 'primary', 'secondary', 'unclassified')
;
CREATE OR REPLACE FUNCTION osm_route_member_network_type(network text, ref text) RETURNS route_network_type AS
$$
SELECT CASE
-- https://wiki.openstreetmap.org/wiki/United_States_roads_tagging
WHEN network = 'US:I' THEN 'us-interstate'::route_network_type
WHEN network = 'US:US' THEN 'us-highway'::route_network_type
WHEN network LIKE 'US:__' THEN 'us-state'::route_network_type
-- https://en.wikipedia.org/wiki/Trans-Canada_Highway
WHEN network LIKE 'CA:transcanada%' THEN 'ca-transcanada'::route_network_type
WHEN network = 'CA:QC:A' THEN 'ca-provincial-arterial'::route_network_type
WHEN network = 'CA:ON:primary' THEN
CASE
WHEN ref LIKE '4__' THEN 'ca-provincial-arterial'::route_network_type
WHEN ref = 'QEW' THEN 'ca-provincial-arterial'::route_network_type
ELSE 'ca-provincial'::route_network_type
END
WHEN network = 'CA:MB:PTH' AND ref = '75' THEN 'ca-provincial-arterial'::route_network_type
WHEN network = 'CA:AB:primary' AND ref IN ('2','3','4') THEN 'ca-provincial-arterial'::route_network_type
WHEN network = 'CA:BC' AND ref IN ('3','5','99') THEN 'ca-provincial-arterial'::route_network_type
WHEN network LIKE 'CA:__' OR network LIKE 'CA:__:%' THEN 'ca-provincial'::route_network_type
WHEN network = 'omt-gb-motorway' THEN 'gb-motorway'::route_network_type
WHEN network = 'omt-gb-trunk' THEN 'gb-trunk'::route_network_type
END;
WHEN network = 'omt-gb-primary' THEN 'gb-primary'::route_network_type
WHEN network = 'omt-ie-motorway' THEN 'ie-motorway'::route_network_type
WHEN network = 'omt-ie-national' THEN 'ie-national'::route_network_type
WHEN network = 'omt-ie-regional' THEN 'ie-regional'::route_network_type
END;
$$ LANGUAGE sql IMMUTABLE
PARALLEL SAFE;
-- etldoc: osm_route_member -> osm_route_member
-- see http://wiki.openstreetmap.org/wiki/Relation:route#Road_routes
UPDATE osm_route_member
SET network_type = osm_route_member_network_type(network)
WHERE network != ''
AND network_type IS DISTINCT FROM osm_route_member_network_type(network)
;
CREATE TABLE IF NOT EXISTS transportation_route_member_coalesced
(
member bigint,
network varchar,
ref varchar,
osm_id bigint not null,
role varchar,
type smallint,
name varchar,
osmc_symbol varchar,
colour varchar,
ref_colour varchar,
network_type route_network_type,
concurrency_index integer,
rank integer,
PRIMARY KEY (member, network, ref)
);
CREATE OR REPLACE FUNCTION update_osm_route_member() RETURNS void AS
CREATE OR REPLACE FUNCTION update_osm_route_member(full_update bool) RETURNS void AS
$$
BEGIN
-- Analyze tracking and source tables before performing update
ANALYZE transportation_name.network_changes;
ANALYZE osm_highway_linestring;
ANALYZE osm_route_member;
DELETE
FROM osm_route_member AS r
USING
transportation_name.network_changes AS c
WHERE network IN ('omt-gb-motorway', 'omt-gb-trunk')
AND r.osm_id = c.osm_id;
FROM transportation_route_member_coalesced
USING transportation_name.network_changes c
WHERE c.is_old IS TRUE AND transportation_route_member_coalesced.member = c.osm_id;
INSERT INTO osm_route_member (osm_id, member, ref, network)
SELECT r.*
FROM gbr_route_members_view AS r
JOIN transportation_name.network_changes AS c ON
r.osm_id = c.osm_id;
INSERT INTO osm_route_member (id, osm_id, network_type, concurrency_index, rank)
-- etldoc: osm_route_member -> transportation_route_member_coalesced
INSERT INTO transportation_route_member_coalesced
SELECT
id,
osm_id,
osm_route_member_network_type(network) AS network_type,
DENSE_RANK() over (PARTITION BY member ORDER BY network_type, network, LENGTH(ref), ref) AS concurrency_index,
osm_route_member_filtered.*,
osm_route_member_network_type(network, ref) AS network_type,
DENSE_RANK() OVER (
PARTITION BY member
ORDER BY osm_route_member_network_type(network, ref), network, LENGTH(ref), ref
) AS concurrency_index,
CASE
WHEN network IN ('iwn', 'nwn', 'rwn') THEN 1
WHEN network = 'lwn' THEN 2
WHEN osmc_symbol || colour <> '' THEN 2
END AS rank
FROM osm_route_member rm
WHERE rm.member IN
(SELECT DISTINCT osm_id FROM transportation_name.network_changes)
ON CONFLICT (id, osm_id) DO UPDATE SET concurrency_index = EXCLUDED.concurrency_index,
rank = EXCLUDED.rank,
network_type = EXCLUDED.network_type;
FROM (
-- etldoc: osm_route_member -> osm_route_member
-- etldoc: gbr_route_members_view -> osm_route_member
-- etldoc: ire_route_members_view -> osm_route_member
-- see http://wiki.openstreetmap.org/wiki/Relation:route#Road_routes
SELECT DISTINCT ON (member, COALESCE(rel.network, ''), COALESCE(rel.ref, ''))
rel.member,
COALESCE(NULLIF(rel.network,''), gb_way.network, ir_way.network, '') AS network,
COALESCE(rel.ref, '') AS ref,
osm_id,
role,
type,
name,
osmc_symbol,
colour,
ref_colour
FROM osm_route_member rel
LEFT JOIN gbr_route_members_view gb_way ON (gb_way.member=rel.member)
LEFT JOIN ire_route_members_view ir_way ON (ir_way.member=rel.member)
WHERE full_update OR EXISTS(
SELECT NULL
FROM transportation_name.network_changes c
WHERE c.is_old IS FALSE AND c.osm_id = rel.member
)
) osm_route_member_filtered
ON CONFLICT (member, network, ref) DO UPDATE SET osm_id = EXCLUDED.osm_id, role = EXCLUDED.role,
type = EXCLUDED.type, name = EXCLUDED.name,
osmc_symbol = EXCLUDED.osmc_symbol, colour = EXCLUDED.colour, ref_colour = EXCLUDED.ref_colour,
concurrency_index = EXCLUDED.concurrency_index,
rank = EXCLUDED.rank;
END;
$$ LANGUAGE plpgsql;
CREATE INDEX IF NOT EXISTS osm_route_member_network_idx ON osm_route_member ("network");
CREATE INDEX IF NOT EXISTS osm_route_member_member_idx ON osm_route_member ("member");
CREATE INDEX IF NOT EXISTS osm_route_member_name_idx ON osm_route_member ("name");
CREATE INDEX IF NOT EXISTS osm_route_member_ref_idx ON osm_route_member ("ref");
-- Indexes which can be utilized during full-update for queries originating from update_osm_route_member() function
CREATE INDEX IF NOT EXISTS osm_route_member_member_network_ref_idx
ON osm_route_member (member, COALESCE(network, ''), COALESCE(ref, ''));
CREATE INDEX IF NOT EXISTS osm_route_member_network_type_idx ON osm_route_member ("network_type");
-- Analyze created index
ANALYZE osm_route_member;
CREATE INDEX IF NOT EXISTS osm_highway_linestring_osm_id_idx ON osm_highway_linestring ("osm_id");
CREATE UNIQUE INDEX IF NOT EXISTS osm_highway_linestring_gen_z11_osm_id_idx ON osm_highway_linestring_gen_z11 ("osm_id");
-- Ensure transportation_name.network_changes table exists since it is required by update_osm_route_member
CREATE SCHEMA IF NOT EXISTS transportation_name;
CREATE TABLE IF NOT EXISTS transportation_name.network_changes
(
is_old bool,
osm_id bigint,
PRIMARY KEY (is_old, osm_id)
);
ALTER TABLE osm_route_member ADD COLUMN IF NOT EXISTS concurrency_index int,
ADD COLUMN IF NOT EXISTS rank int;
-- Fill transportation_route_member_coalesced table
TRUNCATE transportation_route_member_coalesced;
SELECT update_osm_route_member(TRUE);
-- One-time load of concurrency indexes; updates occur via trigger
INSERT INTO osm_route_member (id, osm_id, concurrency_index, rank)
SELECT
id,
osm_id,
DENSE_RANK() over (PARTITION BY member ORDER BY network_type, network, LENGTH(ref), ref) AS concurrency_index,
CASE
WHEN network IN ('iwn', 'nwn', 'rwn') THEN 1
WHEN network = 'lwn' THEN 2
WHEN osmc_symbol || colour <> '' THEN 2
END AS rank
FROM osm_route_member
ON CONFLICT (id, osm_id) DO UPDATE SET concurrency_index = EXCLUDED.concurrency_index, rank = EXCLUDED.rank;
-- Index for queries against transportation_route_member_coalesced during transportation-name-network updates
CREATE INDEX IF NOT EXISTS transportation_route_member_member_idx ON
transportation_route_member_coalesced ("member", "concurrency_index");
-- Analyze populated table with indexes
ANALYZE transportation_route_member_coalesced;
-- Ensure OSM-ID index exists on osm_highway_linestring
CREATE UNIQUE INDEX IF NOT EXISTS osm_highway_linestring_osm_id_idx ON osm_highway_linestring ("osm_id");
-- etldoc: osm_route_member -> osm_highway_linestring
UPDATE osm_highway_linestring hl
SET network = rm.network_type
FROM osm_route_member rm
FROM transportation_route_member_coalesced rm
WHERE hl.osm_id=rm.member AND rm.concurrency_index=1;
-- etldoc: osm_route_member -> osm_highway_linestring_gen_z11
UPDATE osm_highway_linestring_gen_z11 hl
SET network = rm.network_type
FROM osm_route_member rm
FROM transportation_route_member_coalesced rm
WHERE hl.osm_id=rm.member AND rm.concurrency_index=1;

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 283 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 329 KiB

Wyświetl plik

@ -1,52 +1,46 @@
CREATE OR REPLACE FUNCTION highway_to_val(hwy_class varchar)
RETURNS int
IMMUTABLE
LANGUAGE plpgsql
LANGUAGE sql
AS $$
BEGIN
CASE hwy_class
WHEN 'motorway' THEN RETURN 6;
WHEN 'trunk' THEN RETURN 5;
WHEN 'primary' THEN RETURN 4;
WHEN 'secondary' THEN RETURN 3;
WHEN 'tertiary' THEN RETURN 2;
WHEN 'unclassified' THEN RETURN 1;
else RETURN 0;
END CASE;
END;
SELECT CASE hwy_class
WHEN 'motorway' THEN 6
WHEN 'trunk' THEN 5
WHEN 'primary' THEN 4
WHEN 'secondary' THEN 3
WHEN 'tertiary' THEN 2
WHEN 'unclassified' THEN 1
ELSE 0
END;
$$;
CREATE OR REPLACE FUNCTION val_to_highway(hwy_val int)
RETURNS varchar
IMMUTABLE
LANGUAGE plpgsql
LANGUAGE sql
AS $$
BEGIN
CASE hwy_val
WHEN 6 THEN RETURN 'motorway';
WHEN 5 THEN RETURN 'trunk';
WHEN 4 THEN RETURN 'primary';
WHEN 3 THEN RETURN 'secondary';
WHEN 2 THEN RETURN 'tertiary';
WHEN 1 THEN RETURN 'unclassified';
else RETURN null;
END CASE;
END;
SELECT CASE hwy_val
WHEN 6 THEN 'motorway'
WHEN 5 THEN 'trunk'
WHEN 4 THEN 'primary'
WHEN 3 THEN 'secondary'
WHEN 2 THEN 'tertiary'
WHEN 1 THEN 'unclassified'
ELSE null
END;
$$;
CREATE OR REPLACE FUNCTION highest_hwy_sfunc(agg_state varchar, hwy_class varchar)
RETURNS varchar
IMMUTABLE
LANGUAGE plpgsql
LANGUAGE sql
AS $$
BEGIN
RETURN val_to_highway(
SELECT val_to_highway(
GREATEST(
highway_to_val(agg_state),
highway_to_val(hwy_class)
)
);
END;
$$;
DROP AGGREGATE IF EXISTS highest_highway (varchar);

Wyświetl plik

@ -34,7 +34,7 @@
"ferry"
]
],
"order": 175
"order": 184
},
{
"id": "road_label",
@ -81,7 +81,7 @@
"ferry"
]
],
"order": 176
"order": 185
},
{
"id": "highway-shield-tertiary",
@ -160,7 +160,7 @@
"ref"
]
],
"order": 177
"order": 186
},
{
"id": "highway-shield-secondary",
@ -239,7 +239,7 @@
"ref"
]
],
"order": 178
"order": 187
},
{
"id": "highway-shield-primary",
@ -318,7 +318,7 @@
"ref"
]
],
"order": 179
"order": 188
},
{
"id": "highway-shield-motorway",
@ -400,7 +400,7 @@
"ref"
]
],
"order": 180
"order": 189
}
]
}

Wyświetl plik

@ -4,26 +4,44 @@
CREATE OR REPLACE FUNCTION layer_transportation_name(bbox geometry, zoom_level integer)
RETURNS TABLE
(
geometry geometry,
name text,
name_en text,
name_de text,
tags hstore,
ref text,
ref_length int,
network text,
route_1 text,
route_2 text,
route_3 text,
route_4 text,
route_5 text,
route_6 text,
class text,
subclass text,
brunnel text,
layer int,
level int,
indoor int
geometry geometry,
name text,
name_en text,
name_de text,
tags hstore,
ref text,
ref_length int,
network text,
route_1_network text,
route_1_ref text,
route_1_name text,
route_1_colour text,
route_2_network text,
route_2_ref text,
route_2_name text,
route_2_colour text,
route_3_network text,
route_3_ref text,
route_3_name text,
route_3_colour text,
route_4_network text,
route_4_ref text,
route_4_name text,
route_4_colour text,
route_5_network text,
route_5_ref text,
route_5_name text,
route_5_colour text,
route_6_network text,
route_6_ref text,
route_6_name text,
route_6_colour text,
class text,
subclass text,
brunnel text,
layer int,
level int,
indoor int
)
AS
$$
@ -40,21 +58,62 @@ SELECT geometry,
WHEN length(coalesce(ref, '')) > 0
THEN 'road'
END AS network,
route_1, route_2, route_3, route_4, route_5, route_6,
route_1->'network' AS route_1_network,
route_1->'ref' AS route_1_ref,
route_1->'name' AS route_1_name,
route_1->'colour' AS route_1_colour,
route_2->'network' AS route_2_network,
route_2->'ref' AS route_2_ref,
route_2->'name' AS route_2_name,
route_2->'colour' AS route_2_colour,
route_3->'network' AS route_3_network,
route_3->'ref' AS route_3_ref,
route_3->'name' AS route_3_name,
route_3->'colour' AS route_3_colour,
route_4->'network' AS route_4_network,
route_4->'ref' AS route_4_ref,
route_4->'name' AS route_4_name,
route_4->'colour' AS route_4_colour,
route_5->'network' AS route_5_network,
route_5->'ref' AS route_5_ref,
route_5->'name' AS route_5_name,
route_5->'colour' AS route_5_colour,
route_6->'network' AS route_6_network,
route_6->'ref' AS route_6_ref,
route_6->'name' AS route_6_name,
route_6->'colour' AS route_6_colour,
highway_class(highway, '', subclass) AS class,
CASE
WHEN highway IS NOT NULL AND highway_class(highway, '', subclass) = 'path'
THEN highway
ELSE subclass
END AS subclass,
brunnel,
NULLIF(brunnel, '') AS brunnel,
NULLIF(layer, 0) AS layer,
"level",
CASE WHEN indoor = TRUE THEN 1 END AS indoor
FROM (
-- etldoc: osm_transportation_name_linestring_gen4 -> layer_transportation_name:z6
SELECT *,
SELECT geometry,
tags,
ref,
highway,
subclass,
brunnel,
network,
route_1,
route_2,
route_3,
route_4,
route_5,
route_6,
z_order,
NULL::int AS layer,
NULL::int AS level,
NULL::boolean AS indoor
@ -63,32 +122,71 @@ FROM (
UNION ALL
-- etldoc: osm_transportation_name_linestring_gen3 -> layer_transportation_name:z7
SELECT *,
SELECT geometry,
tags,
ref,
highway,
subclass,
brunnel,
network,
route_1,
route_2,
route_3,
route_4,
route_5,
route_6,
z_order,
NULL::int AS layer,
NULL::int AS level,
NULL::boolean AS indoor
FROM osm_transportation_name_linestring_gen3
WHERE zoom_level = 7
WHERE ST_Length(geometry) > 20000 AND zoom_level = 7
UNION ALL
-- etldoc: osm_transportation_name_linestring_gen2 -> layer_transportation_name:z8
SELECT *,
SELECT geometry,
tags,
ref,
highway,
subclass,
brunnel,
network,
route_1,
route_2,
route_3,
route_4,
route_5,
route_6,
z_order,
NULL::int AS layer,
NULL::int AS level,
NULL::boolean AS indoor
FROM osm_transportation_name_linestring_gen2
WHERE zoom_level = 8
WHERE ST_Length(geometry) > 14000 AND zoom_level = 8
UNION ALL
-- etldoc: osm_transportation_name_linestring_gen1 -> layer_transportation_name:z9
-- etldoc: osm_transportation_name_linestring_gen1 -> layer_transportation_name:z10
-- etldoc: osm_transportation_name_linestring_gen1 -> layer_transportation_name:z11
SELECT *,
SELECT geometry,
tags,
ref,
highway,
subclass,
brunnel,
network,
route_1,
route_2,
route_3,
route_4,
route_5,
route_6,
z_order,
NULL::int AS layer,
NULL::int AS level,
NULL::boolean AS indoor
FROM osm_transportation_name_linestring_gen1
WHERE zoom_level BETWEEN 9 AND 11
WHERE ST_Length(geometry) > 8000 / POWER(2, zoom_level - 9) AND zoom_level BETWEEN 9 AND 11
UNION ALL
-- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z12
@ -106,7 +204,7 @@ FROM (
indoor
FROM osm_transportation_name_linestring
WHERE zoom_level = 12
AND LineLabel(zoom_level, COALESCE(tags->'name', ref), geometry)
AND LineLabel(zoom_level, COALESCE(ref, tags->'name'), geometry)
AND NOT highway_is_link(highway)
AND
CASE WHEN highway_class(highway, NULL::text, NULL::text) NOT IN ('path', 'minor') THEN TRUE
@ -130,7 +228,7 @@ FROM (
indoor
FROM osm_transportation_name_linestring
WHERE zoom_level = 13
AND LineLabel(zoom_level, COALESCE(tags->'name', ref), geometry)
AND LineLabel(zoom_level, COALESCE(ref, tags->'name'), geometry)
AND
CASE WHEN highway <> 'path' THEN TRUE
WHEN highway = 'path' AND (
@ -173,12 +271,12 @@ FROM (
'junction'::text AS subclass,
NULL AS brunnel,
NULL AS network,
NULL::text AS route_1,
NULL::text AS route_2,
NULL::text AS route_3,
NULL::text AS route_4,
NULL::text AS route_5,
NULL::text AS route_6,
NULL::hstore AS route_1,
NULL::hstore AS route_2,
NULL::hstore AS route_3,
NULL::hstore AS route_4,
NULL::hstore AS route_5,
NULL::hstore AS route_6,
z_order,
layer,
NULL::int AS level,

Wyświetl plik

@ -13,8 +13,8 @@ layer:
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
fields:
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Highways#Names_and_references) value of the highway.
name_en: English name `name:en` if available, otherwise `name`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
ref: The OSM [`ref`](http://wiki.openstreetmap.org/wiki/Key:ref) tag of the motorway or its network.
ref_length: Length of the `ref` field. Useful for having a shield icon as background for labeling motorways.
network:
@ -28,8 +28,14 @@ layer:
- us-highway
- us-state
- ca-transcanada
- ca-provincial-arterial
- ca-provincial
- gb-motorway
- gb-trunk
- gb-primary
- ie-motorway
- ie-national
- ie-regional
- road (default)
class:
description: |
@ -95,16 +101,34 @@ layer:
value of [`indoor`](http://wiki.openstreetmap.org/wiki/Key:indoor) tag.
values:
- 1
route_1: 1st route concurrency.
route_2: 2nd route concurrency.
route_3: 3rd route concurrency.
route_4: 4th route concurrency.
route_5: 5th route concurrency.
route_6: 6th route concurrency.
route_1_network: 1st route concurrency network.
route_1_ref: 1st route concurrency ref.
route_1_name: 1st route concurrency name.
route_1_colour: 1st route concurrency colour.
route_2_network: 2nd route concurrency network.
route_2_ref: 2nd route concurrency ref.
route_2_name: 2nd route concurrency name.
route_2_colour: 2nd route concurrency colour.
route_3_network: 3rd route concurrency network.
route_3_ref: 3rd route concurrency ref.
route_3_name: 3rd route concurrency name.
route_3_colour: 3rd route concurrency colour.
route_4_network: 4th route concurrency network.
route_4_ref: 4th route concurrency ref.
route_4_name: 4th route concurrency name.
route_4_colour: 4th route concurrency colour.
route_5_network: 5th route concurrency network.
route_5_ref: 5th route concurrency ref.
route_5_name: 5th route concurrency name.
route_5_colour: 5th route concurrency colour.
route_6_network: 6th route concurrency network.
route_6_ref: 6th route concurrency ref.
route_6_name: 6th route concurrency name.
route_6_colour: 6th route concurrency colour.
datasource:
geometry_field: geometry
srid: 900913
query: (SELECT geometry, name, name_en, name_de, {name_languages}, ref, ref_length, network::text, class::text, subclass, brunnel, layer, level, indoor, route_1, route_2, route_3, route_4, route_5, route_6 FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t
query: (SELECT geometry, name, name_en, name_de, {name_languages}, ref, ref_length, network::text, class::text, subclass, brunnel, layer, level, indoor, route_1_network, route_1_ref, route_1_name, route_1_colour, route_2_network, route_2_ref, route_2_name, route_2_colour, route_3_network, route_3_ref, route_3_name, route_3_colour, route_4_network, route_4_ref, route_4_name, route_4_colour, route_5_network, route_5_ref, route_5_name, route_5_colour, route_6_network, route_6_ref, route_6_name, route_6_colour FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t
schema:
- ./highway_classification.sql
- ./update_transportation_name.sql

Wyświetl plik

@ -66,6 +66,9 @@ tables:
type: string
- name: tags
type: hstore_tags
- name: place
key: place
type: string
- name: natural
key: natural
type: string
@ -104,4 +107,11 @@ tables:
- dock
water:
- river
- stream
- canal
- ditch
- drain
- pond
- basin
- wastewater
type: polygon

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 36 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 46 KiB

Wyświetl plik

@ -1,6 +1,7 @@
CREATE OR REPLACE FUNCTION water_class(waterway text, water text, leisure text) RETURNS text AS
$$
SELECT CASE
WHEN water IN ('river', 'canal', 'stream', 'ditch', 'drain') THEN 'river'
%%FIELD_MAPPING: class %%
ELSE 'lake'
END;

Wyświetl plik

@ -25,15 +25,22 @@ layer:
class:
description: |
All water polygons from [OpenStreetMapData](http://osmdata.openstreetmap.de/) have the class `ocean`.
Water bodies with the [`water=river`](http://wiki.openstreetmap.org/wiki/Tag:water=river) tag are classified as river. Wet and dry docks
tagged [`waterway=dock`](http://wiki.openstreetmap.org/wiki/Tag:waterway=dock) are classified as a `dock`.
The water-covered areas of flowing water bodies with the [`water=river`](http://wiki.openstreetmap.org/wiki/Tag:water=river),
[`water=canal`](http://wiki.openstreetmap.org/wiki/Tag:water=canal),
[`water=stream`](http://wiki.openstreetmap.org/wiki/Tag:water=stream),
[`water=ditch`](http://wiki.openstreetmap.org/wiki/Tag:water=ditch), or
[`water=drain`](http://wiki.openstreetmap.org/wiki/Tag:water=drain) tags are classified as river. Wet and dry docks
tagged [`waterway=dock`](http://wiki.openstreetmap.org/wiki/Tag:waterway=dock) are classified as a `dock`.
Various minor waterbodies are classified as a `pond`.
Swimming pools tagged [`leisure=swimming_pool`](https://wiki.openstreetmap.org/wiki/Tag:leisure=swimming_pool) are classified as a `swimming_pool`
All other water bodies are classified as `lake`.
values:
dock:
waterway: 'dock'
river:
water: 'river'
water: ['river', 'stream', 'canal', 'ditch', 'drain']
pond:
water: ['pond', 'basin', 'wastewater', 'salt_pond']
lake:
ocean:
swimming_pool:

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 100 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 109 KiB

Wyświetl plik

@ -21,6 +21,9 @@ tables:
- name: place
key: place
type: string
- name: natural
key: natural
type: string
- name: rank
key: rank
type: integer
@ -34,3 +37,6 @@ tables:
place:
- ocean
- sea
natural:
- bay
- strait

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 41 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 57 KiB

Wyświetl plik

@ -31,7 +31,7 @@
"LineString"
]
],
"order": 143
"order": 152
},
{
"id": "water_name_point",
@ -68,7 +68,7 @@
"ocean"
]
],
"order": 144
"order": 153
}
]
}

Wyświetl plik

@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS water_name_marine;
CREATE TABLE IF NOT EXISTS water_name_marine.osm_ids
(
osm_id bigint
osm_id bigint PRIMARY KEY
);
CREATE OR REPLACE FUNCTION update_osm_marine_point(full_update boolean) RETURNS void AS
@ -18,8 +18,11 @@ $$
SELECT osm.osm_id, ne.scalerank
FROM osm_marine_point AS osm
LEFT JOIN ne_10m_geography_marine_polys AS ne ON
lower(trim(regexp_replace(ne.name, '\\s+', ' ', 'g'))) IN (lower(osm.name), lower(osm.tags->'name:en'), lower(osm.tags->'name:es'))
OR substring(lower(trim(regexp_replace(ne.name, '\\s+', ' ', 'g'))) FROM 1 FOR length(lower(osm.name))) = lower(osm.name)
(
lower(trim(regexp_replace(ne.name, '\\s+', ' ', 'g'))) IN (lower(osm.name), lower(osm.tags->'name:en'), lower(osm.tags->'name:es'))
OR substring(lower(trim(regexp_replace(ne.name, '\\s+', ' ', 'g'))) FROM 1 FOR length(lower(osm.name))) = lower(osm.name)
)
AND ST_DWithin(ne.geometry, osm.geometry, 50000)
)
UPDATE osm_marine_point AS osm
SET "rank" = scalerank
@ -45,11 +48,7 @@ CREATE INDEX IF NOT EXISTS osm_marine_point_rank_idx ON osm_marine_point ("rank"
CREATE OR REPLACE FUNCTION water_name_marine.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO water_name_marine.osm_ids VALUES (OLD.osm_id);
ELSE
INSERT INTO water_name_marine.osm_ids VALUES (NEW.osm_id);
END IF;
INSERT INTO water_name_marine.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@ -74,6 +73,11 @@ DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh water_name_marine rank';
-- Analyze tracking and source tables before performing update
ANALYZE water_name_marine.osm_ids;
ANALYZE osm_marine_point;
PERFORM update_osm_marine_point(false);
-- noinspection SqlWithoutWhere
DELETE FROM water_name_marine.osm_ids;
@ -86,13 +90,13 @@ END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_marine_point
FOR EACH ROW
EXECUTE PROCEDURE water_name_marine.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
AFTER INSERT OR UPDATE
ON osm_marine_point
FOR EACH STATEMENT
EXECUTE PROCEDURE water_name_marine.flag();

Wyświetl plik

@ -1,94 +0,0 @@
DROP TRIGGER IF EXISTS trigger_delete_line ON osm_water_polygon;
DROP TRIGGER IF EXISTS trigger_update_line ON osm_water_polygon;
DROP TRIGGER IF EXISTS trigger_insert_line ON osm_water_polygon;
CREATE OR REPLACE VIEW osm_water_lakeline_view AS
SELECT wp.osm_id,
ll.wkb_geometry AS geometry,
name,
name_en,
name_de,
update_tags(tags, ll.wkb_geometry) AS tags,
ST_Area(wp.geometry) AS area,
is_intermittent
FROM osm_water_polygon AS wp
INNER JOIN lake_centerline ll ON wp.osm_id = ll.osm_id
WHERE wp.name <> ''
AND ST_IsValid(wp.geometry);
-- etldoc: osm_water_polygon -> osm_water_lakeline
-- etldoc: lake_centerline -> osm_water_lakeline
CREATE TABLE IF NOT EXISTS osm_water_lakeline AS
SELECT *
FROM osm_water_lakeline_view;
DO
$$
BEGIN
ALTER TABLE osm_water_lakeline
ADD CONSTRAINT osm_water_lakeline_pk PRIMARY KEY (osm_id);
EXCEPTION
WHEN OTHERS THEN
RAISE NOTICE 'primary key osm_water_lakeline_pk already exists in osm_water_lakeline.';
END;
$$;
CREATE INDEX IF NOT EXISTS osm_water_lakeline_geometry_idx ON osm_water_lakeline USING gist (geometry);
-- Handle updates
CREATE SCHEMA IF NOT EXISTS water_lakeline;
CREATE OR REPLACE FUNCTION water_lakeline.delete() RETURNS trigger AS
$$
BEGIN
DELETE
FROM osm_water_lakeline
WHERE osm_water_lakeline.osm_id = OLD.osm_id;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION water_lakeline.update() RETURNS trigger AS
$$
BEGIN
UPDATE osm_water_lakeline
SET (osm_id, geometry, name, name_en, name_de, tags, area, is_intermittent) =
(SELECT * FROM osm_water_lakeline_view WHERE osm_water_lakeline_view.osm_id = NEW.osm_id)
WHERE osm_water_lakeline.osm_id = NEW.osm_id;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION water_lakeline.insert() RETURNS trigger AS
$$
BEGIN
INSERT INTO osm_water_lakeline
SELECT *
FROM osm_water_lakeline_view
WHERE osm_water_lakeline_view.osm_id = NEW.osm_id
-- May happen in case we replay update
ON CONFLICT ON CONSTRAINT osm_water_lakeline_pk
DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_delete_line
AFTER DELETE
ON osm_water_polygon
FOR EACH ROW
EXECUTE PROCEDURE water_lakeline.delete();
CREATE TRIGGER trigger_update_line
AFTER UPDATE
ON osm_water_polygon
FOR EACH ROW
EXECUTE PROCEDURE water_lakeline.update();
CREATE TRIGGER trigger_insert_line
AFTER INSERT
ON osm_water_polygon
FOR EACH ROW
EXECUTE PROCEDURE water_lakeline.insert();

Wyświetl plik

@ -0,0 +1,213 @@
DROP TRIGGER IF EXISTS trigger_store ON osm_water_polygon;
DROP TRIGGER IF EXISTS trigger_flag ON osm_water_polygon;
DROP TRIGGER IF EXISTS trigger_refresh ON water_name.updates;
CREATE INDEX IF NOT EXISTS lake_centerline_osm_id_idx ON lake_centerline (osm_id);
CREATE INDEX IF NOT EXISTS osm_water_polygon_update_idx ON osm_water_polygon (name, ST_IsValid(geometry))
WHERE name <> '' AND ST_IsValid(geometry);;
CREATE OR REPLACE VIEW osm_water_lakeline_view AS
SELECT wp.osm_id,
ll.wkb_geometry AS geometry,
name,
name_en,
name_de,
update_tags(tags, ll.wkb_geometry) AS tags,
ST_Area(wp.geometry) AS area,
is_intermittent
FROM osm_water_polygon AS wp
INNER JOIN lake_centerline ll ON wp.osm_id = ll.osm_id
WHERE wp.name <> ''
AND ST_IsValid(wp.geometry);
-- etldoc: osm_water_polygon -> osm_water_lakeline
-- etldoc: lake_centerline -> osm_water_lakeline
CREATE TABLE IF NOT EXISTS osm_water_lakeline AS
SELECT *
FROM osm_water_lakeline_view;
DO
$$
BEGIN
ALTER TABLE osm_water_lakeline
ADD CONSTRAINT osm_water_lakeline_pk PRIMARY KEY (osm_id);
EXCEPTION
WHEN OTHERS THEN
RAISE NOTICE 'primary key osm_water_lakeline_pk already exists in osm_water_lakeline.';
END;
$$;
CREATE INDEX IF NOT EXISTS osm_water_lakeline_geometry_idx ON osm_water_lakeline USING gist (geometry);
-- etldoc: osm_water_polygon -> osm_water_point_view
-- etldoc: lake_centerline -> osm_water_point_view
CREATE OR REPLACE VIEW osm_water_point_view AS
SELECT wp.osm_id,
ST_PointOnSurface(wp.geometry) AS geometry,
wp.name,
wp.name_en,
wp.name_de,
CASE
WHEN "natural" = 'bay' THEN 'bay'
WHEN place = 'sea' THEN 'sea'
ELSE 'lake'
END AS class,
update_tags(wp.tags, ST_PointOnSurface(wp.geometry)) AS tags,
-- Area of the feature in square meters
ST_Area(wp.geometry) AS area,
wp.is_intermittent
FROM osm_water_polygon AS wp
LEFT JOIN lake_centerline ll ON wp.osm_id = ll.osm_id
WHERE ll.osm_id IS NULL
AND wp.name <> ''
AND ST_IsValid(wp.geometry);
-- etldoc: osm_water_point_view -> osm_water_point_earth_view
CREATE OR REPLACE VIEW osm_water_point_earth_view AS
SELECT osm_id,
geometry,
name,
name_en,
name_de,
class,
tags,
-- Percentage of the earth's surface covered by this feature (approximately)
-- The constant below is 111,842^2 * 180 * 180, where 111,842 is the length of one degree of latitude at the equator in meters.
area / (405279708033600 * COS(ST_Y(ST_Transform(geometry,4326))*PI()/180)) as earth_area,
is_intermittent
FROM osm_water_point_view;
-- etldoc: osm_water_point_earth_view -> osm_water_point
CREATE TABLE IF NOT EXISTS osm_water_point AS
SELECT *
FROM osm_water_point_earth_view;
DO
$$
BEGIN
ALTER TABLE osm_water_point
ADD CONSTRAINT osm_water_point_pk PRIMARY KEY (osm_id);
EXCEPTION
WHEN OTHERS THEN
RAISE NOTICE 'primary key osm_water_point_pk already exists in osm_water_point.';
END;
$$;
CREATE INDEX IF NOT EXISTS osm_water_point_geometry_idx ON osm_water_point USING gist (geometry);
-- Handle updates
CREATE SCHEMA IF NOT EXISTS water_name;
CREATE TABLE IF NOT EXISTS water_name.osm_ids
(
osm_id bigint,
is_old bool,
PRIMARY KEY (osm_id, is_old)
);
CREATE OR REPLACE FUNCTION update_osm_water_name() RETURNS void AS $$
BEGIN
DELETE FROM osm_water_lakeline
WHERE EXISTS(
SELECT NULL
FROM water_name.osm_ids
WHERE water_name.osm_ids.osm_id = osm_water_lakeline.osm_id
AND water_name.osm_ids.is_old IS TRUE
);
INSERT INTO osm_water_lakeline
SELECT * FROM osm_water_lakeline_view
WHERE EXISTS(
SELECT NULL
FROM water_name.osm_ids
WHERE water_name.osm_ids.osm_id = osm_water_lakeline_view.osm_id
AND water_name.osm_ids.is_old IS FALSE
) ON CONFLICT (osm_id) DO UPDATE SET geometry = excluded.geometry, name = excluded.name, name_en = excluded.name_en,
name_de = excluded.name_de, tags = excluded.tags, area = excluded.area,
is_intermittent = excluded.is_intermittent;
DELETE FROM osm_water_point
WHERE EXISTS(
SELECT NULL
FROM water_name.osm_ids
WHERE water_name.osm_ids.osm_id = osm_water_point.osm_id
AND water_name.osm_ids.is_old IS TRUE
);
INSERT INTO osm_water_point
SELECT * FROM osm_water_point_earth_view
WHERE EXISTS(
SELECT NULL
FROM water_name.osm_ids
WHERE water_name.osm_ids.osm_id = osm_water_point_earth_view.osm_id
AND water_name.osm_ids.is_old IS FALSE
) ON CONFLICT (osm_id) DO UPDATE SET geometry = excluded.geometry, name = excluded.name, name_en = excluded.name_en,
name_de = excluded.name_de, class = excluded.class, tags = excluded.tags,
earth_area = excluded.earth_area, is_intermittent = excluded.is_intermittent;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION water_name.store() RETURNS trigger AS $$
BEGIN
IF (tg_op = 'DELETE') THEN
INSERT INTO water_name.osm_ids (osm_id, is_old) VALUES (OLD.osm_id, TRUE) ON CONFLICT (osm_id, is_old) DO NOTHING;
ELSE
INSERT INTO water_name.osm_ids (osm_id, is_old) VALUES (NEW.osm_id, FALSE) ON CONFLICT (osm_id, is_old) DO NOTHING;
END IF;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE TABLE IF NOT EXISTS water_name.updates
(
id serial PRIMARY KEY,
t text,
UNIQUE (t)
);
CREATE OR REPLACE FUNCTION water_name.flag() RETURNS trigger AS
$$
BEGIN
INSERT INTO water_name.updates(t) VALUES ('y') ON CONFLICT(t) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION water_name.refresh() RETURNS trigger AS
$$
DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh water_name';
-- Analyze tracking and source tables before performing update
ANALYZE water_name.osm_ids;
ANALYZE osm_water_lakeline;
ANALYZE osm_water_point;
PERFORM update_osm_water_name();
-- noinspection SqlWithoutWhere
DELETE FROM water_name.osm_ids;
-- noinspection SqlWithoutWhere
DELETE FROM water_name.updates;
RAISE LOG 'Refresh water_name done in %', age(clock_timestamp(), t);
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE
ON osm_water_polygon
FOR EACH ROW
EXECUTE PROCEDURE water_name.store();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
ON osm_water_polygon
FOR EACH STATEMENT
EXECUTE PROCEDURE water_name.flag();
CREATE CONSTRAINT TRIGGER trigger_refresh
AFTER INSERT
ON water_name.updates
INITIALLY DEFERRED
FOR EACH ROW
EXECUTE PROCEDURE water_name.refresh();

Wyświetl plik

@ -1,95 +0,0 @@
DROP TRIGGER IF EXISTS trigger_delete_point ON osm_water_polygon;
DROP TRIGGER IF EXISTS trigger_update_point ON osm_water_polygon;
DROP TRIGGER IF EXISTS trigger_insert_point ON osm_water_polygon;
CREATE OR REPLACE VIEW osm_water_point_view AS
SELECT wp.osm_id,
ST_PointOnSurface(wp.geometry) AS geometry,
wp.name,
wp.name_en,
wp.name_de,
update_tags(wp.tags, ST_PointOnSurface(wp.geometry)) AS tags,
ST_Area(wp.geometry) AS area,
wp.is_intermittent
FROM osm_water_polygon AS wp
LEFT JOIN lake_centerline ll ON wp.osm_id = ll.osm_id
WHERE ll.osm_id IS NULL
AND wp.name <> ''
AND ST_IsValid(wp.geometry);
-- etldoc: osm_water_polygon -> osm_water_point
-- etldoc: lake_centerline -> osm_water_point
CREATE TABLE IF NOT EXISTS osm_water_point AS
SELECT *
FROM osm_water_point_view;
DO
$$
BEGIN
ALTER TABLE osm_water_point
ADD CONSTRAINT osm_water_point_pk PRIMARY KEY (osm_id);
EXCEPTION
WHEN OTHERS THEN
RAISE NOTICE 'primary key osm_water_point_pk already exists in osm_water_point.';
END;
$$;
CREATE INDEX IF NOT EXISTS osm_water_point_geometry_idx ON osm_water_point USING gist (geometry);
-- Handle updates
CREATE SCHEMA IF NOT EXISTS water_point;
CREATE OR REPLACE FUNCTION water_point.delete() RETURNS trigger AS
$$
BEGIN
DELETE
FROM osm_water_point
WHERE osm_water_point.osm_id = OLD.osm_id;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION water_point.update() RETURNS trigger AS
$$
BEGIN
UPDATE osm_water_point
SET (osm_id, geometry, name, name_en, name_de, tags, area, is_intermittent) =
(SELECT * FROM osm_water_point_view WHERE osm_water_point_view.osm_id = NEW.osm_id)
WHERE osm_water_point.osm_id = NEW.osm_id;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION water_point.insert() RETURNS trigger AS
$$
BEGIN
INSERT INTO osm_water_point
SELECT *
FROM osm_water_point_view
WHERE osm_water_point_view.osm_id = NEW.osm_id
-- May happen in case we replay update
ON CONFLICT ON CONSTRAINT osm_water_point_pk
DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_delete_point
AFTER DELETE
ON osm_water_polygon
FOR EACH ROW
EXECUTE PROCEDURE water_point.delete();
CREATE TRIGGER trigger_update_point
AFTER UPDATE
ON osm_water_polygon
FOR EACH ROW
EXECUTE PROCEDURE water_point.update();
CREATE TRIGGER trigger_insert_point
AFTER INSERT
ON osm_water_polygon
FOR EACH ROW
EXECUTE PROCEDURE water_point.insert();

Wyświetl plik

@ -31,7 +31,7 @@ SELECT
is_intermittent::int AS intermittent
FROM osm_water_lakeline
WHERE geometry && bbox
AND ((zoom_level BETWEEN 9 AND 13 AND LineLabel(zoom_level, NULLIF(name, ''), geometry))
AND ((zoom_level BETWEEN 3 AND 13 AND LineLabel(zoom_level, NULLIF(name, ''), geometry))
OR (zoom_level >= 14))
UNION ALL
SELECT
@ -46,12 +46,14 @@ SELECT
COALESCE(NULLIF(name_en, ''), name) AS name_en,
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
tags,
'lake'::text AS class,
class,
is_intermittent::int AS intermittent
FROM osm_water_point
WHERE geometry && bbox
AND (
(zoom_level BETWEEN 9 AND 13 AND area > 70000 * 2 ^ (20 - zoom_level))
-- Show a label if a water feature covers at least 1/4 of a tile or z14+
(tags->'place' IN ('sea', 'ocean') AND POWER(4,zoom_level) * earth_area > 0.25)
OR (zoom_level BETWEEN 3 AND 13 AND POWER(4,zoom_level) * earth_area > 0.25)
OR (zoom_level >= 14)
)
UNION ALL
@ -65,15 +67,15 @@ SELECT
COALESCE(NULLIF(name_en, ''), name) AS name_en,
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
tags,
place::text AS class,
COALESCE(NULLIF("natural",''), "place") AS class,
is_intermittent::int AS intermittent
FROM osm_marine_point
WHERE geometry && bbox
AND (
place = 'ocean'
OR (zoom_level >= "rank" AND "rank" IS NOT NULL)
OR (zoom_level >= 8)
);
AND CASE
WHEN place = 'ocean' THEN TRUE
WHEN zoom_level >= "rank" AND "rank" IS NOT NULL THEN TRUE
WHEN "natural" = 'bay' THEN zoom_level >= 13
ELSE zoom_level >= 8 END;
$$ LANGUAGE SQL STABLE
-- STRICT
PARALLEL SAFE;

Wyświetl plik

@ -9,14 +9,16 @@ layer:
This is based of the [osm-lakelines](https://github.com/openmaptiles/osm-lakelines) project
which derives nice centerlines from OSM water bodies. Only the most important lakes contain labels.
fields:
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the water body.
name_en: English name `name:en` if available, otherwise `name`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the water body. Language-specific values are in `name:xx`.
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
class:
description: |
Distinguish between `lake`, `ocean` and `sea`.
Distinguish between `lake`, `ocean`, `bay`, `strait`, and `sea`.
values:
- lake
- bay
- strait
- sea
- ocean
intermittent:
@ -33,8 +35,7 @@ layer:
query: (SELECT osm_id, geometry, name, name_en, name_de, {name_languages}, class, intermittent FROM layer_water_name(!bbox!, z(!scale_denominator!))) AS t
schema:
- ./update_marine_point.sql
- ./update_water_lakeline.sql
- ./update_water_point.sql
- ./update_water_name.sql
- ./water_name.sql
datasources:
- type: imposm3

Wyświetl plik

@ -282,7 +282,7 @@
"bridge"
]
],
"order": 103
"order": 111
},
{
"id": "waterway-bridge",
@ -322,7 +322,7 @@
"bridge"
]
],
"order": 104
"order": 112
},
{
"id": "water_way_name",
@ -367,7 +367,7 @@
"LineString"
]
],
"order": 142
"order": 151
}
]
}

Wyświetl plik

@ -1,4 +1,4 @@
DROP TRIGGER IF EXISTS trigger_important_waterway_linestring ON osm_important_waterway_linestring;
DROP TRIGGER IF EXISTS trigger_important_waterway_linestring_store ON osm_important_waterway_linestring;
DROP TRIGGER IF EXISTS trigger_store ON osm_waterway_linestring;
DROP TRIGGER IF EXISTS trigger_flag ON osm_waterway_linestring;
DROP TRIGGER IF EXISTS trigger_refresh ON waterway_important.updates;
@ -7,54 +7,185 @@ DROP TRIGGER IF EXISTS trigger_refresh ON waterway_important.updates;
-- This helps to drop not important rivers (since they do not have a name)
-- and also makes it possible to filter out too short rivers
CREATE INDEX IF NOT EXISTS osm_waterway_linestring_waterway_partial_idx
ON osm_waterway_linestring ((true))
-- Index for filling and updating osm_important_waterway_linestring table
CREATE UNIQUE INDEX IF NOT EXISTS osm_waterway_linestring_waterway_partial_idx
ON osm_waterway_linestring (osm_id)
WHERE name <> ''
AND waterway = 'river'
AND ST_IsValid(geometry);
-- Analyze created index
ANALYZE osm_waterway_linestring;
CREATE TABLE IF NOT EXISTS osm_important_waterway_linestring (
id SERIAL PRIMARY KEY,
geometry geometry,
id SERIAL,
geometry geometry('LineString'),
source_ids bigint[],
name varchar,
name_en varchar,
name_de varchar,
tags hstore
);
-- etldoc: osm_waterway_linestring -> osm_important_waterway_linestring
INSERT INTO osm_important_waterway_linestring (geometry, name, name_en, name_de, tags)
SELECT (ST_Dump(geometry)).geom AS geometry,
name,
name_en,
name_de,
tags
FROM (
SELECT ST_LineMerge(ST_Union(geometry)) AS geometry,
name,
name_en,
name_de,
slice_language_tags(tags) AS tags
FROM osm_waterway_linestring
WHERE name <> ''
AND waterway = 'river'
AND ST_IsValid(geometry)
GROUP BY name, name_en, name_de, slice_language_tags(tags)
) AS waterway_union;
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_geometry_idx ON osm_important_waterway_linestring USING gist (geometry);
ALTER TABLE osm_important_waterway_linestring ADD COLUMN IF NOT EXISTS source_ids bigint[];
-- Create osm_important_waterway_linestring_gen_z11 as a copy of osm_important_waterway_linestring but drop the
-- "source_ids" column. This can be done because z10 and z9 tables are only simplified and not merged, therefore
-- relations to sources are direct via the id column.
CREATE TABLE IF NOT EXISTS osm_important_waterway_linestring_gen_z11
(LIKE osm_important_waterway_linestring);
ALTER TABLE osm_important_waterway_linestring_gen_z11 DROP COLUMN IF EXISTS source_ids;
-- Create osm_important_waterway_linestring_gen_z10 as a copy of osm_important_waterway_linestring_gen_z11
CREATE TABLE IF NOT EXISTS osm_important_waterway_linestring_gen_z10
(LIKE osm_important_waterway_linestring_gen_z11);
-- Create osm_important_waterway_linestring_gen_z9 as a copy of osm_important_waterway_linestring_gen_z10
CREATE TABLE IF NOT EXISTS osm_important_waterway_linestring_gen_z9
(LIKE osm_important_waterway_linestring_gen_z10);
CREATE OR REPLACE FUNCTION insert_important_waterway_linestring_gen(update_id bigint) RETURNS void AS
$$
-- Create OneToMany-Relation-Table storing relations of a Merged-LineString in table
-- osm_important_waterway_linestring to Source-LineStrings from table osm_waterway_linestring
CREATE TABLE IF NOT EXISTS osm_important_waterway_linestring_source_ids(
id int,
source_id bigint,
PRIMARY KEY (id, source_id)
);
-- Ensure tables are emtpy if they haven't been created
TRUNCATE osm_important_waterway_linestring;
TRUNCATE osm_important_waterway_linestring_source_ids;
-- etldoc: osm_waterway_linestring -> osm_important_waterway_linestring
-- Merge LineStrings from osm_waterway_linestring by grouping them and creating intersecting
-- clusters of each group via ST_ClusterDBSCAN
INSERT INTO osm_important_waterway_linestring (geometry, source_ids, name, name_en, name_de, tags)
SELECT (ST_Dump(ST_LineMerge(ST_Union(geometry)))).geom AS geometry,
-- We use St_Union instead of St_Collect to ensure no overlapping points exist within the geometries
-- to merge. https://postgis.net/docs/ST_Union.html
-- ST_LineMerge only merges across singular intersections and groups its output into a MultiLineString
-- if more than two LineStrings form an intersection or no intersection could be found.
-- https://postgis.net/docs/ST_LineMerge.html
-- In order to not end up with a mixture of LineStrings and MultiLineStrings we dump eventual
-- MultiLineStrings via ST_Dump. https://postgis.net/docs/ST_Dump.html
array_agg(osm_id) as source_ids,
name,
name_en,
name_de,
slice_language_tags(tags) AS tags
FROM (
SELECT *,
-- Get intersecting clusters by setting minimum distance to 0 and minimum intersecting points to 1.
-- https://postgis.net/docs/ST_ClusterDBSCAN.html
ST_ClusterDBSCAN(geometry, 0, 1) OVER (
PARTITION BY name, name_en, name_de, slice_language_tags(tags)
) AS cluster,
-- ST_ClusterDBSCAN returns an increasing integer as the cluster-ids within each partition starting at 0.
-- This leads to clusters having the same ID across multiple partitions therefore we generate a
-- Cluster-Group-ID by utilizing the DENSE_RANK function sorted over the partition columns.
DENSE_RANK() OVER (ORDER BY name, name_en, name_de, slice_language_tags(tags)) as cluster_group
FROM osm_waterway_linestring
WHERE name <> '' AND waterway = 'river' AND ST_IsValid(geometry)
) q
GROUP BY cluster_group, cluster, name, name_en, name_de, slice_language_tags(tags);
-- Geometry Index
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_geometry_idx
ON osm_important_waterway_linestring USING gist (geometry);
-- Create Primary-Keys for osm_important_waterway_linestring and osm_important_waterway_linestring_gen_z11/z10/z9 tables
DO $$
BEGIN
IF NOT EXISTS (
SELECT constraint_name
FROM information_schema.table_constraints
WHERE table_name = 'osm_important_waterway_linestring' AND constraint_type = 'PRIMARY KEY'
) THEN
ALTER TABLE osm_important_waterway_linestring ADD PRIMARY KEY (id);
END IF;
IF NOT EXISTS (
SELECT constraint_name
FROM information_schema.table_constraints
WHERE table_name = 'osm_important_waterway_linestring_gen_z11' AND constraint_type = 'PRIMARY KEY'
) THEN
ALTER TABLE osm_important_waterway_linestring_gen_z11 ADD PRIMARY KEY (id);
END IF;
IF NOT EXISTS (
SELECT constraint_name
FROM information_schema.table_constraints
WHERE table_name = 'osm_important_waterway_linestring_gen_z10' AND constraint_type = 'PRIMARY KEY'
) THEN
ALTER TABLE osm_important_waterway_linestring_gen_z10 ADD PRIMARY KEY (id);
END IF;
IF NOT EXISTS (
SELECT constraint_name
FROM information_schema.table_constraints
WHERE table_name = 'osm_important_waterway_linestring_gen_z9' AND constraint_type = 'PRIMARY KEY'
) THEN
ALTER TABLE osm_important_waterway_linestring_gen_z9 ADD PRIMARY KEY (id);
END IF;
END;
$$ LANGUAGE plpgsql;
-- Index for storing OSM-IDs of Source-LineStrings
CREATE UNIQUE INDEX IF NOT EXISTS osm_waterway_linestring_osm_id_idx ON osm_waterway_linestring ("osm_id");
-- Indexes which can be utilized during full-update for queries originating from
-- insert_important_waterway_linestring_gen() function
CREATE UNIQUE INDEX IF NOT EXISTS osm_important_waterway_linestring_update_idx
ON osm_important_waterway_linestring (id) WHERE ST_Length(geometry) > 1000;
-- Analyze populated table with indexes
ANALYZE osm_important_waterway_linestring;
-- Store OSM-IDs of Source-LineStrings by intersecting Merged-LineStrings with their sources. This required because
-- ST_LineMerge only merges across singular intersections and groups its output into a MultiLineString if
-- more than two LineStrings form an intersection or no intersection could be found.
-- Execute after indexes have been created on osm_highway_linestring_gen_z11 to improve performance
INSERT INTO osm_important_waterway_linestring_source_ids (id, source_id)
SELECT m.id, m.source_id
FROM (
SELECT id, unnest(source_ids) AS source_id, geometry
FROM osm_important_waterway_linestring
) m
JOIN osm_waterway_linestring s ON (m.source_id = s.osm_id)
WHERE ST_Intersects(s.geometry, m.geometry)
ON CONFLICT (id, source_id) DO NOTHING;
-- Drop temporary Merged-LineString to Source-LineStrings-ID column
ALTER TABLE osm_important_waterway_linestring DROP COLUMN IF EXISTS source_ids;
CREATE SCHEMA IF NOT EXISTS waterway_important;
CREATE TABLE IF NOT EXISTS waterway_important.changes_z9_z10_z11
(
is_old boolean,
id integer,
PRIMARY KEY (is_old, id)
);
CREATE OR REPLACE FUNCTION insert_important_waterway_linestring_gen(full_update bool) RETURNS void AS
$$
DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh waterway z9 z10 z11';
-- Analyze tracking and source tables before performing update
ANALYZE waterway_important.changes_z9_z10_z11;
ANALYZE osm_important_waterway_linestring;
-- Remove entries which have been deleted from source table
DELETE FROM osm_important_waterway_linestring_gen_z11
USING waterway_important.changes_z9_z10_z11
WHERE full_update IS TRUE OR (
waterway_important.changes_z9_z10_z11.is_old IS TRUE AND
waterway_important.changes_z9_z10_z11.id = osm_important_waterway_linestring_gen_z11.id
);
-- etldoc: osm_important_waterway_linestring -> osm_important_waterway_linestring_gen_z11
INSERT INTO osm_important_waterway_linestring_gen_z11 (geometry, id, name, name_en, name_de, tags)
SELECT ST_Simplify(geometry, ZRes(12)) AS geometry,
@ -64,9 +195,28 @@ BEGIN
name_de,
tags
FROM osm_important_waterway_linestring
WHERE
(update_id IS NULL OR id = update_id) AND
ST_Length(geometry) > 1000;
WHERE (
full_update OR
EXISTS(
SELECT NULL
FROM waterway_important.changes_z9_z10_z11
WHERE waterway_important.changes_z9_z10_z11.is_old IS FALSE AND
waterway_important.changes_z9_z10_z11.id = osm_important_waterway_linestring.id
)
) AND ST_Length(geometry) > 1000
ON CONFLICT (id) DO UPDATE SET geometry = excluded.geometry, name = excluded.name, name_en = excluded.name_en,
name_de = excluded.name_de, tags = excluded.tags;
-- Analyze source table
ANALYZE osm_important_waterway_linestring_gen_z11;
-- Remove entries which have been deleted from source table
DELETE FROM osm_important_waterway_linestring_gen_z10
USING waterway_important.changes_z9_z10_z11
WHERE full_update IS TRUE OR (
waterway_important.changes_z9_z10_z11.is_old IS TRUE AND
waterway_important.changes_z9_z10_z11.id = osm_important_waterway_linestring_gen_z10.id
);
-- etldoc: osm_important_waterway_linestring_gen_z11 -> osm_important_waterway_linestring_gen_z10
INSERT INTO osm_important_waterway_linestring_gen_z10 (geometry, id, name, name_en, name_de, tags)
@ -77,9 +227,28 @@ BEGIN
name_de,
tags
FROM osm_important_waterway_linestring_gen_z11
WHERE
(update_id IS NULL OR id = update_id) AND
ST_Length(geometry) > 4000;
WHERE (
full_update OR
EXISTS(
SELECT NULL
FROM waterway_important.changes_z9_z10_z11
WHERE waterway_important.changes_z9_z10_z11.is_old IS FALSE AND
waterway_important.changes_z9_z10_z11.id = osm_important_waterway_linestring_gen_z11.id
)
) AND ST_Length(geometry) > 4000
ON CONFLICT (id) DO UPDATE SET geometry = excluded.geometry, name = excluded.name, name_en = excluded.name_en,
name_de = excluded.name_de, tags = excluded.tags;
-- Analyze source table
ANALYZE osm_important_waterway_linestring_gen_z10;
-- Remove entries which have been deleted from source table
DELETE FROM osm_important_waterway_linestring_gen_z9
USING waterway_important.changes_z9_z10_z11
WHERE full_update IS TRUE OR (
waterway_important.changes_z9_z10_z11.is_old IS TRUE AND
waterway_important.changes_z9_z10_z11.id = osm_important_waterway_linestring_gen_z9.id
);
-- etldoc: osm_important_waterway_linestring_gen_z10 -> osm_important_waterway_linestring_gen_z9
INSERT INTO osm_important_waterway_linestring_gen_z9 (geometry, id, name, name_en, name_de, tags)
@ -90,17 +259,39 @@ BEGIN
name_de,
tags
FROM osm_important_waterway_linestring_gen_z10
WHERE
(update_id IS NULL OR id = update_id) AND
ST_Length(geometry) > 8000;
WHERE (
full_update OR
EXISTS(
SELECT NULL
FROM waterway_important.changes_z9_z10_z11
WHERE waterway_important.changes_z9_z10_z11.is_old IS FALSE AND
waterway_important.changes_z9_z10_z11.id = osm_important_waterway_linestring_gen_z10.id
)
) AND ST_Length(geometry) > 8000
ON CONFLICT (id) DO UPDATE SET geometry = excluded.geometry, name = excluded.name, name_en = excluded.name_en,
name_de = excluded.name_de, tags = excluded.tags;
-- noinspection SqlWithoutWhere
DELETE FROM waterway_important.changes_z9_z10_z11;
RAISE LOG 'Refresh waterway z9 z10 z11 done in %', age(clock_timestamp(), t);
END;
$$ LANGUAGE plpgsql;
-- Ensure tables are emtpy if they haven't been created
TRUNCATE osm_important_waterway_linestring_gen_z11;
TRUNCATE osm_important_waterway_linestring_gen_z10;
TRUNCATE osm_important_waterway_linestring_gen_z9;
SELECT insert_important_waterway_linestring_gen(NULL);
SELECT insert_important_waterway_linestring_gen(TRUE);
-- Indexes for queries originating from insert_important_waterway_linestring_gen() function
CREATE UNIQUE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen_z11_update_idx
ON osm_important_waterway_linestring_gen_z11 (id) WHERE ST_Length(geometry) > 4000;
CREATE UNIQUE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen_z10_update_idx
ON osm_important_waterway_linestring_gen_z10 (id) WHERE ST_Length(geometry) > 8000;
-- Geometry Indexes
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen_z11_geometry_idx
ON osm_important_waterway_linestring_gen_z11 USING gist (geometry);
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen_z10_geometry_idx
@ -109,35 +300,57 @@ CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen_z9_geometry_idx
ON osm_important_waterway_linestring_gen_z9 USING gist (geometry);
-- Handle updates
-- Handle updates on
-- -- osm_waterway_linestring -> osm_important_waterway_linestring
-- -- osm_important_waterway_linestring -> osm_important_waterway_linestring_gen_z11
-- -- osm_important_waterway_linestring -> osm_important_waterway_linestring_gen_z10
-- -- osm_important_waterway_linestring -> osm_important_waterway_linestring_gen_z9
CREATE SCHEMA IF NOT EXISTS waterway_important;
CREATE OR REPLACE AGGREGATE array_cat_agg(anycompatiblearray) (
SFUNC=array_cat,
STYPE=anycompatiblearray,
INITCOND = '{}'
);
CREATE TABLE IF NOT EXISTS waterway_important.changes
(
id serial PRIMARY KEY,
osm_id bigint,
is_old boolean,
name character varying,
name_en character varying,
name_de character varying,
tags hstore
PRIMARY KEY (is_old, osm_id)
);
-- Store IDs of changed elements from osm_waterway_linestring table.
CREATE OR REPLACE FUNCTION waterway_important.store() RETURNS trigger AS
$$
BEGIN
IF (tg_op IN ('DELETE', 'UPDATE')) AND OLD.name <> '' AND OLD.waterway = 'river' THEN
INSERT INTO waterway_important.changes(is_old, name, name_en, name_de, tags)
VALUES (TRUE, OLD.name, OLD.name_en, OLD.name_de, slice_language_tags(OLD.tags));
INSERT INTO waterway_important.changes(is_old, osm_id)
VALUES (TRUE, old.osm_id) ON CONFLICT DO NOTHING;
END IF;
IF (tg_op IN ('UPDATE', 'INSERT')) AND NEW.name <> '' AND NEW.waterway = 'river' THEN
INSERT INTO waterway_important.changes(is_old, name, name_en, name_de, tags)
VALUES (FALSE, NEW.name, NEW.name_en, NEW.name_de, slice_language_tags(NEW.tags));
INSERT INTO waterway_important.changes(is_old, osm_id)
VALUES (FALSE, new.osm_id) ON CONFLICT DO NOTHING;
END IF;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
-- Store IDs of changed elements from osm_important_waterway_linestring table.
CREATE OR REPLACE FUNCTION waterway_important.important_waterway_linestring_store() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'UPDATE' OR tg_op = 'DELETE') THEN
INSERT INTO waterway_important.changes_z9_z10_z11 (is_old, id) VALUES (TRUE, old.id) ON CONFLICT DO NOTHING ;
END IF;
IF (tg_op = 'UPDATE' OR tg_op = 'INSERT') THEN
INSERT INTO waterway_important.changes_z9_z10_z11 (is_old, id) VALUES (FALSE, new.id) ON CONFLICT DO NOTHING;
END IF;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE TABLE IF NOT EXISTS waterway_important.updates
(
id serial PRIMARY KEY,
@ -161,93 +374,182 @@ BEGIN
-- REFRESH osm_important_waterway_linestring
-- Compact the change history to keep only the first and last version, and then uniq version of row
CREATE TEMP TABLE changes_compact AS
SELECT DISTINCT ON (name, name_en, name_de, tags)
name,
name_en,
name_de,
tags
FROM ((
SELECT DISTINCT ON (osm_id) *
FROM waterway_important.changes
WHERE is_old
ORDER BY osm_id,
id ASC
)
UNION ALL
(
SELECT DISTINCT ON (osm_id) *
FROM waterway_important.changes
WHERE NOT is_old
ORDER BY osm_id,
id DESC
)) AS t;
-- Analyze tracking and source tables before performing update
ANALYZE waterway_important.changes;
ANALYZE osm_waterway_linestring;
-- Fetch updated and deleted Merged-LineString from relation-table filtering for each Merged-LineString which
-- contains an updated Source-LineString.
-- Additionally attach a list of Source-LineString-IDs to each Merged-LineString in order to unnest them later.
CREATE TEMPORARY TABLE affected_merged_linestrings AS
SELECT m.id, array_agg(source_id) AS source_ids
FROM osm_important_waterway_linestring_source_ids m
WHERE EXISTS(
SELECT NULL
FROM waterway_important.changes c
WHERE c.is_old IS TRUE AND c.osm_id = m.source_id
)
GROUP BY id;
-- Analyze the created table to speed up subsequent queries
ANALYZE affected_merged_linestrings;
-- Delete all Merged-LineStrings which contained an updated or deleted Source-LineString
DELETE
FROM osm_important_waterway_linestring AS w
USING changes_compact AS c
WHERE w.name = c.name
AND w.name_en IS NOT DISTINCT FROM c.name_en
AND w.name_de IS NOT DISTINCT FROM c.name_de
AND w.tags IS NOT DISTINCT FROM c.tags;
FROM osm_important_waterway_linestring m
USING affected_merged_linestrings
WHERE affected_merged_linestrings.id = m.id;
DELETE
FROM osm_important_waterway_linestring_source_ids m
USING affected_merged_linestrings
WHERE affected_merged_linestrings.id = m.id;
INSERT INTO osm_important_waterway_linestring (geometry, name, name_en, name_de, tags)
SELECT (ST_Dump(geometry)).geom AS geometry,
name,
name_en,
name_de,
tags
-- Analyze the tables affected by the delete-query in order to speed up subsequent queries
ANALYZE osm_important_waterway_linestring;
ANALYZE osm_important_waterway_linestring_source_ids;
-- Create a table containing all LineStrings which should be merged
CREATE TEMPORARY TABLE linestrings_to_merge AS
-- Add all Source-LineStrings affected by this update
SELECT osm_id, NULL::INTEGER AS id, NULL::BIGINT[] AS source_ids, geometry, name, name_en, name_de,
slice_language_tags(tags) as tags
-- Table containing the IDs of all Source-LineStrings affected by this update
FROM (
SELECT ST_LineMerge(ST_Union(geometry)) AS geometry,
w.name,
w.name_en,
w.name_de,
slice_language_tags(w.tags) AS tags
FROM osm_waterway_linestring AS w
JOIN changes_compact AS c ON
w.name = c.name AND w.name_en IS NOT DISTINCT FROM c.name_en AND
w.name_de IS NOT DISTINCT FROM c.name_de AND
slice_language_tags(w.tags) IS NOT DISTINCT FROM c.tags
WHERE w.name <> ''
AND w.waterway = 'river'
AND ST_IsValid(geometry)
GROUP BY w.name, w.name_en, w.name_de, slice_language_tags(w.tags)
) AS waterway_union;
-- Get Source-LineString-IDs of deleted or updated elements
SELECT unnest(affected_merged_linestrings.source_ids)::bigint AS source_id FROM affected_merged_linestrings
UNION
-- Get Source-LineString-IDs of inserted or updated elements
SELECT osm_id AS source_id FROM waterway_important.changes WHERE is_old IS FALSE
ORDER BY source_id
) affected_source_linestrings
JOIN osm_waterway_linestring ON (
affected_source_linestrings.source_id = osm_waterway_linestring.osm_id
)
WHERE name <> '' AND waterway = 'river' AND ST_IsValid(geometry);
-- Drop temporary tables early to save resources
DROP TABLE affected_merged_linestrings;
-- Analyze the created table to speed up subsequent queries
ANALYZE linestrings_to_merge;
-- Add all Merged-LineStrings intersecting with Source-LineStrings affected by this update
INSERT INTO linestrings_to_merge
SELECT NULL::BIGINT AS osm_id, m.id,
ARRAY(
SELECT s.source_id FROM osm_important_waterway_linestring_source_ids s WHERE s.id = m.id
)::BIGINT[] AS source_ids,
m.geometry, m.name, m.name_en, m.name_de, m.tags
FROM linestrings_to_merge
JOIN osm_important_waterway_linestring m ON (ST_Intersects(linestrings_to_merge.geometry, m.geometry));
-- Analyze the created table to speed up subsequent queries
ANALYZE linestrings_to_merge;
-- Delete all Merged-LineStrings intersecting with Source-LineStrings affected by this update.
-- We can use the linestrings_to_merge table since Source-LineStrings affected by this update and present in the
-- table will have their ID-Column set to NULL by the previous query.
DELETE
FROM osm_important_waterway_linestring m
USING linestrings_to_merge
WHERE m.id = linestrings_to_merge.id;
DELETE
FROM osm_important_waterway_linestring_source_ids m
USING linestrings_to_merge
WHERE m.id = linestrings_to_merge.id;
-- Create table containing all LineStrings to and create clusters of intersecting LineStrings partitioned by their
-- groups
CREATE TEMPORARY TABLE clustered_linestrings_to_merge AS
SELECT *,
-- Get intersecting clusters by setting minimum distance to 0 and minimum intersecting points to 1.
-- https://postgis.net/docs/ST_ClusterDBSCAN.html
ST_ClusterDBSCAN(geometry, 0, 1) OVER (PARTITION BY name, name_en, name_de, tags) AS cluster,
-- ST_ClusterDBSCAN returns an increasing integer as the cluster-ids within each partition starting at 0.
-- This leads to clusters having the same ID across multiple partitions therefore we generate a
-- Cluster-Group-ID by utilizing the DENSE_RANK function sorted over the partition columns.
DENSE_RANK() OVER (ORDER BY name, name_en, name_de, tags) as cluster_group
FROM linestrings_to_merge;
-- Drop temporary tables early to save resources
DROP TABLE linestrings_to_merge;
-- Create index on cluster columns and analyze the created table to speed up subsequent queries
CREATE INDEX ON clustered_linestrings_to_merge (cluster_group, cluster);
ANALYZE clustered_linestrings_to_merge;
-- Create temporary Merged-LineString to Source-LineStrings-ID columns to store relations before they have been
-- intersected
ALTER TABLE osm_important_waterway_linestring ADD COLUMN IF NOT EXISTS new_source_ids BIGINT[];
ALTER TABLE osm_important_waterway_linestring ADD COLUMN IF NOT EXISTS old_source_ids BIGINT[];
WITH inserted_linestrings AS (
-- Merge LineStrings of each cluster and insert them
INSERT INTO osm_important_waterway_linestring (geometry, new_source_ids, old_source_ids, name, name_en, name_de,
tags)
SELECT (ST_Dump(ST_LineMerge(ST_Union(geometry)))).geom AS geometry,
-- We use St_Union instead of St_Collect to ensure no overlapping points exist within the geometries
-- to merge. https://postgis.net/docs/ST_Union.html
-- ST_LineMerge only merges across singular intersections and groups its output into a MultiLineString
-- if more than two LineStrings form an intersection or no intersection could be found.
-- https://postgis.net/docs/ST_LineMerge.html
-- In order to not end up with a mixture of LineStrings and MultiLineStrings we dump eventual
-- MultiLineStrings via ST_Dump. https://postgis.net/docs/ST_Dump.html
coalesce( array_agg(osm_id) FILTER (WHERE osm_id IS NOT NULL), '{}' )::BIGINT[] AS new_source_ids,
array_cat_agg(source_ids)::BIGINT[] as old_source_ids,
name,
name_en,
name_de,
tags
FROM clustered_linestrings_to_merge
GROUP BY cluster_group, cluster, name, name_en, name_de, tags
RETURNING id, new_source_ids, old_source_ids, geometry
)
-- Store OSM-IDs of Source-LineStrings by intersecting Merged-LineStrings with their sources.
-- This is required because ST_LineMerge only merges across singular intersections and groups its output into a
-- MultiLineString if more than two LineStrings form an intersection or no intersection could be found.
INSERT INTO osm_important_waterway_linestring_source_ids (id, source_id)
SELECT m.id, source_id
FROM (
SELECT id, source_id, geometry
FROM inserted_linestrings
CROSS JOIN LATERAL (
SELECT DISTINCT all_source_ids.source_id
FROM unnest(
array_cat(inserted_linestrings.new_source_ids, inserted_linestrings.old_source_ids)
) AS all_source_ids(source_id)
) source_ids
) m
JOIN osm_waterway_linestring s ON (m.source_id = s.osm_id)
WHERE ST_Intersects(s.geometry, m.geometry)
ON CONFLICT (id, source_id) DO NOTHING;
-- Cleanup remaining table
DROP TABLE clustered_linestrings_to_merge;
-- Drop temporary Merged-LineString to Source-LineStrings-ID columns
ALTER TABLE osm_important_waterway_linestring DROP COLUMN IF EXISTS new_source_ids;
ALTER TABLE osm_important_waterway_linestring DROP COLUMN IF EXISTS old_source_ids;
DROP TABLE changes_compact;
-- noinspection SqlWithoutWhere
DELETE FROM waterway_important.changes;
-- noinspection SqlWithoutWhere
DELETE FROM waterway_important.updates;
RAISE LOG 'Refresh waterway done in %', age(clock_timestamp(), t);
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION waterway_important.important_waterway_linestring_gen_refresh() RETURNS trigger AS
$$
BEGIN
IF (tg_op = 'DELETE' OR tg_op = 'UPDATE') THEN
DELETE FROM osm_important_waterway_linestring_gen_z11 WHERE id = old.id;
DELETE FROM osm_important_waterway_linestring_gen_z10 WHERE id = old.id;
DELETE FROM osm_important_waterway_linestring_gen_z9 WHERE id = old.id;
END IF;
IF (tg_op = 'UPDATE' OR tg_op = 'INSERT') THEN
PERFORM insert_important_waterway_linestring_gen(new.id);
END IF;
-- Update z11, z10 and z9 tables
PERFORM insert_important_waterway_linestring_gen(FALSE);
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trigger_important_waterway_linestring
CREATE TRIGGER trigger_important_waterway_linestring_store
AFTER INSERT OR UPDATE OR DELETE
ON osm_important_waterway_linestring
FOR EACH ROW
EXECUTE PROCEDURE waterway_important.important_waterway_linestring_gen_refresh();
EXECUTE PROCEDURE waterway_important.important_waterway_linestring_store();
CREATE TRIGGER trigger_store
AFTER INSERT OR UPDATE OR DELETE

Wyświetl plik

@ -18,10 +18,10 @@ layer:
buffer_size: 4
fields:
name: |
The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the waterway.
The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the waterway. Language-specific values are in `name:xx`.
The `name` field may be empty for NaturalEarth data or at lower zoom levels.
name_en: English name `name:en` if available, otherwise `name`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
class:
description: |
The original value of the [`waterway`](http://wiki.openstreetmap.org/wiki/Key:waterway) tag.

Wyświetl plik

@ -17,7 +17,7 @@ tileset:
- layers/poi/poi.yaml
- layers/aerodrome_label/aerodrome_label.yaml
name: OpenMapTiles
version: 3.14.0
version: 3.15.0
id: openmaptiles
description: "A tileset showcasing all layers in OpenMapTiles. https://openmaptiles.org"
attribution: '<a href="https://www.openmaptiles.org/" target="_blank">&copy; OpenMapTiles</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>'
@ -32,6 +32,7 @@ tileset:
- az # Azerbaijani, Latin
- be # Belorussian
- bg # Bulgarian
- bn # Bengali
- br # Breton, Latin
- bs # Bosnian, Latin
- ca # Catalan, Latin
@ -46,6 +47,7 @@ tileset:
- es # Spanish, Latin
- et # Estonian, Latin
- eu # Basque, Latin
- fa # Persian
- fi # Finnish, Latin
- fr # French, Latin
- fy # Western Frisian, Latin
@ -80,6 +82,8 @@ tileset:
- nl # Dutch, Latin
- "no" # Norwegian, Latin
- oc # Occitan (post 1500), Latin
- pa # Punjabi
- pnb # Western Punjabi
- pl # Polish, Latin
- pt # Portuguese, Latin
- rm # Romansh, Latin
@ -96,7 +100,11 @@ tileset:
- th # Thai
- tr # Turkish, Latin
- uk # Ukrainian
- ur # Urdu
- vi # Vietnamese, Latin
- zh # Chinese
- zh-Hant # Traditional Chinese
- zh-Hans # Simplified Chinese
defaults:
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
datasource:

Wyświetl plik

@ -70,18 +70,33 @@ echo "==========================================================================
echo " Docker check & Download images "
echo "-------------------------------------------------------------------------------------"
echo "====> : Please check the Docker and docker-compose version!"
echo " : We are using docker-compose v2 file format! see more at https://docs.docker.com/"
echo " : We are using docker-compose v3 file format! see more at https://docs.docker.com/"
echo " : Minimum required Docker version: $MIN_DOCKER_VER+"
echo " : Minimum required docker-compose version: $MIN_COMPOSE_VER+"
echo " : See the .travis build for the currently supported versions."
echo " : Your docker system:"
if ! command -v docker-compose &> /dev/null; then
DOCKER_COMPOSE_HYPHEN=false
else
DOCKER_COMPOSE_HYPHEN=true
fi
function docker_compose_command () {
if $DOCKER_COMPOSE_HYPHEN; then
docker-compose $@
else
docker compose $@
fi
}
docker --version
docker-compose --version
docker_compose_command --version
# based on: http://stackoverflow.com/questions/16989598/bash-comparing-version-numbers
function version { echo "$@" | tr -d 'v' | tr -cs '0-9.' '.' | awk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }'; }
COMPOSE_VER=$(docker-compose version --short)
COMPOSE_VER=$(docker_compose_command version --short)
if [ "$(version "$COMPOSE_VER")" -lt "$(version "$MIN_COMPOSE_VER")" ]; then
echo "ERR: Your Docker-compose version is known to have bugs, please update docker-compose!"
exit 1
@ -116,7 +131,7 @@ echo " : Started : $STARTDATE "
echo " : Your bash version: $BASH_VERSION"
echo " : Your OS : $OSTYPE"
docker --version
docker-compose --version
docker_compose_command --version
if [[ "$OSTYPE" == "linux-gnu" ]]; then
echo " "
@ -148,6 +163,8 @@ else
echo " "
fi
MBTILES_FILE=${MBTILES_FILE:-$(source .env ; echo "$MBTILES_FILE")}
echo " "
echo "-------------------------------------------------------------------------------------"
echo "====> : Stopping running services & removing old containers"
@ -165,8 +182,8 @@ make init-dirs
echo " "
echo "-------------------------------------------------------------------------------------"
echo "====> : Removing old MBTILES if exists ( ./data/${area}.mbtiles ) "
rm -f "./data/${area}.mbtiles"
echo "====> : Removing old MBTILES if exists ( ./data/$MBTILES_FILE ) "
rm -f "./data/$MBTILES_FILE"
echo " "
echo "-------------------------------------------------------------------------------------"
@ -193,7 +210,7 @@ if [[ "$USE_PRELOADED_IMAGE" == true ]]; then
echo " : Data license: https://osmdata.openstreetmap.de/info/license.html"
echo " : * Natural Earth from http://www.naturalearthdata.com"
echo " : Terms-of-use: http://www.naturalearthdata.com/about/terms-of-use"
echo " : * OpenStreetMap Lakelines data https://github.com/lukasmartinelli/osm-lakelines"
echo " : * OpenStreetMap Lakelines data https://github.com/openmaptiles/osm-lakelines"
echo " :"
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-data"
echo " : includes all data from the import-data image"
@ -214,7 +231,7 @@ else
echo " : Data license: https://osmdata.openstreetmap.de/info/license.html"
echo " : * Natural Earth from http://www.naturalearthdata.com"
echo " : Terms-of-use: http://www.naturalearthdata.com/about/terms-of-use"
echo " : * OpenStreetMap Lakelines data https://github.com/lukasmartinelli/osm-lakelines"
echo " : * OpenStreetMap Lakelines data https://github.com/openmaptiles/osm-lakelines"
echo " :"
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-data"
echo " : includes all data from the import-data image"
@ -229,7 +246,7 @@ echo "--------------------------------------------------------------------------
echo "====> : Start importing OpenStreetMap data: ${area} -> imposm3[./build/mapping.yaml] -> PostgreSQL"
echo " : Imposm3 documentation: https://imposm.org/docs/imposm3/latest/index.html "
echo " : Thank you Omniscale! "
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-osm "
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/blob/master/bin/import-osm "
echo " : The OpenstreetMap data license: https://www.openstreetmap.org/copyright (ODBL) "
echo " : Thank you OpenStreetMap Contributors ! "
make import-osm
@ -277,7 +294,7 @@ fi
echo " "
echo "-------------------------------------------------------------------------------------"
echo "====> : Start generating MBTiles (containing gzipped MVT PBF) using PostGIS. "
echo " : Output MBTiles: ./data/${area}.mbtiles "
echo " : Output MBTiles: $MBTILES_FILE "
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/blob/master/bin/generate-tiles "
make generate-tiles-pg
@ -291,8 +308,7 @@ echo "--------------------------------------------------------------------------
echo "====> : Inputs - Outputs md5sum for debugging "
rm -f ./data/quickstart_checklist.chk
{
find build -type f | sort | xargs md5sum
find data -type f | sort | xargs md5sum
find build data -type f -exec md5sum {} + | sort -k2
} >> ./data/quickstart_checklist.chk
cat ./data/quickstart_checklist.chk
@ -311,7 +327,7 @@ docker images | grep openmaptiles
echo " "
echo "-------------------------------------------------------------------------------------"
echo "====> : (disk space) We have created the new vectortiles ( ./data/${area}.mbtiles ) "
echo "====> : (disk space) We have created the new vectortiles ( ./data/$MBTILES_FILE ) "
echo " : Please respect the licenses (OdBL for OSM data) of the sources when distributing the MBTiles file."
echo " : Data directory content:"
ls -la ./data
@ -335,8 +351,11 @@ echo " Acknowledgments "
echo " Generated vector tiles are produced work of OpenStreetMap data. "
echo " Such tiles are reusable under CC-BY license granted by OpenMapTiles team: "
echo " https://github.com/openmaptiles/openmaptiles/#license "
echo " Maps made with these vector tiles must display a visible credit: "
echo "-------------------------------------------------------------------------------------"
echo " "
echo -e "\033[1m Maps made with these vector tiles must display a visible credit:\033[0m "
echo " © OpenMapTiles © OpenStreetMap contributors "
echo " "
echo "-------------------------------------------------------------------------------------"
echo " Thanks to all free, open source software developers and Open Data Contributors! "
echo "-------------------------------------------------------------------------------------"

Wyświetl plik

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="14"
height="14"
viewBox="0 0 14 14"
fill="none"
version="1.1"
id="svg29764"
sodipodi:docname="chocolate.svg"
inkscape:version="1.0.2 (e86c8708, 2021-01-15)">
<metadata
id="metadata29770">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs29768" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1265"
inkscape:window-height="714"
id="namedview29766"
showgrid="false"
inkscape:zoom="33.14"
inkscape:cx="-0.18165359"
inkscape:cy="7"
inkscape:window-x="55"
inkscape:window-y="56"
inkscape:window-maximized="0"
inkscape:current-layer="svg29764"
inkscape:pagecheckerboard="true"
inkscape:document-rotation="0" />
<circle
style="fill:#c77400;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;paint-order:stroke fill markers;fill-opacity:1"
id="path30353"
cx="6.8497281"
cy="7.0609536"
r="2.6554012" />
</svg>

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 1.8 KiB

Wyświetl plik

@ -0,0 +1,10 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0)">
<path d="M7 0C3.13444 0 0 3.13444 0 7C0 10.8656 3.13444 14 7 14C7.64556 14 8.16602 13.4795 8.16602 12.834C8.16602 12.5307 8.05384 12.2569 7.86328 12.0508C7.6805 11.8447 7.57227 11.5768 7.57227 11.2773C7.57227 10.6318 8.09273 10.1113 8.73828 10.1113H10.1113C12.258 10.1113 14 8.36932 14 6.22266C14 2.78488 10.8656 0 7 0V0ZM8.93359 1.30469C9.30185 1.30482 9.65499 1.45117 9.91539 1.71157C10.1758 1.97197 10.3221 2.3251 10.3223 2.69336C10.3225 2.87587 10.2867 3.05663 10.217 3.2253C10.1473 3.39398 10.045 3.54727 9.91608 3.67641C9.78711 3.80556 9.63397 3.90802 9.46539 3.97796C9.29681 4.04789 9.1161 4.08392 8.93359 4.08398C8.75109 4.08392 8.57038 4.04789 8.4018 3.97796C8.23322 3.90802 8.08007 3.80556 7.95111 3.67641C7.82215 3.54727 7.7199 3.39398 7.6502 3.2253C7.58051 3.05663 7.54473 2.87587 7.54492 2.69336C7.54506 2.3251 7.69141 1.97197 7.9518 1.71157C8.2122 1.45117 8.56534 1.30482 8.93359 1.30469V1.30469ZM5.03906 1.32422C5.22174 1.32403 5.40265 1.35987 5.57146 1.42969C5.74026 1.4995 5.89364 1.60193 6.02281 1.7311C6.15198 1.86027 6.2544 2.01365 6.32422 2.18245C6.39404 2.35125 6.42988 2.53217 6.42969 2.71484C6.42962 2.89735 6.39359 3.07806 6.32366 3.24664C6.25373 3.41522 6.15126 3.56836 6.02212 3.69733C5.89297 3.82629 5.73968 3.92854 5.57101 3.99823C5.40233 4.06793 5.22157 4.10371 5.03906 4.10352C4.67081 4.10338 4.31767 3.95703 4.05727 3.69663C3.79687 3.43624 3.65052 3.0831 3.65039 2.71484C3.6502 2.53234 3.68598 2.35158 3.75567 2.1829C3.82537 2.01422 3.92762 1.86093 4.05658 1.73179C4.18554 1.60265 4.33869 1.50018 4.50727 1.43025C4.67585 1.36031 4.85655 1.32429 5.03906 1.32422V1.32422ZM2.70703 4.44727C2.88954 4.44733 3.07025 4.48336 3.23883 4.55329C3.4074 4.62323 3.56055 4.72569 3.68951 4.85484C3.81848 4.98398 3.92073 5.13727 3.99042 5.30595C4.06012 5.47462 4.09589 5.65538 4.0957 5.83789C4.09557 6.20615 3.94922 6.55928 3.68882 6.81968C3.42842 7.08008 3.07529 7.22643 2.70703 7.22656C2.33877 7.22643 1.98564 7.08008 1.72524 6.81968C1.46484 6.55928 1.31849 6.20615 1.31836 5.83789C1.31817 5.65538 1.35394 5.47462 1.42364 5.30595C1.49334 5.13727 1.59559 4.98398 1.72455 4.85484C1.85351 4.72569 2.00666 4.62323 2.17524 4.55329C2.34382 4.48336 2.52452 4.44733 2.70703 4.44727V4.44727ZM11.2656 4.44727C11.4481 4.44733 11.6288 4.48336 11.7974 4.55329C11.966 4.62323 12.1191 4.72569 12.2481 4.85484C12.3771 4.98398 12.4793 5.13727 12.549 5.30595C12.6187 5.47462 12.6545 5.65538 12.6543 5.83789C12.6542 6.20615 12.5078 6.55928 12.2474 6.81968C11.987 7.08008 11.6339 7.22643 11.2656 7.22656C10.8974 7.22643 10.5442 7.08008 10.2838 6.81968C10.0234 6.55928 9.87709 6.20615 9.87695 5.83789C9.87676 5.65538 9.91254 5.47462 9.98223 5.30595C10.0519 5.13727 10.1542 4.98398 10.2831 4.85484C10.4121 4.72569 10.5653 4.62323 10.7338 4.55329C10.9024 4.48336 11.0831 4.44733 11.2656 4.44727V4.44727Z" fill="#734A08"/>
</g>
<defs>
<clipPath id="clip0">
<rect width="14" height="14" fill="white"/>
</clipPath>
</defs>
</svg>

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 3.0 KiB

Wyświetl plik

@ -1,3 +1,3 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5 0C3.34315 0 2 1.34315 2 3C2 3.35553 2.07398 3.68353 2.1875 4H7.8125C7.92602 3.68353 8 3.35553 8 3C8 1.34315 6.65685 0 5 0ZM9 0C8.59614 0 8.22667 0.105305 7.875 0.25C8.56297 0.968413 9 1.92676 9 3C9 3.34678 8.93108 3.67901 8.84375 4H11.8125C11.926 3.68353 12 3.35553 12 3C12 1.34315 10.6569 0 9 0ZM3.25 5L7 14L10.75 5H3.25Z" fill="#AC39AC"/>
<path d="M5 0C3.34315 0 2 1.34315 2 3C2 3.35553 2.07398 3.68353 2.1875 4H7.8125C7.92602 3.68353 8 3.35553 8 3C8 1.34315 6.65685 0 5 0ZM9 0C8.59614 0 8.22667 0.105305 7.875 0.25C8.56297 0.968413 9 1.92676 9 3C9 3.34678 8.93108 3.67901 8.84375 4H11.8125C11.926 3.68353 12 3.35553 12 3C12 1.34315 10.6569 0 9 0ZM3.25 5L7 14L10.75 5H3.25Z" fill="#C77400"/>
</svg>

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 456 B

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 456 B

Wyświetl plik

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 921 B

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 921 B

Wyświetl plik

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 1.7 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.7 KiB

Wyświetl plik

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="14"
height="14"
viewBox="0 0 14 14"
fill="none"
version="1.1"
id="svg29764"
sodipodi:docname="tattoo.svg"
inkscape:version="1.0.2 (e86c8708, 2021-01-15)">
<metadata
id="metadata29770">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs29768" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1265"
inkscape:window-height="714"
id="namedview29766"
showgrid="false"
inkscape:zoom="33.14"
inkscape:cx="7"
inkscape:cy="7"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="0"
inkscape:current-layer="svg29764"
inkscape:pagecheckerboard="true" />
<circle
style="fill:#ac39ac;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;paint-order:stroke fill markers"
id="path30353"
cx="6.8497281"
cy="7.0609536"
r="2.6554012" />
</svg>

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 1.7 KiB

Wyświetl plik

@ -0,0 +1,3 @@
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 1L0 8H8L4 1Z" fill="#D40000"/>
</svg>

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 142 B

Some files were not shown because too many files have changed in this diff Show More