Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/runalyze/dem-reader
Library to read digital elevation models, such as GeoTIFF files for SRTM.
https://github.com/runalyze/dem-reader
dem elevation-data geotiff srtm
Last synced: 3 months ago
JSON representation
Library to read digital elevation models, such as GeoTIFF files for SRTM.
- Host: GitHub
- URL: https://github.com/runalyze/dem-reader
- Owner: Runalyze
- License: mit
- Created: 2016-06-19T14:25:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-10-18T13:39:29.000Z (over 3 years ago)
- Last Synced: 2024-11-09T00:45:53.958Z (3 months ago)
- Topics: dem, elevation-data, geotiff, srtm
- Language: PHP
- Homepage:
- Size: 55.7 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# DEM reader
[](https://packagist.org/packages/runalyze/dem-reader)
[](https://travis-ci.org/Runalyze/dem-reader)
[](https://scrutinizer-ci.com/g/Runalyze/dem-reader/?branch=master)
[](https://scrutinizer-ci.com/g/Runalyze/dem-reader/?branch=master)
[](https://github.com/Runalyze/dem-reader/blob/master/LICENSE)Library to read digital elevation models, such as GeoTIFF files for SRTM.
The GeoTIFF reader itself is originally based on [Bob Osola's SRTMGeoTIFFReader](http://www.osola.org.uk/elevations/index.htm).## Usage
```php
use Runalyze\DEM\Reader;
use Runalyze\DEM\Provider\GeoTIFF\SRTM4Provider;$Provider = new SRTM4Provider('path/to/srtm/files');
$Reader = new Reader($Provider);
$elevations = $Reader->getElevations($latitudes, $longitudes);
```To give you some more details: Each provider is valid for its own. You can just ignore the general reader and
use your favorite provider:```php
use Runalyze\DEM\Provider\GeoTIFF\SRTM4Provider;$Provider = new SRTM4Provider('path/to/srtm/files');
$elevations = $Provider->getElevations($latitudes, $longitudes);
```But you may have more than one provider available or different paths where your dem files are located.
You can attach as many providers as you want to the reader. Each of them will be checked if it can handle
the given elevation data (in the order they were attached) and the wirst one that does will be used.```php
use Runalyze\DEM\Reader;
use Runalyze\DEM\Provider\GeoTIFF\SRTM4Provider;$Reader = new Reader();
$Reader->addProvider(new SRTM4Provider('path/to/europe/srtm/files'));
$Reader->addProvider(new SRTM4Provider('path/to/america/srtm/files'));$europeElevations = $Reader->getElevations($europeLatitudes, $europeLongitudes);
$americaElevations = $Reader->getElevations($americaLatitudes, $americaLongitudes);
```## License
Code released under [the MIT license](LICENSE).