Skip to main content

A set of utilities for manipulating (Geo)JSON and GeoTIFF data.

Project description

https://raw.githubusercontent.com/cheginit/hydrodata/develop/docs/_static/pygeoutils_logo.png

PyPi Conda Version CodeCov Github Actions Binder

CodeFactor black pre-commit

Features

PyGeoUtils is a part of Hydrodata software stack and provides utilities for manipulating (Geo)JSON and GeoTIFF data:

  • json2geodf: For converting (Geo)JSON objects to GroPandas dataframe.

  • arcgis2geojson: For converting ESRIGeoJSON objects to standard GeoJSON format.

  • gtiff2xarray: For converting (Geo)TIFF objects to xarray datasets.

All these function handle all necessary CRS transformations. Moreover, requests for additional functionalities can be submitted via issue tracker.

Installation

You can install pygeoutils using pip after installing libgdal on your system (for example, in Ubuntu run sudo apt install libgdal-dev):

$ pip install pygeoutils

Alternatively, pygeoutils can be installed from the conda-forge repository using Conda:

$ conda install -c conda-forge pygeoutils

Quickstart

To demonstrate capabilities of PyGeoUtils lets use PyGeoOGC to access National Wetlands Inventory from WMS, and FEMA National Flood Hazard via WFS, then convert the outpus to GeoDataFrame and xarray.Dataset using PyGeoUtils.

import pygeoutils as geoutils
from pygeoogc import WFS, WMS
from shapely.geometry import Polygon


geometry =  Polygon(
    [
        [-118.72, 34.118],
        [-118.31, 34.118],
        [-118.31, 34.518],
        [-118.72, 34.518],
        [-118.72, 34.118],
    ]
)

url_wms = "https://www.fws.gov/wetlands/arcgis/services/Wetlands_Raster/ImageServer/WMSServer"
wms = WMS(
    url_wms,
    layers="0",
    outformat="image/tiff",
    crs="epsg:3857",
)
r_dict = wms.getmap_bybox(
    geometry.bounds,
    1e3,
    box_crs="epsg:4326",
)
wetlands = geoutils.gtiff2xarray(r_dict, geometry, "epsg:4326")

url_wfs = "https://hazards.fema.gov/gis/nfhl/services/public/NFHL/MapServer/WFSServer"
wfs = WFS(
    url_wfs,
    layer="public_NFHL:Base_Flood_Elevations",
    outformat="esrigeojson",
    crs="epsg:4269",
)
r = wfs.getfeature_bybox(geometry.bounds, box_crs="epsg:4326")
flood = geoutils.json2geodf(r.json(), "epsg:4269", "epsg:4326")

Contributing

Contirbutions are very welcomed. Please read CODE_OF_CONDUCT.rst and CONTRIBUTING.rst files for instructions.

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

pygeoutils-0.1.4.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygeoutils-0.1.4-py2.py3-none-any.whl (8.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pygeoutils-0.1.4.tar.gz.

File metadata

  • Download URL: pygeoutils-0.1.4.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for pygeoutils-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7ddebde0433dcbb098798acdbf9e58da9a6576b1da41a0798894afc12dd9ba05
MD5 f25e9874fac4476771d86de8de3c642f
BLAKE2b-256 b43905d99feb31d066caa06b3f26795a92d14228e8c53110bf11a941b67bd48f

See more details on using hashes here.

File details

Details for the file pygeoutils-0.1.4-py2.py3-none-any.whl.

File metadata

  • Download URL: pygeoutils-0.1.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for pygeoutils-0.1.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a2c175f5dba4cfe5b03e48549ff7f7dab69e80932b4da12ee560b9e6a7a6cd4c
MD5 ed42db0d803c7753b2da97471725b667
BLAKE2b-256 f03c81e4a4a5f81948623d80d5b911ebdbb4e41e2b7572a35393e53cdbfd45f0

See more details on using hashes here.

Supported by

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