shakemaps/webservice_library

Library to fetch quake's shakemaps data

0.2.0 2025-04-23 14:00 UTC

This package is auto-updated.

Last update: 2025-05-29 20:47:57 UTC


README

Fetch and parse XML grid data from Shakemaps server or local file, creating an iteratable object of data

Install and usage

Install via composer:

$ composer require shakemaps/webservice_library

and autoload and use in your script:

require_once __DIR__ . '/vendor/autoload.php';

use Shakemaps\Webservice\Intensity as SW_Intensity;
use Fdsn\DataStructure\LatLon as DS_LatLon;

// Fetch from local file
$obj = new SW_Intensity( '42487872', null, './test_data/42487872/grid.xml' );

// ...or Fetch from Shakemaps server
$obj = new SW_Intensity( '42487872' );


if ( 0 == $obj->fetch() )
	exit();

foreach($obj as $locality){
	printf("%f, %f, %f\n", 
		$locality['point']->lat(),
		$locality['point']->lon(),
		$locality['mmi']
	);
}

Technical documentation

You can find documentation, automatically created by PHPDocumentor here: http://diego.sorrentino.gitpages.rm.ingv.it/shakemaps_webservice_library/phpdoc

Test and Deploy

Tests are realized using PHPUnit. You can find code coverage here: http://diego.sorrentino.gitpages.rm.ingv.it/shakemaps_webservice_library/coverage

Contributing

If you want to contribute, please use pull requests. To get a best integration, please code using Test Driven Development (TDD) and Calisthenic Programming.

Authors and acknowledgment

Diego Sorrentino, Istituto Nazionale di Geofisica e Vulcanologia, https://www.ingv.it/organizzazione/chi-siamo/personale/#922

License

GPL v3

Project status

Development in progress