/** * Create JSON feature from new resource xml string * * <product> <title>S1A_IW_OCN__2SDV_20150727T044706_20150727T044731_006992_0097D1_F6DA</title> <resourceSize>6317404</resourceSize> <startTime>2015-07-27T04:47:06.611</startTime> <stopTime>2015-07-27T04:47:31.061</stopTime> <productType>OCN</productType> <missionId>S1A</missionId> <processingLevel>1</processingLevel> <mode>IW</mode> <absoluteOrbitNumber>6992</absoluteOrbitNumber> <orbitDirection>ASCENDING</orbitDirection> <s2takeid>38865</s2takeid> <cloudcover>0.0</cloudcover> <instrument>Multi-Spectral Instrument</instrument> <footprint>POLYGON ((-161.306549 21.163258,-158.915909 21.585093,-158.623169 20.077986,-160.989746 19.652864,-161.306549 21.163258))</footprint> </product> * * @param {DOMDocument} $dom : $dom DOMDocument */ private function parseNew($dom) { /* * Retrieves orbit direction */ $orbitDirection = strtolower($dom->getElementsByTagName('orbitDirection')->item(0)->nodeValue); $polygon = RestoGeometryUtil::WKTPolygonToArray($dom->getElementsByTagName('footprint')->item(0)->nodeValue); /* * Initialize feature */ $feature = array('type' => 'Feature', 'geometry' => array('type' => 'Polygon', 'coordinates' => array($polygon)), 'properties' => array('productIdentifier' => $dom->getElementsByTagName('title')->item(0)->nodeValue, 'title' => $dom->getElementsByTagName('title')->item(0)->nodeValue, 'resourceSize' => $dom->getElementsByTagName('resourceSize')->item(0)->nodeValue, 'authority' => 'ESA', 'startDate' => $dom->getElementsByTagName('startTime')->item(0)->nodeValue, 'completionDate' => $dom->getElementsByTagName('stopTime')->item(0)->nodeValue, 'productType' => $dom->getElementsByTagName('productType')->item(0)->nodeValue, 'processingLevel' => $dom->getElementsByTagName('processingLevel')->item(0)->nodeValue, 'platform' => $dom->getElementsByTagName('missionId')->item(0)->nodeValue, 'sensorMode' => $dom->getElementsByTagName('mode')->item(0)->nodeValue, 'orbitNumber' => $dom->getElementsByTagName('absoluteOrbitNumber')->item(0)->nodeValue, 'orbitDirection' => $orbitDirection, 'instrument' => $dom->getElementsByTagName('instrument')->item(0)->nodeValue, 'quicklook' => $this->getLocation($dom), 's2TakeId' => $dom->getElementsByTagName('s2takeid')->item(0)->nodeValue, 'cloudCover' => $dom->getElementsByTagName('cloudCover')->item(0)->nodeValue)); return $feature; }
/** * Create JSON feature from old resource xml string * <product> <adsHeader> <missionId>S1A</missionId> <productType>GRD</productType> <polarisation>VV</polarisation> <mode>IW</mode> <swath>IW</swath> <startTime>2014-10-03T18:47:39.842715</startTime> <stopTime>2014-10-03T18:48:08.834276</stopTime> <absoluteOrbitNumber>2669</absoluteOrbitNumber> <missionDataTakeId>12181</missionDataTakeId> <imageNumber>001</imageNumber> </adsHeader> (...) <geolocationGrid> <geolocationGridPointList count="231"> <geolocationGridPoint> <azimuthTime>2014-10-03T18:47:39.842455</azimuthTime> <slantRangeTime>5.364633780973990e-03</slantRangeTime> <line>0</line> <pixel>0</pixel> <latitude>6.588778439216060e+01</latitude> <longitude>1.785002983064243e+02</longitude> (...) * * @param {DOMDocument} $dom : $dom DOMDocument */ private function parseOld($dom) { /* * Retreives geolocation grid point */ $geolocationGridPoint = $dom->getElementsByTagName('geolocationGridPoint'); /* * Retreives orbit direction */ $orbitDirection = strtolower($dom->getElementsByTagName('pass')->item(0)->nodeValue); /* * Performs an inversion of the specified Sentinel-1 quicklooks footprint (inside the ZIP files, i.e SAFE product). * The datahub systematically performs an inversion of the Sentinel-1 quicklooks taking as input the quicklook images (.png) inside * the ZIP files (i.e. as produced by the S1 ground segment). */ $polygon = $this->readFootprintFromGeolocationGridPoint($geolocationGridPoint, $orbitDirection); /* * Initialize feature */ $feature = array('type' => 'Feature', 'geometry' => array('type' => 'Polygon', 'coordinates' => array($polygon)), 'properties' => array('productIdentifier' => $dom->getElementsByTagName('title')->item(0)->nodeValue, 'title' => $dom->getElementsByTagName('title')->item(0)->nodeValue, 'resourceSize' => $dom->getElementsByTagName('resourceSize')->item(0)->nodeValue, 'authority' => 'ESA', 'startDate' => $dom->getElementsByTagName('startTime')->item(0)->nodeValue, 'completionDate' => $dom->getElementsByTagName('stopTime')->item(0)->nodeValue, 'productType' => $dom->getElementsByTagName('productType')->item(0)->nodeValue, 'processingLevel' => 'LEVEL1', 'platform' => $dom->getElementsByTagName('missionId')->item(0)->nodeValue, 'sensorMode' => $dom->getElementsByTagName('mode')->item(0)->nodeValue, 'orbitNumber' => $dom->getElementsByTagName('absoluteOrbitNumber')->item(0)->nodeValue, 'orbitDirection' => $orbitDirection, 'swath' => $dom->getElementsByTagName('swath')->item(0)->nodeValue, 'polarisation' => $dom->getElementsByTagName('polarisation')->item(0)->nodeValue, 'missionTakeId' => $dom->getElementsByTagName('missionDataTakeId')->item(0)->nodeValue, 'quicklook' => $this->getLocation($dom), 'cloudCover' => 0)); return $feature; }