Skip to main content

High-performance SRTM elevation data library

Project description

htg - High-performance SRTM Elevation Library

PyPI License: MIT

Python bindings for the htg Rust library, providing fast elevation queries from SRTM .hgt files.

Installation

pip install srtm

Quick Start

import srtm

# Create service with up to 100 cached tiles
service = srtm.SrtmService("/path/to/srtm", cache_size=100)

# Query elevation (Mount Fuji)
elevation = service.get_elevation(35.3606, 138.7274)
print(f"Elevation: {elevation}m")  # 3776

# Interpolated query for smoother results
elevation = service.get_elevation_interpolated(35.3606, 138.7274)
print(f"Elevation: {elevation:.2f}m")  # 3776.42

# Check cache performance
stats = service.cache_stats()
print(f"Cache hit rate: {stats.hit_rate:.1%}")

Utility Functions

import srtm

# Convert coordinates to filename
filename = srtm.lat_lon_to_filename(35.5, 138.7)
print(filename)  # "N35E138.hgt"

# Parse filename to coordinates
coords = srtm.filename_to_lat_lon("N35E138.hgt")
print(coords)  # (35, 138)

# Void value constant
print(srtm.VOID_VALUE)  # -32768

SRTM Data

Download SRTM .hgt files from:

Performance

This library uses Rust for the core implementation, providing:

  • <10ms response time for cached tiles
  • Memory-mapped I/O for fast file access
  • LRU caching to bound memory usage

License

MIT

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

srtm-0.2.0-cp312-cp312-win_amd64.whl (260.5 kB view details)

Uploaded CPython 3.12Windows x86-64

srtm-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl (417.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

srtm-0.2.0-cp312-cp312-macosx_11_0_arm64.whl (368.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file srtm-0.2.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: srtm-0.2.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 260.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for srtm-0.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9ba65d3d926de1e7e04cbe16a8b948191d81b0ba3e67586ea7c2dfa3b81947bf
MD5 ea54edbeafa80c5e4890f09149c21ef3
BLAKE2b-256 be3c763b04a23b27ff619292ad7fa0196cb9ba3d8b1eb1618b57fd3eabdafa73

See more details on using hashes here.

Provenance

The following attestation bundles were made for srtm-0.2.0-cp312-cp312-win_amd64.whl:

Publisher: release.yml on pedrosanzmtz/htg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file srtm-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for srtm-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 13a2d6091aad253b8e68ba97b90d61654532ca49b477f5c39466e6e1e18c558f
MD5 e9b6691cb4c948010cd480ae18a906e6
BLAKE2b-256 4c1726e3e6f4fe562a30ee214b13d40f4dccb1b38ee3edf084748ac9e13b71ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for srtm-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: release.yml on pedrosanzmtz/htg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file srtm-0.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for srtm-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e0cbec42a5c3402bc2cad58674f8ec2d981d58c755cfee841e97b6b0ed2d155
MD5 4e5c0212a355d0b4c82ab4353dbd7da7
BLAKE2b-256 f6c417ba687ba69f115bc7215536f7c35c8feb6522f5cc1a12baa886658bbd0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for srtm-0.2.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on pedrosanzmtz/htg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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