Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ To do that, you use these methods:
* `Attribute(key,value,minzoom)`: add an attribute to the most recently written layer. Argument `minzoom` is optional, use it if you do not want to write the attribute on lower zoom levels.
* `AttributeNumeric(key,value,minzoom)`, `AttributeBoolean(key,value,minzoom)`: for numeric/boolean columns.
* `Id()`: get the OSM ID of the current object.
* `OsmType()`: get the OSM type of the current object.
* `IsClosed()`: returns true if the current object is a closed area.
* `IsMultiPolygon()`: returns true if the current object is a multipolygon.
* `ZOrder(number)`: Set a numeric value (default 0) used to sort features within a layer. Use this feature to ensure a proper rendering order if the rendering engine itself does not support sorting. Sorting is not supported across layers merged with `write_to`. Features with different z-order are not merged if `combine_below` or `combine_polygons_below` is used. Use this in conjunction with `feature_limit` to only write the most important (highest z-order) features within a tile. (Values can be -50,000,000 to 50,000,000 and are lossy, particularly beyond -1000 to 1000.)
Expand Down
3 changes: 3 additions & 0 deletions include/osm_lua_processing.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ class OsmLuaProcessing {
// Get the ID of the current object
std::string Id() const;

// Get the Type of the current object
std::string OsmType() const;

// Gets a table of all the keys of the OSM tags
kaguya::LuaTable AllKeys(kaguya::State& luaState);

Expand Down
7 changes: 7 additions & 0 deletions src/osm_lua_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ kaguya::LuaTable getAllTags(kaguya::State& luaState, const boost::container::fla
}

std::string rawId() { return osmLuaProcessing->Id(); }
std::string rawOsmType() { return osmLuaProcessing->OsmType(); }
kaguya::LuaTable rawAllKeys() {
if (osmLuaProcessing->isPostScanRelation) {
return osmLuaProcessing->AllKeys(*g_luaState);
Expand Down Expand Up @@ -247,6 +248,7 @@ OsmLuaProcessing::OsmLuaProcessing(

osmLuaProcessing = this;
luaState["Id"] = &rawId;
luaState["OsmType"] = &rawOsmType;
luaState["AllKeys"] = &rawAllKeys;
luaState["AllTags"] = &rawAllTags;
luaState["Holds"] = &rawHolds;
Expand Down Expand Up @@ -356,6 +358,11 @@ string OsmLuaProcessing::Id() const {
return to_string(originalOsmID);
}

// Get the Type of the current object
string OsmLuaProcessing::OsmType() const {
return (isRelation ? "relation" : isWay ? "way" : "node");
}

// Gets a table of all the keys of the OSM tags
kaguya::LuaTable OsmLuaProcessing::AllKeys(kaguya::State& luaState) {
// NOTE: this is only called in the PostScanRelation phase -- other phases are handled in rawAllKeys
Expand Down
Loading