} $req .= '&proxyUrl=' . $proxyURL; $req .= '&catalog=' . $catalogURL; $req .= '&catalogType=' . $catalogType; //$req = "catalog=http://disasterschartercatalog.org/ebrrcecec4/webservice&cursor=1&maxResults=10&startDate=&completionDate=&LLlat=-90&LLlon=-180&URlat=90&URlon=180&satelliteName=---&disasterStartDate=&disasterEndDate=&disasterType=&disasterActivationId=&disasterCallId=&catalogType=ebRR"; /** * Get POST data */ $curl = initCurl($catalogProxyURL); curl_setopt($curl, CURLOPT_URL, urldecode($catalogProxyURL)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($curl, CURLOPT_POSTFIELDS, $req); curl_setopt($curl, CURLOPT_POST, 1); $theData = curl_exec($curl); curl_close($curl); /* json result */ $json = json_decode($theData); $geojson = array('type' => 'FeatureCollection', 'totalResults' => isset($json->results) ? $json->results : 0, 'features' => array()); if (isset($json->rows)) { foreach ($json->rows as $row) { /* * Add feature */ $feature = array('type' => 'Feature', 'geometry' => poslistToGeoJSONGeometry($row->poslist, LATLON), 'properties' => array('identifier' => $row->identifier, 'producttype' => $row->producttype, 'beginposition' => $row->beginposition, 'endposition' => $row->endposition, 'acquisitiontype' => $row->acquisitiontype, 'status' => $row->status, 'triggeringidentifier' => $row->triggeringidentifier, 'description' => $row->description, 'disasterdate' => $row->disasterdate, 'disastertype' => $row->disastertype, 'location' => $row->location, 'thumbnail' => $row->thumbnail, 'quicklook' => $row->quicklook)); // Add feature array to feature collection array array_push($geojson['features'], $feature); } } /* Returns encoded geojson string */ echo json_encode($geojson);
* &zt=rectangle * &nwlat=52&selat=48&nwlon=9&selon=13 * &sk={key} * */ $req .= '&of=json&zt=rectangle&sk=2KYfZcCsisLrlToDWn5_uQ::'; $url = 'http://api.spotimage.com/catalog/spot/data/Dali.svc/search?' . $req; $json = json_decode(getRemoteData($url, null, false)); $geojson = array('type' => 'FeatureCollection', 'features' => array()); /* * Error ? */ if ($json->Message != null) { $error = array('code' => $json->Code, 'message' => $json->Message); $geojson['error'] = $error; } else { foreach ($json->Scenes as $row) { /* * Compute poslist from scene coordinates */ $poslist = $row->LowerLeft->Longitude . " " . $row->LowerLeft->Latitude . " " . $row->LowerRight->Longitude . " " . $row->LowerRight->Latitude . " " . $row->UpperRight->Longitude . " " . $row->UpperRight->Latitude . " " . $row->UpperLeft->Longitude . " " . $row->UpperLeft->Latitude . " " . $row->LowerLeft->Longitude . " " . $row->LowerLeft->Latitude; /* * Add feature */ $feature = array('type' => 'Feature', 'geometry' => poslistToGeoJSONGeometry($poslist, LONLAT), 'properties' => array('identifier' => $row->Id, 'acquisitiondate' => $row->AcquisitionDate, 'archivingstation' => $row->ArchivingStation, 'satellite' => $row->Satellite, 'sensorfamily' => $row->SensorFamily, 'resolution' => $row->Resolution, 'cloudcoverpercentage' => $row->CloudCoverPercentage, 'snowcoverpercentage' => $row->SnowCoverPercentage, 'incidenceangle' => $row->IncidenceAngle, 'quicklook' => $row->ImageUrl, 'thumbnail' => $row->ImageUrl)); // Add feature array to feature collection array array_push($geojson['features'], $feature); } } /* Returns encoded geojson string */ echo json_encode($geojson);