-
Notifications
You must be signed in to change notification settings - Fork 0
Importing building plans
Basti Wagner edited this page Jan 10, 2022
·
7 revisions
In case you have an image of a building plan, you will want to import it as polygons with real-world coordinates. For that, you can use JOSM and follow this tutorial (https://2020.foss4g-oceania.org/hubs/perth/assets/presos/Nimalika%20Fernando%20-%20Let%27s%20map%20indoors:%20starting%20indoor%20mapping%20with%20OSM.pdf)
There is also a video explanation of the whole setup: https://youtu.be/Q4Fyd5DQZpA
The output then looks like this:
<?xml version='1.0' encoding='UTF-8'?>
<osm version='0.6' generator='JOSM'>
<node id='-101755' action='modify' visible='true' lat='52.39417532053' lon='13.13278466329' />
<node id='-101762' action='modify' visible='true' lat='52.39398422012' lon='13.1324212709'>
<tag k='entrance' v='yes' />
<tag k='name' v='FrontEntrance' />
</node>
<node id='-101763' action='modify' visible='true' lat='52.39416195682' lon='13.13244521932'>
<tag k='entrance' v='yes' />
<tag k='name' v='BackEntrance' />
</node>
{... other points}
<way id='-101782' action='modify' visible='true'>
<nd ref='-101755' />
<nd ref='-101763' />
<nd ref='-101762' />
<nd ref='-101755' />
<tag k='indoor' v='room' />
<tag k='name' v='ExampleRoom' />
</way>
{... other rooms}
</osm>
- After labeling you can save your map as an .osm file
- Place your .osm file in app/assets/data
- Run
rails runner lib/import/import_osm.rb <file name>
from project folder (e.g.rails runner lib/import/import_osm.rb importBuildingAndPois.osm
) - With the import script you can only import one building floor at a time (which must be labeled in one osm file)
- You can generate geojson from persisted data with
indoor#json
action and check the geojson on geojson.io