Skip to content

Commit 67c3b45

Browse files
authored
tilemaker 3.0
2 parents 3f05682 + 92be9e2 commit 67c3b45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2315
-1141
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# object files created during the build and the output binary itself
22
*.o
33
tilemaker
4+
tilemaker-server
45
build/
56
tilemaker.dSYM/
67

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
# Changelog
22

3+
## [3.0.0] - 2024-01-15
4+
5+
3.0 is a major release that significantly reduces tilemaker's memory footprint and improves running time. Note that it has __breaking changes__ in the way you write your Lua scripts (`way:Layer` becomes simply `Layer`, and so on).
6+
7+
### Added
8+
- PMTiles output (@systemed)
9+
- C++ tilemaker-server for quick prototyping (@bdon)
10+
- GeoJSON supported as an alternative to shapefiles (@systemed)
11+
- Support nodes in relations and relation roles (@cldellow)
12+
- Nested relations support (@systemed/@cldellow)
13+
- `LayerAsCentroid` can use positions from relation child nodes (@cldellow)
14+
- Add polylabel algorithm to `LayerAsCentroid` (@cldellow)
15+
- Filter input .pbf by way keys (@cldellow)
16+
- GeoJSON writer for debugging (@systemed)
17+
- Warn about PBFs with large blocks (@cldellow)
18+
- Unit tests for various features (@cldellow)
19+
- `RestartRelations()` to reset relation iterator (@systemed)
20+
- Per-layer, zoom-dependent feature_limit (@systemed after an original by @keichan34)
21+
- Report OSM ID on Lua processing error (@systemed)
22+
- Docker OOM killer warning (@Firefishy)
23+
- Push Docker image to Github package (@JinIgarashi)
24+
- Support `type=boundary` relations as native multipolygons (@systemed)
25+
26+
### Changed
27+
- __BREAKING__: Lua calls use the global namespace, so `Layer` instead of `way:Layer` etc. (@cldellow)
28+
- __BREAKING__: Mapsplit (.msf) support removed (@systemed)
29+
- Widespread speed improvements (@cldellow, @systemed)
30+
- Reduced memory consumption (@cldellow)
31+
- protobuf dependency removed: protozero/vtzero used instead (@cldellow)
32+
- Better Lua detection in Makefile (@systemed)
33+
- z-order is now a lossy float: compile-time flag not needed (@systemed)
34+
- --input and --output parameter names no longer required explicitly (@systemed)
35+
- Docker image improvements (@Booligoosh)
36+
37+
### Fixed
38+
- Improved polygon correction (@systemed)
39+
- Add missing attributes to OMT layers (@Nakaner)
40+
- Use different OSM tags for OMT subclasses (@Nakaner)
41+
- Add access and mtb_scale attributes to OMT (@dschep)
42+
- Fix CMake build on Arch Linux (@holzgeist)
43+
344

