Skip to main content

A collection of utilities for the Plateau project

Project description

This is a collection of utilities for the Plateau project.

pip install plateauutils

Tested with Python 3.9 and 3.10

CityGML parser

>>> from shapely.geometry import Point
>>> from plateauutils.mesh_geocorder.geo_to_mesh import point_to_meshcode
>>> point = Point(139.71475, 35.70078)
>>> mesh_code = point_to_meshcode(point, "2/1")
>>> mesh_code
'533945471'
>>> from shapely import from_wkt
>>> from plateauutils.parser.city_gml_parser import CityGMLParser
>>> target_polygon = from_wkt("POLYGON ((130.41249721501615 33.224722548534864, 130.41249721501615 33.22506264293093, 130.41621606802997 33.22506264293093, 130.41621606802997 33.224722548534864, 130.41249721501615 33.224722548534864))")
>>> parser = CityGMLParser(target_polygon)
>>> result = parser.download_and_parse("https://assets.cms.plateau.reearth.io/assets/d6/70821e-7f58-4f69-bc34-341875704e78/40203_kurume-shi_2020_citygml_3_op.zip", "/tmp")
>>> result
[{'gid': 'bldg_383f1804-aa34-4634-949f-f769e09fa92d', 'center': [130.41263587199947, 33.22489181671553], 'min_height': 3.805999994277954, 'measured_height': 9.3, 'building_structure_type': '非木造'}, {'gid': 'bldg_877dea60-35d0-4fd9-8b02-852e39c75d81', 'center': [130.41619367090038, 33.22492719812357], 'min_height': 4.454999923706055, 'measured_height': 3.0, 'building_structure_type': '非木造'},...]

URLs of CityGML zip files can be found at G空間情報センター.

MVT parser

>>> from plateauutils.parser.mvt_tile_parser import MvtTileParser
>>> target_polygon = from_wkt("POLYGON ((130.525689 33.323966, 130.522728 33.314069, 130.511441 33.308653, 130.501013 33.30937, 130.492516 33.318516, 130.493717 33.325831, 130.504618 33.332249, 130.512857 33.332213, 130.525689 33.323966))")
>>> parser = MvtTileParser(target_polygon)
>>> result = parser.download_and_parse("https://assets.cms.plateau.reearth.io/assets/43/53a0e1-cc14-4228-a5ef-19333a23596d/40203_kurume-shi_2020_3dtiles-mvt_3_op.zip", "/tmp")
>>> result
['/tmp/40203_kurume-shi_2020_3dtiles-mvt_3_op/luse/15/28254/13174.mvt']

URLs of 3D Tiles/MVT zip files can be found at G空間情報センター.

Flood converter

>>> from plateauutils.flood_converter.flood_to_3dtiles import FloodTo3dtiles
>>> f = FloodTo3dtiles()
>>> f.convert('/tmp/floodmap_depth', '/tmp/depth_3dtiles')
>>> from plateauutils.flood_converter.flood_to_png import FloodToPng
>>> p = FloodToPng('/tmp/floodmap_depth')
>>> p.parse('/tmp/depth_png')

How to develop

python3.9 -m venv venv
./venv/bin/activate
pip install -U pip
pip install -r dev-requirements.txt
pytest --cov=plateauutils --cov-report=html --cov-fail-under=90

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plateauutils-0.0.14.tar.gz (394.6 kB view details)

Uploaded Source

Built Distribution

plateauutils-0.0.14-py3-none-any.whl (414.4 kB view details)

Uploaded Python 3

File details

Details for the file plateauutils-0.0.14.tar.gz.

File metadata

  • Download URL: plateauutils-0.0.14.tar.gz
  • Upload date:
  • Size: 394.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for plateauutils-0.0.14.tar.gz
Algorithm Hash digest
SHA256 620d227ea222ecd8f7c68e6b41430d229c058e88739e726656b177dc5e8c3858
MD5 0362a2f7c9d72dd27da86191a1a1cf93
BLAKE2b-256 4f16ae8c46df19af2c4f21ef741d3b18b140e2ed954c3b8c904e17d88e48d7e7

See more details on using hashes here.

File details

Details for the file plateauutils-0.0.14-py3-none-any.whl.

File metadata

File hashes

Hashes for plateauutils-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 3239dc67e81a2fe044f1119bb89cee2b08cdfdc10a1b8e0158343f5f3bfd16bb
MD5 004b13b83e62ecfa0a44ce64025b8499
BLAKE2b-256 39c2967a3110faf947f686e9da501c0d9c156efdb471b10c386c3948ab695bac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page