Wykres commitów

39 Commity (master)

Autor SHA1 Wiadomość Data
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
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
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
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
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
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
Adam Laža f21b677083
OSM OpenMapTiles style (#1420)
* OpenMapTiles style

* Rename style snippets from layer_name.json to defaultstyle.json

* Add README to icons dir.

* Add README to icons dir.

* Rename snippets to style.json

* Fix spritezero - move icons to svg subdir

* Move icons from style/icons/svg directly to style/icons

Co-authored-by: Tomas Pohanka <TomPohys@gmail.com>
2022-10-06 16:09:21 +02:00
Brian Sperlongano f744f9c009
Upgrade to omt-tools v6, Imposm 0.11.1 and migrate SQL (#1246)
This PR migrates the SQL in the transportation and transportation_name layer to use the new imposm3 mappings which now map a separate primary key ID.
2021-10-14 11:38:28 -04:00
Adam Laža 0dc8c3256c
Rename generic layer.sql to actual_layer_name .sql (#1034)
Following layers had generic `layer.sql` name.

- `aerodrome_label`
- `aeroway`
- `housenumber`
- `mountain_peak`
- `park`
- `place`
- `poi`
- `transportation`
- `transportation_name`
- `water_name`

This PR renames `layer.sql` to `aerodrome_label.sql`, `aeroway.sql`...
2020-11-09 11:43:35 +02:00
Eva Jelinkova a36db48a3e
Revert "#766 remove housenumbers inside polygon and same number (#983)" (#1033)
This reverts commit 1685eaccbd.
2020-11-04 21:53:15 +01:00
Eva Jelinkova 8ba2e18dea
Revert "Housenumbers - diff update, multipolygons (#990)" (#1032)
This reverts commit f7d7a0ced3.
2020-11-04 21:07:09 +01:00
Eva Jelinkova 7a7e9326b9
adding ST_IsValid to housnumber geometry (#1015)
Adding check of geometry in layers/housenumber/housenumber_centroid.sql.
2020-10-12 15:05:20 +03:00
Frédéric Rodrigo 36b7533d3b
Add timers to trigger function (#1006)
Add timer to all trigger refresh functions to help point where the time is spend on update.
2020-10-08 16:57:16 +03:00
Eva Jelinkova f7d7a0ced3
Housenumbers - diff update, multipolygons (#990)
Following https://github.com/openmaptiles/openmaptiles/pull/983 - removing points also on multipolygons and checking only new geometry when updated.
2020-09-21 14:47:55 +03:00
Taro Matsuzawa aka. btm 1685eaccbd
#766 remove housenumbers inside polygon and same number (#983) 2020-09-16 17:06:48 +02:00
Frédéric Rodrigo bb2a4328f3
Make more simple incremental update (#944)
Replacing update on the whole table with an update only on changed rows.

The goal is to update more quickly by just updating the changing content.
The update now focus on osm_id of changed rows, it use index. Add a where clause tags != update_tags(tags, geometry) en ensure only update when changed.

It requires one more trigger and a table to store changed osm_id.

The UPDATE is keep in a function to be reusable for initial setup and trigger update.

I try many code layout before done it in this way with the goal to keep the code for initial pass and for update. It should have low impact on initial data load. Better performance for row update can be achieve with BEFORE UPDATE, but require to duplicate the logic.

It is not based on the already merged https://github.com/openmaptiles/openmaptiles/pull/896 because calling and update within a function for each updated row was not efficient for larger table (like housenumber).

It addresses #814.


* Remake update_peak_point use incremental update #814

* Make update_aerodrome_label_point use incremental update #814

* Make housenumber_centroid use incremental update #814

* Make update_continent_point use incremental update #814

* Make update_island_point use incremental update #814

* Make update_island_polygon use incremental update #814

* Remove dead code in update_state_point.sql

* Make update_state_point use incremental update #814

* Remove dead code in update_country_point.sql

* Make update_country_point use incremental update #814

* Make osm_poi_polygon use incremental update #814

Thanks @frodrigo
2020-08-28 11:03:27 +02:00
Frédéric Rodrigo 9bb17792a6
Remove alignment of AS in SQL and few others (#932)
* Remove alignment of AS in SQL

* Remove alignment of CREATE TABLE in SQL
2020-07-22 13:48:25 +02:00
Yuri Astrakhan 2b95d1cffa
Fix & optimize incorrect function declarations (#918)
* All functions that access database must be declared as `STABLE`, not `IMMUTABLE` -- because database can change at any moment, e.g. during an update
* there are a few functions that could be made `STRICT` -- passing `NULL` as a parameter will always result in a `NULL`, but for some reason that causes a significant decrease in perf.
* tagged one function as parallel safe

NOTE: somehow `ST_AsMVT()` method of tile generation is showing 70-90% slowdown with this patch. I am not sure of why this is happening. If the reason is the `IMMUTABLE` -> `STABLE` change, we may have to dig deeper into PG optimization
2020-06-17 12:15:26 -04:00
Yuri Astrakhan 6457419e0d
NOOP: Format all layer's SQL code (#917)
I would like to reformat all of our SQL to have a concise coding style.
This makes it far easier to understand the code for a casual contributor,
and lets us spot errors more easily.

Most importantly, it makes it much easier to grep (search) the code because it is more likely to be in the same syntax

Some key changes:
* SQL keywords are always UPPERCASE, e.g. `SELECT WHEN AS END ...`
* types, variables, aliases, and field names (identifiers) are always lower case
* `LANGUAGE 'plpgsql'` is now `LANGUAGE plpgsql` (no quotes)
* a few minor spacing/semicolon cleanups

P.S. Per @TomPohys request, `TABLE` is spelled using upper case despite being a type for consistency with PG Docs. Same for `LANGUAGE SQL` vs `LANGUAGE plpgsql`.
2020-06-08 12:19:55 -04:00
Jorge Sanz ace759590e
Parallel capability to layer functions (#728)
This PR allows queries to be parallelized on recent versions of Postgres. The `PARALLEL SAFE` modifier has been added to the layer functions and a PLPGSQL function to convert strings into number has been replaced.

`PARALLEL SAFE` is a modifier for `CREATE FUNCTION` available since Postgres 9.6, so this change does not break current OpenMapTiles supported database version. More details about this topic [here](https://www.postgresql.org/docs/current/parallel-safety.html) and at the reference documentation for [`CREATE FUNCTION`](https://www.postgresql.org/docs/current/sql-createfunction.html).

### Testing procedure

The procedure to test this was:

* Imported `spain.pbf` in a clean environment
* Dumped the OpenMapTiles database from the Postgres Docker image
* Created a clean Postgres 12 database using the default Docker image
* Installed `postgis` 3 from the default Debian package and `osml10n` 2.5.8 from the repository (`make`, etc.)
* Restored the dump
* Lowered the postgres planner parameters for triggering parallel plans:
```sql
set parallel_setup_cost = 5;
set parallel_tuple_cost = 0.005;
```
* Manually added the `PARALLEL SAFE` modifier to each function involved in layer queries (not on updates or inserting functions).
* For each layer, run a testing query to confirm parallel workers were created, something like this:
```sql
explain analyze 
select * from layer_aerodrome_label(tilebbox(8,128,95),10,null)
union all
select * from layer_aerodrome_label(tilebbox(8,128,97),10,null);
```
* After all the layers were processed and confirmed to start parallel executions, a more complete example was run. This example just retrieves the geometries for all the layers from the same tile but without using any MVT related function.

<details><summary>Testing query</summary>

```sql
-- Using the function layer_landuse
explain analyze 
select geometry from layer_water(tilebbox(14,8020,6178),14)
union all
select geometry from layer_waterway(tilebbox(14,8020,6178),14)
union all
select geometry from layer_landcover(tilebbox(14,8020,6178),14)
union all
select geometry from layer_landuse(tilebbox(14,8020,6178),14)
union all
select geometry from layer_mountain_peak(tilebbox(14,8020,6178),14)
union all
select geometry from layer_park(tilebbox(14,8020,6178),14)
union all
select geometry from layer_boundary(tilebbox(14,8020,6178),14)
union all
select geometry from layer_aeroway(tilebbox(14,8020,6178),14)
union all
select geometry from layer_transportation(tilebbox(14,8020,6178),14)
union all
select geometry from layer_building(tilebbox(14,8020,6178),14)
union all
select geometry from layer_water_name(tilebbox(14,8020,6178),14)
union all
select geometry from layer_transportation_name(tilebbox(14,8020,6178),14)
union all
select geometry from layer_place(tilebbox(14,8020,6178),14)
union all
select geometry from layer_housenumber(tilebbox(14,8020,6178),14)
union all
select geometry from layer_poi(tilebbox(14,8020,6178),14)
union all
select geometry from layer_aerodrome_label(tilebbox(14,8020,6178),14);
```
</details>

You can inspect the execution plan and results on [this page](https://explain.dalibo.com/plan/3z). Also [attaching](https://github.com/openmaptiles/openmaptiles/files/3951822/explain-tile-simple.tar.gz) the query and JSON output for future reference. The website gives a ton of details, but you may want to search for nodes mentioning `workers` or `parallel` like in this area referring to `osm_border` or `osm_aeroway_linestring` entities

![image](https://user-images.githubusercontent.com/188264/70647153-9cac9300-1c48-11ea-96ea-ac7a1e2f4a79.png)

### Next steps

Since the execution plan is not showing a parallel append at the top level, meaning it's not running each layer individually, I want to continue experimenting with parameters and queries to see if it's possible to even parallelize more the request.

I will post my finding here, even no change in the code should happen.


cc. @nyurik

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
2020-01-31 19:36:02 -05:00
Yuri Astrakhan 9d6dbfc64f
Use one pass docs image generation (#751)
quicker and cleaner diagram image generation.
Remove etl-graph and mapping-graph targets - redundant

Also, the obsolete "fields" is still in Imposm's code and both names are accepted,
but "fields" is not documented anywhere (PR submitted), and could be removed at any moment.

Our docs were not supporting it until this PR, so renaming it at the same time.

Several images have been updated due to a more inclusive mapping scan
Requires https://github.com/openmaptiles/openmaptiles-tools/pull/147 (merged)
2020-01-22 21:55:22 -05:00
Yuri Astrakhan eca13f9bed
Refreshed all diagrams, fixed automation & 2 broken graphs (#692)
Seems like etl and mapping diagrams have been neglected
for a long time. Now it regenerates the files and places
them in the source dir.

This PR also fixes two broken files:
* layers/aerodrome_label/mapping_diagram.png
* layers/housenumber/mapping_diagram.png

They were generated using the newest tools version with the fix
https://github.com/openmaptiles/openmaptiles-tools/pull/65
2019-10-26 21:28:43 -04:00
Yuri Astrakhan 8fe9af2327
Minor trailing whitespace cleanup (#596)
Remove extra spaces in a number of files.
2019-03-29 17:15:42 -04:00
jirik 3cee3c7f80 Update diagrams 2017-12-04 12:06:28 +01:00
Eduard Popov 0a26d2be99 Housenumber and POI calc optimisation (#247)
Using NPoints(Centroid) = NPoints, thanks edpop
2017-05-21 21:01:31 -04:00
stirringhalo 153976735f ST_PointOnSurface instead of topoint 2017-01-17 09:03:40 -05:00
Lukas Martinelli 2d586bb47a Merge pull request #131 from openmaptiles/trigger_tables_sql
Daily updates
2017-01-16 09:38:47 +01:00
stirringhalo cda3af9215 Change SELECT to PERFORM in function and drop triggers first 2017-01-06 20:33:43 -05:00
stirringhalo b58d80ce44 Make housenumber rerunnable 2017-01-05 14:39:04 -05:00
Lukas Martinelli f361d3d9fd Add better title to layer READMEs 2017-01-05 17:31:21 +01:00
Lukas Martinelli 8a9b1246d3 Link to openmaptiles.org for layer doc 2017-01-05 17:29:18 +01:00
stirringhalo 8b4777fd79 poi and housenumber triggers 2017-01-04 17:54:15 -05:00
stirringhalo b97e5ad9fb Convert housenumber point conversion to function 2017-01-04 17:40:59 -05:00
ImreSamu f5ac3def5e etldoc fixes 2016-12-04 02:52:52 +01:00
Lukas Martinelli a98ede7ab2 Remove generated docs from repo 2016-11-29 11:07:29 +01:00
ImreSamu 63cdc3362d add etldoc to layer_housenumber 2016-11-10 01:11:11 +01:00
lukasmartinelli 447ae9f500 Add explanation to README 2016-10-30 16:31:38 +01:00
lukasmartinelli 263d7e8a96 Add docs for landcover, landuse and housenumber 2016-10-30 16:07:47 +01:00
lukasmartinelli 4c85fd787e Add layer housenumber 2016-10-25 19:16:18 +02:00