Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oseiskar/citygmltools
Convert CityGML models (of Espoo) to OBJ format defined in WGS84 ENU
https://github.com/oseiskar/citygmltools
citygml geodetic python wavefront-obj wgs84
Last synced: 18 days ago
JSON representation
Convert CityGML models (of Espoo) to OBJ format defined in WGS84 ENU
- Host: GitHub
- URL: https://github.com/oseiskar/citygmltools
- Owner: oseiskar
- Created: 2021-10-31T11:24:49.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-01T07:53:38.000Z (about 3 years ago)
- Last Synced: 2024-10-13T02:12:48.603Z (about 1 month ago)
- Topics: citygml, geodetic, python, wavefront-obj, wgs84
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CityGML conversion tools (Espoo)
The main purpose of this repository is allowing conversions of this 3D model data
of the city of Espoo https://kartat.espoo.fi/3D/citymodel_en.html to a commonly
understood 3D format and coordinate system, using Open Source tools.The first implementation converts to Wafefront OBJ format, which can be viewed
with, e.g., this online tool: https://3dviewer.net/.
The result is in ENU coordinates defined at the given origin.The code includes some hacks (like `--auto-fix-walls`) that may not be required with
other CityGML datasets. Compatibility with other CityGML datasets is currently unknown.
On the other hand, other tools such as https://github.com/tudelft3d/CityGML2OBJs,
which did not work with the Espoo dataset, may work with those.## Usage
1. Optional but recommended: virtualenv
* (once) Set up virtualenv: `python3 -m venv venv`
* (every time): Activate: `venv/bin/activate`
2. (once) Install: `pip install -r requirements.txt`## Coordinate helpers
To perform bounding box queries, you may need to convert coordinate systems between, WGS84
(the "satellite coordinates" you get from, e.g., Google Maps) and local coordinate systems like EPSG:3879
(that, e.g., move with the tectonic plates).python coordinates.py --coordinateSystem=EPSG:3879 single from_wgs 60.1757 24.8040
which should print something like `(6673664.363125221, 25489121.254538767)`.
## Downloading
List available datasets
python download.py --url=https://kartat.espoo.fi/teklaogcweb/wfs.ashx GetCapabilities
Look at the `FeatureType/Name` fields in the result XML, something like `bldg:building_lod2`.
Download a particular dataset
mkdir -p data
python download.py --url=https://kartat.espoo.fi/teklaogcweb/wfs.ashx \
GetFeature "bldg:building_lod2" \
--coordinateSystem=EPSG:3879 --latitude=6673664 --longitude=25489121 --radius=200 \
--maxFeatures=100 > data/dataset.xmlAfter checking that the data looks correct, try expanding the search radius `--radius` (in meters)
or removing max feature limit (by setting `--maxFeatures=0`).## Conversions
Example:
python convert.py to_obj 6673664 25489121 \
--auto-fix-walls \
--coordinateSystem=EPSG:3879 < data/dataset.xml > data/dataset.objIf the imported area is large (several kilometers in diameter), consider also
using `--accurate-enu`, which should correctly handle the curvature of the Earth
and other effects of similar magnitude, which are less accurately modeled in
the default mode, `--fast-enu`.