445
## [2.4.0] - 2023-03-28
546

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ file(GLOB tilemaker_src_files
9696
src/shared_data.cpp
9797
src/shp_mem_tiles.cpp
9898
src/shp_processor.cpp
99+
src/significant_tags.cpp
99100
src/sorted_node_store.cpp
100101
src/sorted_way_store.cpp
102+
src/tag_map.cpp
101103
src/tile_data.cpp
102104
src/tilemaker.cpp
103105
src/tile_worker.cpp

Makefile

Lines changed: 65 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,71 @@
11
# See what Lua versions are installed
2-
# order of preference: LuaJIT 2.1, LuaJIT 2.0, any generic Lua, Lua 5.1
2+
# order of preference: LuaJIT, any generic Lua, then versions from 5.4 down
33

44
PLATFORM_PATH := /usr/local
55

6-
ifneq ("$(wildcard /usr/local/include/luajit-2.1/lua.h)","")
7-
LUA_VER := LuaJIT 2.1
8-
LUA_CFLAGS := -I/usr/local/include/luajit-2.1 -DLUAJIT
9-
LUA_LIBS := -lluajit-5.1
10-
LUAJIT := 1
11-
12-
else ifneq ("$(wildcard /usr/include/luajit-2.1/lua.h)","")
13-
LUA_VER := LuaJIT 2.1
14-
LUA_CFLAGS := -I/usr/include/luajit-2.1 -DLUAJIT
15-
LUA_LIBS := -lluajit-5.1
16-
LUAJIT := 1
17-
18-
else ifneq ("$(wildcard /usr/local/include/luajit-2.0/lua.h)","")
19-
LUA_VER := LuaJIT 2.0
20-
LUA_CFLAGS := -I/usr/local/include/luajit-2.0 -DLUAJIT
21-
LUA_LIBS := -lluajit-5.1
22-
LUAJIT := 1
23-
24-
else ifneq ("$(wildcard /usr/include/luajit-2.0/lua.h)","")
25-
LUA_VER := LuaJIT 2.0
26-
LUA_CFLAGS := -I/usr/include/luajit-2.0 -DLUAJIT
27-
LUA_LIBS := -lluajit-5.1
28-
LUAJIT := 1
29-
30-
else ifneq ("$(wildcard /usr/local/include/lua/lua.h)","")
31-
LUA_VER := system Lua
32-
LUA_CFLAGS := -I/usr/local/include/lua
33-
LUA_LIBS := -llua
34-
35-
else ifneq ("$(wildcard /usr/include/lua/lua.h)","")
36-
LUA_VER := system Lua
37-
LUA_CFLAGS := -I/usr/include/lua
38-
LUA_LIBS := -llua
39-
40-
else ifneq ("$(wildcard /usr/include/lua.h)","")
41-
LUA_VER := system Lua
6+
# First, find what the Lua executable is called
7+
# - when a new Lua is released, then add it before 5.4 here
8+
LUA_CMD := $(shell luajit -e 'print("luajit")' 2> /dev/null || lua -e 'print("lua")' 2> /dev/null || lua5.4 -e 'print("lua5.4")' 2> /dev/null || lua5.3 -e 'print("lua5.3")' 2> /dev/null || lua5.2 -e 'print("lua5.2")' 2> /dev/null || lua5.1 -e 'print("lua5.1")' 2> /dev/null)
9+
ifeq ($(LUA_CMD),"")
10+
$(error Couldn't find Lua interpreter)
11+
endif
12+
$(info Using ${LUA_CMD})
13+
14+
# Find the language version
15+
LUA_LANGV := $(shell ${LUA_CMD} -e 'print(string.match(_VERSION, "%d+.%d+"))')
16+
$(info - Lua language version ${LUA_LANGV})
17+
18+
# Find the directory where Lua might be
19+
ifeq ($(LUA_CMD),luajit)
20+
# We need the LuaJIT version (2.0/2.1) to find this
21+
LUA_JITV := $(shell luajit -e 'a,b,c=string.find(jit.version,"LuaJIT (%d.%d)");print(c)')
22+
$(info - LuaJIT version ${LUA_JITV})
23+
LUA_DIR := luajit-${LUA_JITV}
24+
LUA_LIBS := -lluajit-${LUA_LANGV}
25+
else
26+
LUA_DIR := $(LUA_CMD)
27+
LUA_LIBS := -l${LUA_CMD}
28+
endif
29+
30+
# Find the include path by looking in the most likely locations
31+
ifneq ('$(wildcard /usr/local/include/${LUA_DIR}/lua.h)','')
32+
LUA_CFLAGS := -I/usr/local/include/${LUA_DIR}
33+
else ifneq ('$(wildcard /usr/local/include/${LUA_DIR}${LUA_LANGV}/lua.h)','')
34+
LUA_CFLAGS := -I/usr/local/include/${LUA_DIR}${LUA_LANGV}
35+
LUA_LIBS := -l${LUA_CMD}${LUA_LANGV}
36+
else ifneq ('$(wildcard /usr/include/${LUA_DIR}/lua.h)','')
37+
LUA_CFLAGS := -I/usr/include/${LUA_DIR}
38+
else ifneq ('$(wildcard /usr/include/${LUA_DIR}${LUA_LANGV}/lua.h)','')
39+
LUA_CFLAGS := -I/usr/include/${LUA_DIR}${LUA_LANGV}
40+
LUA_LIBS := -l${LUA_CMD}${LUA_LANGV}
41+
else ifneq ('$(wildcard /usr/include/lua.h)','')
4242
LUA_CFLAGS := -I/usr/include
43-
LUA_LIBS := -llua
44-
45-
else ifneq ("$(wildcard /usr/local/include/lua5.1/lua.h)","")
46-
LUA_VER := Lua 5.1
47-
LUA_CFLAGS := -I/usr/local/include/lua5.1
48-
LUA_LIBS := -llua5.1
49-
50-
else ifneq ("$(wildcard /usr/include/lua5.1/lua.h)","")
51-
LUA_VER := Lua 5.1
52-
LUA_CFLAGS := -I/usr/include/lua5.1
53-
LUA_LIBS := -llua5.1
54-
55-
else ifneq ("$(wildcard /usr/include/lua5.3/lua.h)","")
56-
LUA_VER := Lua 5.3
57-
LUA_CFLAGS := -I/usr/include/lua5.3
58-
LUA_LIBS := -llua5.3
59-
60-
else ifneq ("$(wildcard /opt/homebrew/include/lua5.1/lua.h)","")
61-
LUA_VER := Lua 5.1
62-
LUA_CFLAGS := -I/opt/homebrew/include/lua5.1
63-
LUA_LIBS := -llua5.1
43+
else ifneq ('$(wildcard /opt/homebrew/include/${LUA_DIR}/lua.h)','')
44+
LUA_CFLAGS := -I/opt/homebrew/include/${LUA_DIR}
45+
PLATFORM_PATH := /opt/homebrew
46+
else ifneq ('$(wildcard /opt/homebrew/include/${LUA_DIR}${LUA_LANGV}/lua.h)','')
47+
LUA_CFLAGS := -I/opt/homebrew/include/${LUA_DIR}${LUA_LANGV}
48+
LUA_LIBS := -l${LUA_CMD}${LUA_LANGV}
6449
PLATFORM_PATH := /opt/homebrew
65-
6650
else
67-
$(error Couldn't find Lua)
51+
$(error Couldn't find Lua libraries)
6852
endif
6953

70-
$(info Using ${LUA_VER} (include path is ${LUA_CFLAGS}, library path is ${LUA_LIBS}))
71-
ifneq ($(OS),Windows_NT)
72-
ifeq ($(shell uname -s), Darwin)
73-
ifeq ($(LUAJIT), 1)
54+
# Append LuaJIT-specific flags if needed
55+
ifeq ($(LUA_CMD),luajit)
56+
LUA_CFLAGS := ${LUA_CFLAGS} -DLUAJIT
57+
ifneq ($(OS),Windows_NT)
58+
ifeq ($(shell uname -s), Darwin)
7459
LDFLAGS := -pagezero_size 10000 -image_base 100000000
7560
$(info - with MacOS LuaJIT linking)
7661
endif
7762
endif
7863
endif
7964

65+
# Report success
66+
$(info - include path is ${LUA_CFLAGS})
67+
$(info - library path is ${LUA_LIBS})
68+
8069
# Main includes
8170

8271
prefix = /usr/local
@@ -121,8 +110,10 @@ tilemaker: \
121110
src/shared_data.o \
122111
src/shp_mem_tiles.o \
123112
src/shp_processor.o \
113+
src/significant_tags.o \
124114
src/sorted_node_store.o \
125115
src/sorted_way_store.o \
116+
src/tag_map.o \
126117
src/tile_data.o \
127118
src/tilemaker.o \
128119
src/tile_worker.o \
@@ -136,6 +127,7 @@ test: \
136127
test_pbf_reader \
137128
test_pooled_string \
138129
test_relation_roles \
130+
test_significant_tags \
139131
test_sorted_node_store \
140132
test_sorted_way_store
141133

@@ -166,11 +158,18 @@ test_pooled_string: \
166158
test/pooled_string.test.o
167159
$(CXX) $(CXXFLAGS) -o test.pooled_string $^ $(INC) $(LIB) $(LDFLAGS) && ./test.pooled_string
168160

161+
169162
test_relation_roles: \
170163
src/relation_roles.o \
171164
test/relation_roles.test.o
172165
$(CXX) $(CXXFLAGS) -o test.relation_roles $^ $(INC) $(LIB) $(LDFLAGS) && ./test.relation_roles
173166

167+
test_significant_tags: \
168+
src/significant_tags.o \
169+
src/tag_map.o \
170+
test/significant_tags.test.o
171+
$(CXX) $(CXXFLAGS) -o test.significant_tags $^ $(INC) $(LIB) $(LDFLAGS) && ./test.significant_tags
172+
174173
test_sorted_node_store: \
175174
src/external/streamvbyte_decode.o \
176175
src/external/streamvbyte_encode.o \
@@ -209,8 +208,8 @@ install:
209208
install -m 0755 -d $(DESTDIR)$(prefix)/bin/
210209
install -m 0755 tilemaker $(DESTDIR)$(prefix)/bin/
211210
install -m 0755 tilemaker-server $(DESTDIR)$(prefix)/bin/
212-
install -m 0755 -d ${DESTDIR}${MANPREFIX}/man1/
213-
install docs/man/tilemaker.1 ${DESTDIR}${MANPREFIX}/man1/
211+
@install -m 0755 -d ${DESTDIR}${MANPREFIX}/man1/ || true
212+
@install docs/man/tilemaker.1 ${DESTDIR}${MANPREFIX}/man1/ || true
214213

215214
clean:
216215
rm -f tilemaker tilemaker-server src/*.o src/external/*.o include/*.o include/*.pb.h server/*.o test/*.o

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ See an example of a vector tile map produced by tilemaker at [tilemaker.org](htt
1212

1313
tilemaker is written in C++14. The chief dependencies are:
1414

15-
* Google Protocol Buffers
1615
* Boost (latest version advised, 1.66 minimum)
1716
* Lua (5.1 or later) or LuaJIT
1817
* sqlite3
1918
* shapelib
2019
* rapidjson
2120

22-
sqlite_modern_cpp, and kaguya are bundled in the include/ directory.
21+
Other third-party code is bundled in the include/ directory.
2322

2423
You can then simply install with:
2524

@@ -32,20 +31,19 @@ For detailed installation instructions for your operating system, see [INSTALL.m
3231

3332
tilemaker comes with configuration files compatible with the popular [OpenMapTiles](https://openmaptiles.org) schema, and a demonstration map server. You'll run tilemaker to make vector tiles from your `.osm.pbf` source data. To create the tiles, run this from the tilemaker directory:
3433

35-
tilemaker --input /path/to/your/input.osm.pbf \
36-
--output /path/to/your/output.mbtiles
34+
tilemaker /path/to/your/input.osm.pbf /path/to/your/output.mbtiles
3735

3836
If you want to include sea tiles, then create a directory called `coastline` in the same place you're running tilemaker from, and then save the files from https://osmdata.openstreetmap.de/download/water-polygons-split-4326.zip in it, such that tilemaker can find a file at `coastline/water_polygons.shp`.
3937

38+
_(If you want to include optional small-scale landcover, create a `landcover` directory, and download the appropriate 10m files from 'Features' at https://www.naturalearthdata.com so that you have `landcover/ne_10m_antarctic_ice_shelves_polys/ne_10m_antarctic_ice_shelves_polys.shp`, `landcover/ne_10m_urban_areas/ne_10m_urban_areas.shp`, `landcover/ne_10m_glaciated_areas/ne_10m_glaciated_areas.shp`.)_
39+
4040
Then, to serve your tiles using the demonstration server:
4141

4242
cd server
43-
ruby server.rb /path/to/your/output.mbtiles
43+
tilemaker-server /path/to/your/output.mbtiles
4444

4545
You can now navigate to http://localhost:8080/ and see your map!
4646

47-
(If you don't already have them, you'll need to install Ruby and the required gems to run the demonstration server. On Ubuntu, for example, `sudo apt install sqlite3 libsqlite3-dev ruby ruby-dev` and then `sudo gem install sqlite3 cgi glug rack rackup`.)
48-
4947
## Your own configuration
5048

5149
Vector tiles contain (generally thematic) 'layers'. For example, your tiles might contain river, cycleway and railway layers. It's up to you what OSM data goes into each layer. You configure this in tilemaker with two files:
@@ -77,27 +75,31 @@ You might use tilemaker if:
7775
But don't use tilemaker if:
7876

7977
* You want someone else to create and host the tiles for you
80-
* You want the entire planet
8178
* You want continuous updates with the latest OSM data
8279

8380
## Contributing
8481

85-
Bug reports, suggestions and (especially!) pull requests are very welcome on the Github issue tracker. Please check the tracker to see if your issue is already known, and be nice. For questions, please use IRC (irc.oftc.net or https://irc.osm.org, channel #osm-dev) and https://help.osm.org.
82+
Bug reports, suggestions and (especially!) pull requests are very welcome on the Github issue tracker. Please check the tracker to see if your issue is already known, and be nice. For questions, please use IRC (irc.oftc.net or https://irc.osm.org, channel #osm-dev) and https://community.osm.org.
8683

8784
Formatting: braces and indents as shown, hard tabs (4sp). (Yes, I know.) Please be conservative about adding dependencies or increasing the memory requirement.
8885

8986
## Copyright
9087

9188
tilemaker is maintained by Richard Fairhurst and supported by [many contributors](https://github.com/systemed/tilemaker/graphs/contributors).
9289

93-
Copyright tilemaker contributors, 2015-2023.
90+
Copyright tilemaker contributors, 2015-2024.
9491

9592
The tilemaker code is licensed as FTWPL; you may do anything you like with this code and there is no warranty.
9693

9794
Licenses of third-party libraries:
9895

99-
- sqlite_modern_cpp (Amin Roosta) is licensed under MIT
96+
- [sqlite_modern_cpp](https://github.com/SqliteModernCpp/sqlite_modern_cpp) is licensed under MIT
10097
- [kaguya](https://github.com/satoren/kaguya) is licensed under the Boost Software Licence
10198
- [libpopcnt](https://github.com/kimwalisch/libpopcnt) is licensed under BSD 2-clause
10299
- [pmtiles](https://github.com/protomaps/PMTiles) is licensed under BSD 3-clause
103100
- [streamvbyte](https://github.com/lemire/streamvbyte) is licensed under Apache 2
101+
- [polylabel](https://github.com/mapbox/polylabel) is licensed under ISC
102+
- [protozero](https://github.com/mapbox/protozero) is licensed under BSD 2-clause
103+
- [vtzero](https://github.com/mapbox/vtzero) is licensed under BSD 2-clause
104+
- [minunit](https://github.com/siu/minunit) is licensed under MIT
105+
- [Simple-Web-Server](https://gitlab.com/eidheim/Simple-Web-Server) is licensed under MIT

0 commit comments

Comments
 (0)