Commit Graph

52 Commits

Author SHA1 Message Date
systemed 2b25f4ee8f Add per-layer ability to disable multipoints 2024-10-13 22:17:33 +01:00
SomeoneElseOSM 0f3109d1ce Explicitly added lua5.1 to the install list (#727) 2024-10-13 21:42:57 +01:00
John Bayly 6ecacf4646 Add optional --quiet flag to tilemaker (#754) 2024-10-13 21:37:08 +01:00
John Bayly a9681849dd Add AllKeys and AllTags Lua functions (#755)
See systemed/tilemaker#748
2024-10-13 21:35:18 +01:00
Colin Dellow fe8399e522 use libdeflate rather than zlib (#769) 2024-10-13 18:03:44 +01:00
Colin Dellow 28d7e99a39 docs: adjust role explanation for NextRelation (#757)
The current docs describe a single return value that is an array of size 2,
but the `NextRelation()` function actually has two return values.

See https://www.lua.org/pil/5.1.html for more.

Hat tip to @BenOnTrack, who noticed it in https://github.com/systemed/tilemaker/discussions/749
2024-09-20 17:21:10 +01:00
Martijn van Laar b89b0ebd7e Update RUNNING.md docker old config name (#721)
Replace the old config name with the new .json extension.
2024-05-15 10:08:59 +01:00
Daniel J. H 122ee1b68f Improves docker setup for basic usage to get started more easily (#713) 2024-05-08 17:55:02 +01:00
Colin Dellow ad86ab4a01 remove FAT_TILE_INDEX (#700) 2024-04-01 17:24:47 +01:00
systemed e9914c8d5b Standalone coastline config and docs 2024-01-18 20:56:51 +00:00
Richard Fairhurst ab82368d91 Mac SIP prevents manpages being installed 2024-01-15 12:03:05 +00:00
systemed 27fc25baaf Homebrew formula is now just 'lua' 2024-01-15 00:10:32 +00:00
systemed 4d946868d3 Update docs 2024-01-14 23:52:54 +00:00
systemed 4230c3db2d Simplify runtime options
This changes the default to lazy geometries for both in-memory and on-disk.
--fast selects materialized geometries when running in memory, and unsharded
stores when running on disk.
2024-01-14 23:20:13 +00:00
systemed 5313711f31 Update documentation 2024-01-10 22:41:27 +00:00
systemed 9080cdb10e Merge branch 'way_keys' into v3 2024-01-10 18:01:27 +00:00
systemed 73ac9ce1fe Remove Mapsplit support 2024-01-10 17:00:04 +00:00
systemed e0a4ad7d4e Changelog and readme update 2024-01-10 16:31:01 +00:00
Colin Dellow abb2e95f83 Merge remote-tracking branch 'origin/master' into lua-interop-3 2024-01-07 13:51:46 -05:00
Colin Dellow 2bb131b5c4 run Docker build on PRs (#627) 2023-12-30 13:43:35 +00:00
Colin Dellow 3c1740ad4d generalize node_keys; add way_keys
This PR generalizes the idea of `node_keys`, adds `way_keys`, and fixes #402.

I'm not too sure if this is generally useful - it's useful for one of my
use cases, and I see someone asking about it in https://github.com/systemed/tilemaker/issues/190
and, elsewhere, in https://github.com/onthegomap/planetiler/issues/99

If you feel it complicates the maintainer story too much, please reject.

The goal is to reduce memory usage for users doing thematic extracts by
not indexing nodes that are only used by uninteresting ways.

For example, North America has ~1.8B nodes, needing 9.7GB of RAM for its node
store. By contrast, if your interest is only to build a railway map, you
require only ~8M nodes, needing 70MB of RAM. Or, to build a map of
national/provincial parks, 12M nodes and ~120MB of RAM.

Currently, a user can achieve this by pre-filtering their PBF using
osmium-tool. If you know exactly what you want, this is a good
long-term solution. But if you're me, flailing about in the OSM data
model, it's convenient to be able to tweak something in the Lua script
and observe the results without having to re-filter the PBF and update
your tilemaker command to use the new PBF.

Sample use cases:

```lua
-- Building a map without building polygons, ~ excludes ways whose
-- only tags are matched by the filter.
way_keys = {"~building"}
```

```lua
-- Building a railway map
way_keys = {"railway"}
```

```lua
-- Building a map of major roads
way_keys = {"highway=motorway", "highway=trunk", "highway=primary", "highway=secondary"}`
```

Nodes used in ways which are used in relations (as identified by
`relation_scan_function`) will always be indexed, regardless of
`node_keys` and `way_keys` settings that might exclude them.

A concrete example, given a Lua script like:

```lua
function way_function()
  if Find("railway") ~= "" then
    Layer("lines", false)
  end
end
```

it takes 13GB of RAM and 100 seconds to process North America.

If you add:

```lua
way_keys = {"railway"}
```

It takes 2GB of RAM and 47 seconds.

Notes:

1. This is based on `lua-interop-3`, as it interacts with files that are
   changed by that. I can rebase against master after lua-interop-3 is
   merged.

2. The names `node_keys` and `way_keys` are perhaps out of date, as they
   can now express conditions on the values of tags in addition to their
   keys. Leaving them as-is is nice, as it's not a breaking change.
   But if breaking changes are OK, maybe these should be
   `node_filters` and `way_filters` ?

3. Maybe the value for `node_keys` in the OMT profile should be
   expressed in terms of a negation, e.g. `node_keys = {"~created_by"}`?
   This would avoid issues like https://github.com/systemed/tilemaker/issues/337

4. This also adds a SIGUSR1 handler during OSM processing, which prints
   the ID of the object currently being processed. This is helpful for
   tracking down slow geometries.
2023-12-29 18:02:11 -05:00
Colin Dellow 53b48e24d0 lua: use non-member functions for interop
Currently, Tilemaker uses member functions for interop:

```lua
function node_function(node)
    node:Layer(...)
```

This PR changes Tilemaker to use global functions:

```lua
function node_function()
    Layer(...)
```

The chief rationale is performance. Every member function call needs to
push an extra pointer onto the stack when crossing the Lua/C++ boundary.

Kaguya serializes this pointer as a Lua userdata. That means every
call into Lua has to malloc some memory, and every call back from Lua
has to dereference through this pointer.

And there are a lot of calls! For OMT on the GB extract, I counted
~1.4B calls from Lua into C++.

A secondary rationale is that a global function is a bit more honest.
A user might believe that this is currently permissible:

```lua
last_node = nil
function node_function(node)
    if last_node ~= nil
        -- do something with last_node
    end

    -- save the current node for later, for some reason
    last_node = node
```

But in reality, the OSM objects we pass into Lua don't behave quite
like Lua objects. They're backed by OsmLuaProcessing, who will move
on, invalidating whatever the user thinks they've got a reference to.

This PR has a noticeable decrease in reading time for me, measured
on the OMT profile for GB, on a 16-core computer:

Before:
```
real	1m28.230s
user	19m30.281s
sys	0m29.610s
```

After:
```
real	1m21.728s
user	17m27.150s
sys	0m32.668s
```

The tradeoffs:

- anyone with a custom Lua profile will need to update it, although the
  changes are fairly mechanical

- Tilemaker now reserves several functions in the global namespace,
  causing the potential for conflicts
2023-12-28 16:42:40 -05:00
Colin Dellow ae1981b0f0 use vtzero instead of libprotobuf (#625) 2023-12-28 21:31:01 +00:00
Richard Fairhurst 5acee418ba PMTiles support (#620) 2023-12-22 10:45:05 +00:00
systemed ff0b9d6676 Merge branch 'master' into refactor_geometries 2023-11-19 18:06:53 +00:00
Nakaner ff60b8d9de Document new optional argument minzoom of (node|way):Attribute function (#585)
The feature was introduced by #219.
2023-11-17 16:32:38 +00:00
systemed 4db8c25417 Merge branch 'master' into refactor_geometries 2023-11-04 12:58:56 +00:00
Masamune Ishihara ba3fc62377 Change example configration compress parameter to "gzip" (#554) 2023-10-20 08:40:46 +01:00
Richard Fairhurst dbdb4da097 RestartRelations() to reset relation subscript (#548) 2023-10-09 11:30:03 +01:00
systemed 0ea137fedb Per-tile feature limit as per #547 2023-10-03 17:52:02 +01:00
Robin Hutmacher 9a377a690e Update RUNNING.md (#510) 2023-08-04 12:33:31 +01:00
Richard Fairhurst 6078f073e6 Squawk if user has pratted around with way IDs (#509) 2023-07-23 08:57:59 +01:00
Richard Fairhurst 528aa25dec Support type=boundary relations as native multipolygons (#508) 2023-07-23 08:57:39 +01:00
Richard Fairhurst 4a85c60e6d Compile-time option for float ZOrder (#486) 2023-03-31 15:10:30 +01:00
Richard Fairhurst 06e0b2820b Configurable sort order (#485) 2023-03-31 15:09:58 +01:00
Richard Fairhurst 9625dce266 Send project name to init_function (#438) 2022-10-15 11:17:30 +01:00
Aarni Koskela 92d38d37ce Report missing layer the same way other config errors are reported (#420) 2022-09-27 20:54:59 +01:00
Richard Fairhurst 1f9a564d02 High-resolution geometries at max zoom level (#384) 2022-02-17 10:44:10 +00:00
systemed 7945f6e159 Update man page 2022-02-10 11:50:17 +00:00
systemed 4bfb415e7f Update docs 2022-02-05 15:33:25 +00:00
Richard Fairhurst 965f6ae349 (Non-multipolygon) relation support (#360) 2022-01-08 10:12:08 +00:00
systemed 670d21a6ca Warn about incomplete entities in pbfs 2022-01-04 08:59:44 +00:00
ǝɹʇʇɐʃǝ◖ xıʃǝɟ d7e66c4fed Update some documentation and Dockerfile with recent versions (#303) 2021-09-10 14:11:52 +01:00
Wouter van Kleunen 474e8bb852 Rely on provided rapidjson dependency + cmake (#306)
* Rely on packaged rapidjson dependency

* Add rapidjson to cmake

* Add -pthread option to LIB flags variable in Makefile.

* Allow environment setting of CXXFLAGS.

* Avoid git during build

* Github CI build using ubuntu 18.04

Co-authored-by: Felix Delattre <felix@delattre.de>
2021-09-10 14:01:59 +01:00
ǝɹʇʇɐʃǝ◖ xıʃǝɟ edd8a4ee27 Add man page for tilemaker (#299) 2021-08-28 22:05:02 +01:00
Michael Reichert ca0fd702c3 Add z_order sorting support (#283)
* Add support for a z_order field and sort output objects by z_order

PostGIS import tools like Osm2pgsql and Imposm can write a z_order field
to the database table in order to allow map styles to render features
ordered by road class and vertical layer. Tilemaker now gets a Lua
callback to set the z_order for an OSM object (default 0) and will sort
the vectortile features by z_order. z_order is also taken into account
for combining of features. z_order values are limited to 1-byte unsigned
integer.

* Document new ZOrder callback function

* Drop unnecessary variable

* Implement z_order sorting for the OpenMapTiles example config

This commit also adapts the minimum zoom levels to the lastest version.
2021-08-23 13:37:24 +01:00
Hsieh Chin Fan fe1f1f5ca5 Update instruction of Github Workflow (#264)
Good to go only if there is a new release v2.0.0
2021-07-09 13:30:45 +01:00
systemed 6fa5d4b2e7 Update docs 2021-07-09 10:10:47 +01:00
systemed 60d087d789 Update docs 2021-07-02 16:56:12 +01:00
Richard Fairhurst ead23531c4 Add :Centroid method to get lat/lon from Lua (#230) 2021-04-26 18:47:10 +01:00