Comments (1)
I've create a patch for this, but my C++ isn't great, so while it does work, there are probably better methods. I'll leave this up here for any comments, and I can create a PR is desired.
diff --git a/include/osm_lua_processing.h b/include/osm_lua_processing.h
index f4d664d..ca7627a 100644
--- a/include/osm_lua_processing.h
+++ b/include/osm_lua_processing.h
@@ -111,6 +111,9 @@ public:
// Get the ID of the current object
std::string Id() const;
+ // Gets a table of all the OSM tags
+ kaguya::LuaTable AllTags(kaguya::State& luaState);
+
// Check if there's a value for a given key
bool Holds(const std::string& key) const;
diff --git a/src/osm_lua_processing.cpp b/src/osm_lua_processing.cpp
index 545b1f3..e2ea791 100644
--- a/src/osm_lua_processing.cpp
+++ b/src/osm_lua_processing.cpp
@@ -118,6 +118,20 @@ template<> struct kaguya::lua_type_traits<protozero::data_view> {
};
std::string rawId() { return osmLuaProcessing->Id(); }
+kaguya::LuaTable rawAllTags() {
+ if (osmLuaProcessing->isPostScanRelation) {
+ return osmLuaProcessing->AllTags(*g_luaState);
+ }
+
+ auto tags = osmLuaProcessing->currentTags->exportToBoostMap();
+ kaguya::LuaTable tagsTable = g_luaState->newTable();
+
+ for (const auto& kv : tags) {
+ tagsTable[kv.first] = kv.second;
+ }
+
+ return tagsTable;
+}
bool rawHolds(const KnownTagKey& key) {
if (osmLuaProcessing->isPostScanRelation) {
return osmLuaProcessing->Holds(key.stringValue);
@@ -196,6 +210,7 @@ OsmLuaProcessing::OsmLuaProcessing(
osmLuaProcessing = this;
luaState["Id"] = &rawId;
+ luaState["AllTags"] = &rawAllTags;
luaState["Holds"] = &rawHolds;
luaState["Find"] = &rawFind;
luaState["HasTags"] = &rawHasTags;
@@ -290,6 +305,16 @@ string OsmLuaProcessing::Id() const {
return to_string(originalOsmID);
}
+// Gets a table of all the OSM tags
+kaguya::LuaTable OsmLuaProcessing::AllTags(kaguya::State& luaState) {
+ // NOTE: this is only called in the PostScanRelation phase -- other phases are handled in rawAllTags
+ kaguya::LuaTable tagsTable = luaState.newTable();
+ for (const auto& kv: *currentPostScanTags) {
+ tagsTable[kv.first] = kv.second;
+ }
+ return tagsTable;
+}
+
// Check if there's a value for a given key
bool OsmLuaProcessing::Holds(const string& key) const {
// NOTE: this is only called in the PostScanRelation phase -- other phases are handled in rawHolds
from tilemaker.
Related Issues (20)
- CI is broken
- Support writing MultiPoint into vector tiles HOT 1
- Ocean and land area is missing HOT 13
- Possible issue with multipoint processing HOT 4
- How to avoid duplicate processing of OSM object
- Cross-Platform Inconsistency in Attribute Handling with Identical Configs on Ubuntu and macOS HOT 6
- mbtiles file bigger than bare folders? HOT 3
- no outcome after run make sudo make install on ubuntu HOT 2
- No housenumber
- Ocean Tiles Incomplete
- Keep OSM feature type in the final mbtiles file HOT 6
- Sea area is missing, not a blue color HOT 2
- When will the next version be released?
- Grid Coordinate Lines on Map HOT 2
- Random Core Dump
- Fails to build with Boost 1.86.0 HOT 1
- Bug: SegFault caused by invalid string HOT 2
- Feature: Add BUILD_DEBUG argument when building Docker image
- Feature: Add --quiet option to tilemaker executable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tilemaker.