61 Commits

Author SHA1 Message Date
Richard Fairhurst ea8d2151a9 Allow combine_lines_below on each layer (#850)
Co-authored-by: Etilène Jourdier <etienne.jourdier@gmail.com>
2025-09-30 14:45:19 +01:00
Richard Fairhurst 13b841d58f Visvalingam-Whyatt simplification (#772) 2024-10-19 11:34:29 +01:00
Daniel J. H. 868d514394 Adds documentation on how to use config paths with docker, closes #720 (#722) 2024-10-18 10:55:44 +01:00
Mark b863710a66 docs: fix docker command syntax and add code formatting in README.md (#732) 2024-10-18 10:40:00 +01:00
Colin Dellow fe8399e522 use libdeflate rather than zlib (#769) 2024-10-13 18:03:44 +01:00
Daniel J. H 253b3cb8e4 Adds convenience scripts to download coastline and landuse data, see #720 (#723) 2024-05-28 15:58:02 +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
systemed 333316b318 Mention --store in the readme 2024-01-18 19:42:03 +00:00
systemed 172d13327c A short note to remember @kleunen 2024-01-15 15:11:42 +00:00
systemed ff55eea7dd Document landcover files 2024-01-15 00:30:09 +00:00
systemed 5313711f31 Update documentation 2024-01-10 22:41:27 +00:00
systemed e0a4ad7d4e Changelog and readme update 2024-01-10 16:31:01 +00:00
Richard Fairhurst 5acee418ba PMTiles support (#620) 2023-12-22 10:45:05 +00:00
Colin Dellow 8300b0cdd9 Alternate node store (#590)
* refactor NodeStore

I'd like to add an alternative NodeStore that can be used when the
`Type_then_ID` property is present in the PBF.

First, a small (?) refactor:

- make `NodeStore` an interface, with two concrete implementations
- extract the NodeStore related things to their own files
- this will cause some churn, as they'll depend on things that also
  need to get extracted to their own files. Short term pain, hopefully
  long term gain in faster compile times.

Changing the invocations of the functions to be virtual may have impact
on performance. Will need to revisit that before committing to virtual
methods.

* change how work is assigned for ReadPhase::Nodes

Currently, when a worker needs work, it gets the next unprocessed block.
This means blocks are read sequentially at a global level, but from
the perspective of each worker, there are gaps in the blocks they see.

For nodes, we'd prefer to give each worker thread contiguous blocks
from the underlying PBF. This will enable a more efficient storage
for PBFs with the `Sort.Type_then_ID` flag.

* add SortedNodeStore

SortedNodeStore is uesful for PBFs with the `Sort.Type_then_ID`
property, e.g. the planet and Geofabrik exports.

It stores nodes in a hierarchy:

- Level 1 is groups: there are 256K groups
- Level 2 is chunks: each group has 256 chunks
- Level 3 is nodes: each chunk has 256 nodes

This allows us to store 2^34 nodes, with a fixed overhead of
only 2M -- the space required for the level 1 pointers.

Groups and chunks store their data sparsely. If a group has 7 chunks,
it only uses storage for 7 chunks.

On Great Britain's 184M node PBF, it needs ~9.13 bytes per node.

Looking up a node can be done in fixed time:

First, get some offsets:
- Group: `nodeID / 65536`
- Chunk: `(nodeID / 65536) / 256`
- Position within chunk: `nodeID % 256`

For example, Cape Chignecto Provincial Park has ID 4855703, giving:
- Group 74
- Chunk 23
- Offset 151

Group 74's chunks may be sparse. To map chunk 23 to its physical
location, each group has a 256-bit bitmask indicating which
chunks are present.

Use its physical location to get its `chunkOffset`. That allows you
to get to the `ChunkInfo` struct.

From there, do the same thing to get the node data.

This design should also let us do some interesting things down the road,
like efficiently compressing each chunk using something like delta
encoding, zigzag encoding and bit packing. Then, to avoid paying a
decompression cost, we'd likely give each worker a cache of uncompressed
chunks.

* cmake build

* tidy up

* tweak

* tweak

* derp

* mac/windows build

* fix build?

I don't understand why these can't be passed as a copy in the Windows
and Mac builds. Whatever, try passing a reference.

* fix --store

I think nested containers may not be wired up quite correctly.
Instead, manage the char* buffers directly, rather than as
`std::vector<char>`

I'll fixup the other aspects (attributing libpopcnt, picking
Sorted vs BinarySearch on the fly) later

* attribution for libpopcnt

* simplify read_pbf

All read phases use the same striding-over-batches-of-blocks approach.

This required changing how progress is reported, as block IDs are no
longer globally montonically increasing.

Rather than thread the state into ReadBlock, I just adopted 2 atomic
counters for the whole class -- the progress reporter already assumes
that it's the only thing dumping to stdout, so the purity of avoiding
class-global doesn't buy us anything.

* clear allocatedMemory

* use scale factor 16, not 8

D'oh, if you get a full group where each chunk is full, you need to be
able to express a value _ever so slightly_ larger than 65,536.

North America and Europe have examples of this.

Use a scale factor of 16, not 8. This'll mean some chunks have up to 15
wasted bytes, but it's not a huge deal. (And I have some thoughts on how
to claw it back.)

* comment out debug stats

* windows build

* derp

* use SortedNodeStore if PBFs have Sort.Type_then_ID

* add --compress-nodes

If the user passes `--compress-nodes`, we use [streamvbyte](https://github.com/lemire/streamvbyte)
to compress chunks of nodes in memory.

The impact on read time is not much:
- GB with `--compress-nodes`: 1m42s
- without: 1m35s

But the impact on memory is worthwhile, even across very different
extracts:

North America - 5.52 bytes/node vs 8.48 bytes/node
169482 groups, 18364343 chunks, 1757589784 nodes, needed 9706167278 bytes
169482 groups, 18364343 chunks, 1757589784 nodes, needed 14916095182 bytes

Great Britain - 5.97 bytes/node vs 9.25 bytes/node
163074 groups, 4871807 chunks, 184655287 nodes, needed 1104024510 bytes
163074 groups, 4871807 chunks, 184655287 nodes, needed 1708093150 bytes

Nova Scota - 5.81 bytes/node vs 8.7 bytes/node
26777 groups, 157927 chunks, 12104733 nodes, needed 70337950 bytes
26777 groups, 157927 chunks, 12104733 nodes, needed 105367598 bytes

Monaco - 10.43 bytes/node vs 13.52 bytes/node
1196 groups, 2449 chunks, 30477 nodes, needed 318114 bytes
1196 groups, 2449 chunks, 30477 nodes, needed 412258 bytes

* build

* build

* remove __restrict__ to satisfy windows build

* remove debug print, small memory optimization

* use an arena for small groups

* omit needless words

* better short-circuiting for Type-then-ID PBFs

Track metadata about which blocks have nodes, ways and relations.
By default, we assume any block may contain nodes, ways or relations.

If the PBF supports Type-then-ID PBFs, do a binary search to find the first
blocks with ways and relations.

This means ReadPhase::Nodes can stop without scanning ways/relations.
In addition to avoiding needless work, it makes it easier to assign
each worker a balanced amount of work -- now each worker has only
blocks with nodes, which are about the same effort computationally.

It also makes ReadPhase::ScanRelations faster, as it scans exactly the
blocks with relations, skipping the blocks with ways.

Similarly, ReadPhase::Ways is a bit faster, as it doesn't have to read
the blocks with relations.

For North America, this reduces the time to complete the Nodes and
RelationsScan phase from 2m30s to 1m20s.

For GB, it reduces the time from 22s to 9s.

* ReadPhase::Relations - more parallelism

When processing relations for small extracts, there are often fewer
blocks than cores.

Instead, divide the work more granularly, assigning each of the N
threads 1/Nth of the block to process.

This saves 4-5 seconds (which is cumulatively ~20% of runtime) for
the Canadian province of Nova Scotia.

* extract WayStore, BinarySearchWayStore

* stub in SortedWayStore

...it just throws a lot of exceptions at the moment.

* put SortedNodeStore in a namespace

Also replace some `#define`s with `const`s.

I'm likely going to reuse some names in SortedWayStore, so namespacing
to avoid conflicts.

* don't use SortedWayStore if LocationsOnWays present

* stub in insertLatpLons/insertNodes

* change at() to return a non mmap vector

SortedWayStore won't create mmaped vectors, so we need to return the
lowest common denominator.

This pessimizes performance of BinarySearchWayStore, since it'll have
to allocate vectors on demand.

Longer term: it might be better to return an iterator that hides the heavy
lifting.

* begin drawing the rest of the owl

* flesh out types

* add unit test framework

* naive encoding of ways

Checkpointing since I have something that works.

Future optimizations:

- when all high ints are the same, don't encode them
- compression

* more efficient if high ints are all the same

* extract mmap_allocator.cpp

This is needed to unit test the way store without dragging
in osm_store.

* progress on publishGroup

checkpointing, going to extract a populateMask(...) function

* add populateMask function

* finish publishGroup

* SortedWayStore: implement at

* pass node store into SortedWayStore

* fix alignment

* better logs

* way stores should throw std::out_of_range

This is part of the contract, client code will catch it and reject
relations that have missing ways.

* sortednodestore: throw std::out_of_range

* support way compression

* remove dead code, robust against empty ways

* implement clear()

* maybe fix windows build?

very unclear why this is needed, but we seem to be getting C2131 on this
line.

* don't use variable-length arrays on stack

Workaround for MSVC

* avoid more variable-length arrays

* make the other vectors as thread-local

* --no-compress-ways, --no-compress-nodes
2023-12-09 13:47:07 +00:00
systemed 8fbfcaa305 Changelog for v2.4.0 2023-03-31 15:31:28 +01:00
Hsieh Chin Fan d75f6d8218 Update to rack 3 (#460)
Rack::Handler is extracted to gem "rackup" from v3

ref:
https://github.com/rack/rack/blob/main/CHANGELOG.md#removed

Co-authored-by: Hsieh Chin Fan <pham@topo.tw>
2023-03-07 22:26:38 +00: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
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 3abdf5890d Move to C++14 because Boost::Geometry requires it (#229) 2021-04-26 15:11:08 +01:00
systemed 6eb89913de Update docs 2021-04-19 12:28:16 +01:00
Richard Fairhurst 229e9a01ea Combine linestrings only at specified zoom levels (#221) 2021-04-10 22:42:19 +01:00
stephan75 87e4aba8f0 Added a link to Wouter's blog item about "Generating self-hosted maps using tilemaker" 2021-03-23 20:34:10 +01:00
systemed a2073475f0 Use any version of Lua 2020-10-08 20:20:52 +01:00
swiss-knight 4cfe7d0c62 Update README.md
Add some information for ruby and mandatory gems installation.
2020-09-22 21:13:41 +02:00
Richard Fairhurst 1e8ec73146 Merge pull request #166 from OsmHackTW/github-action
Improve GitHub Action
2020-07-07 08:36:10 +01:00
Hsieh Chin Fan c9bc299782 Refine the example of GH Action 2020-07-06 18:34:59 +08:00
Hsieh Chin Fan 4729e06eb6 Fix example of usage 2020-07-06 11:17:56 +08:00
typebrook c87d92d31b Add action.yml to simplify inputs
- Define inputs for Github Action
- Add description into README
- If '--config' or '--process' are not being set, use configuration of
  OpenMapTiles by default
2020-05-27 17:57:50 +08:00
systemed 002e719ab0 Update readme, plus out-of-the-box server 2020-05-22 13:18:45 +01:00
Leonard Ehrenfried cae01cd2e0 Remove travis config 2020-05-14 13:48:09 +02:00
Richard Fairhurst ddb4b9988a Add Travis badge thing 2020-02-13 10:56:35 +00:00
systemed f467ffc016 Use sparse-map for ~7% memory saving 2020-02-09 18:38:16 +00:00
systemed f9006c1e74 Default to --combine off 2020-01-29 11:22:58 +00:00
systemed 4f49a68dcb Use low-memory defaults for ways and tile index 2020-01-29 11:14:10 +00:00
Richard Fairhurst 00e9564e75 Dockerfile is not formally supported 2020-01-14 09:21:55 +00:00
Tim Sheerman-Chase ee52b2545e Change command line behaviour of combine setting, update docs 2018-06-04 19:08:53 +01:00
Tim Sheerman-Chase 7e4ea3fc9f Add COMPACT_TILE_INDEX compile flag 2018-05-30 23:44:35 +01:00
Thomas Brüggemann 41b6c9d541 Updated Docker Readme 2017-07-26 14:59:02 +02:00
Thomas Brüggemann ca59087dd9 Introducing Docker 2017-07-26 14:19:54 +02:00
Tim Sheerman-Chase fd6be62b1c Try to fix self intersecting polygons with clipper library 2017-06-28 23:23:12 +01:00
Tim Sheerman-Chase 8ff31fa517 Add support for 64bit way ids and error handling for missing nodes 2017-06-23 21:29:38 +01:00
Richard Fairhurst b3b8532eb3 Emphasise that .lua and .json files must be in cwd 2017-02-12 13:46:41 +00:00
Richard Fairhurst ddaae86c91 Advise latest boost version 2017-01-12 15:04:03 +00:00
systemed 42091e97d5 Replace Luabind with kaguya (hooray!) 2016-11-04 16:32:05 +00:00
Paul Norman c9435161d6 Fix copyright year range 2016-07-11 18:38:05 -07:00
systemed 1ddb18cb7e 64-bit nodes, but with flag for 32-bit. Fixes #33. 2016-07-11 13:18:25 +01:00
Rory McCann f1f71adbbf Use "sudo" for ubuntu install steps that need it
Ubuntu by default uses sudo instead of a root account. Several install
steps require superuser access, so the docs should use sudo for those
steps
2016-02-12 10:08:49 +01:00
AndreMiras 173f2ed9e7 List of renderers has moved to a dedicated repo 2016-02-07 20:53:56 +01:00
Richard Fairhurst 223157535c libshp-dev required for Ubuntu 2015-10-06 22:20:18 +01:00