Skip to content

Conversation

@systemed
Copy link
Owner

Currently we offer only AttributeNumeric for writing numeric values from Lua. This is mapped to a (4-byte) float in the vector tile. Floats are lossy and potentially less efficient.

This adds an AttributeInteger method, which writes int values to the vector tile. Internally this is currently stored as a double (so much less lossy), and on output to the vector tile it should use fewer bytes in most circumstances.

@systemed systemed merged commit 830f85c into master Sep 29, 2025
4 of 7 checks passed
@systemed systemed deleted the attribute_int branch September 29, 2025 11:22
@bmorg
Copy link

bmorg commented Sep 29, 2025

This change broke my processing setup, although I haven't 100% figured out what is happening.

I am running Tilemaker like:

./tilemaker --threads=1 --input germany-wide.osm.pbf --output germany-wide --process resources/process-openmaptiles.lua --config resources/config-openmaptiles.json

The error I am getting:

Layer place (z0-14)
Layer boundary (z0-14)
Layer poi (z12-14)
Layer poi_detail (z14-14) -> poi
Layer housenumber (z14-14)
Layer waterway (z8-14)
Layer waterway_detail (z12-14) -> waterway
Layer transportation (z4-14)
Layer transportation_name (z8-14)
Layer building (z13-14)
Layer water (z6-14)
Layer ocean (z0-14) -> water
Layer water_name (z14-14)
Layer water_name_detail (z14-14) -> water_name
Layer aeroway (z11-14)
Layer aerodrome_label (z10-14)
Layer park (z11-14)
Layer landuse (z4-14)
Layer urban_areas (z4-8) -> landuse
Layer landcover (z0-14)
Layer ice_shelf (z0-9) -> landcover
Layer glacier (z2-9) -> landcover
Layer mountain_peak (z11-14)
Bounding box 0, 46.5, 23, 56
Reading shapefile ocean
Reading shapefile urban_areas
Reading shapefile ice_shelf
Reading shapefile glacier
Generated points: 0, lines: 0, polygons: 1414
Reading .pbf germany-wide.osm.pbf
(Scanning for ways used in relations: 99%)           (3642 ms)
Block 43/173352 lua runtime error 2:
maybe...Argument mismatch:string,number	 candidate is:
		std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,int,
		std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,int,char,

stack traceback:
	[C]: in function 'AttributeInteger'
	resources/process-openmaptiles.lua:764: in function 'WritePOI'
	resources/process-openmaptiles.lua:199: in function 'node_function'
table  `maybe...Argument mismatch:string,number	 candidate is:
		std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,int,
		std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,int,char,

stack traceback:
	[C]: in function 'AttributeInteger'
	resources/process-openmaptiles.lua:764: in function 'WritePOI'
	resources/process-openmaptiles.lua:199: in function 'node_function''  `maybe...Argument mismatch:string,number	 candidate is:
		std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,int,
		std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,int,char,

stack traceback:
	[C]: in function 'AttributeInteger'
	resources/process-openmaptiles.lua:764: in function 'WritePOI'
	resources/process-openmaptiles.lua:199: in function 'node_function'
stack traceback:'
Lua error on node 20276177

@systemed
Copy link
Owner Author

Ah, a fractional level tag in node 20276177, that's interesting ;)

If you change

AttributeInteger("level", level)

to

AttributeNumeric("level", level)

in process-openmaptiles.lua then that should fix it.

@bmorg
Copy link

bmorg commented Oct 1, 2025

Thanks!

Does this need fixing in the repo or is this a problem in the data I'm using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants