As I’m not yet sure what will be included in the alpha version of the damn project, I’m getting inspired. This time by Tanga Building Footprints Import announced on the imports mailing list.
It looks like the buildings are already imported in the Tanga city, e.g. this one, but I’ve never done the import thing, so I can’t say.
In this diary, I’m going to introduce the example mapping workflow with the prepared data based on Tanga Building Footptrints Import using the damn project. Not everything is yet fully automated, so this diary is more like describing the proof of concept. However, I’m open to the needs of the future.
Create area
There is the dataset of the buildings available on the wiki page. I like
that idea of huge GeoJSON file that includes the features with the corresponding
geometries. As I’m not the import guy, I’m confused with _key_
s in the
properties (I mean these underscores of each key.) I need only building:yes
tag, so I’ve renamed just those (note that notepad’s “Replace All” would do the
same:)
sed -i 's/_building_/building/' buildings.geojson
I’ll create new area to work on. Therefore, I need the geometry of the whole
area, where the buildings are. For that, I’ll use the damn-client.py
scripts. (The shapely
must be installed.)
cd damn-client.py
./convex_hull.py buildings.geojson > ch-buildings.geojson
The command took about a minute on my laptop. The ch-buildings.geojson
can be
used as the GeoJSON boundary file in the damn project’s manager.
Buildings of the squares
So I’ve area to work on divided to squares. Now, I need the GeoJSON files containing all the buildings of each square. I’ll use the damn-client.py scripts once again:
cd damn-client.py
./prepare_tmp.py https://server.damn-project.org 2351 buildings.geojson
Note using the original buildings.geojson
file. The command took about 10
minutes on my laptop. Generated directory 2351
must be copied manually to the
deployed version of the damn project. Uploading of the area’s directory is
not yet automated.
Squares with no buildings
This is hacking part. I’ve the area with convex hull border that is covering all the buildings and is divided to the squares. Consequently, some squares could contain no buildings. I want to mark all these squares as done, so I need to:
- Get all the area’s squares.
- Get buildings for each square.
- If there is no building, lock the square.
- When all buldings-free squares are locked, merge them, and mark
is done
.
Doing this manually is possible in the mappy client, but crazy. The automation of this task can be done within the developer’s console (F12 in Firefox,) using the functions of the damn-client.js, though:
var aid = 2351;
api.get_squares(function(squares) {
for (var i in squares) {
api.get(
function(r)
{
if (r["features"].length == 0) {
api.post_commit(
function (r2)
{
console.log(r2["sid"] + " locked");
},
aid,
{"type": "lock", "sid": r["sid"]},
function() {},
);
}
},
function() {},
api.ep(
"/area/" + aid
+ "/square/" + squares[i]["sid"]
+ "/tmp"
),
);
}
}, aid, function() {});
Now, I need to wait untill all the squares with no buildings are locked. This took about 2 minutes on my laptop. Then, the last steps are: right click in the mappy client and merge, right click on the merged square and lock, and finally the last right click on the merged square and is done.
Mapping with JOSM
Everything is ready for the mapping. Please, note the limitations:
- Do not use
split
andmerge
otherwise the prepared data are not downloaded. - The prepared data are only available when using JOSM damn plugin.
- I know, the JOSM damn plugin is the weakest point of the damn project.
I would recommend the following workflow:
- From the damn plugin dialog, select the area to map.
- Click map button to load some square and corresponding buildings.
- Use
mapathoner
plugin to Select Duplicate Buildings. - Use
todo
plugin to keep track of them.
Do not save the work to the OpenStreetMap! This diary is about possibilities, not about the real work on the Tanga Building Footprints Import!
Conclusion
That’s it. Preparing the data is not fully automated, but the tools are there. The weakest point of the mapping workflow is the JOSM damn plugin which is ugly, but working. These are reasons why I’m talking about describing the proof of concept. However, that proof of concept is ready for the broader testing.
Discussion