Export DF world map for use in GIS tools#5376
Draft
chdoc wants to merge 10 commits intoDFHack:developfrom
Draft
Conversation
myk002
reviewed
Apr 4, 2025
| #dfhack_plugin(dwarfmonitor dwarfmonitor.cpp LINK_LIBRARIES lua) | ||
| #add_subdirectory(embark-assistant) | ||
| dfhack_plugin(eventful eventful.cpp LINK_LIBRARIES lua) | ||
| dfhack_plugin(export-map export-map.cpp COMPILE_FLAGS_GCC -fno-gnu-unique) |
Member
There was a problem hiding this comment.
what is requiring -fno-gnu-unique?
Member
There was a problem hiding this comment.
probably a STL template; it can be hard to figure out which one because you have to pore over the libc++ implementation and that's very timeconsuming.
-fno-gnu-unique should always be safe for DFHack plugins, as long as they don't crossload another another plug-in module
Member
Author
There was a problem hiding this comment.
Nothing is actually requiring this. Is what a (failed) attempt to make the plugin unload. I will have to check whether it unloads, now that I have removed the GDAL dependency. Keeping this there and the conversation open in the meantime.
ab9rf
reviewed
Apr 5, 2025
| using coord = df::coord2d; | ||
|
|
||
| // static int wdim = 768; // dimension of a world tile | ||
| static int rdim = 48; // dimension of a region tile |
Member
There was a problem hiding this comment.
should this be constexpr instead of static?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The goal of this plugin is to export the world map at the region-tile (i.e., embark tile or midmap-tile) level for use with GIS programs like ArcGIS or QGIS. For a medium-sized map, this amounts to (129*16)^2 = 4260096 region tiles with biome information for every region tile fetched from one of the surrounding world tiles.
In order to keep the output down to a manageable size (17 MB of CSV for a medium-sized world), region tiles are clustered by the world tile they take their information from, and every cluster is exported as a single feature with its geometry described as a WKT (MULTI)POLYGON, resulting in an export of only 129^2 = 16641 features.