ConstructionConsent: Plan from Mapbox with Rimo coords
This commit is contained in:
@@ -430,5 +430,39 @@ class Rimoapi {
|
||||
return $resp_data;
|
||||
}
|
||||
|
||||
public static function getBuildingGeoJson($building_id) {
|
||||
if(!$building_id) return false;
|
||||
|
||||
$log = mfLoghandler::singleton();
|
||||
|
||||
$params = [];
|
||||
$params['apiKey'] = RIMO_API_JSON_APIKEY;
|
||||
$params['buildingId'] = $building_id;
|
||||
|
||||
$ctx_opts = [
|
||||
'http' => [
|
||||
'method' => 'GET',
|
||||
'header' => 'accept: application/json'
|
||||
]
|
||||
];
|
||||
|
||||
$qs = http_build_query($params);
|
||||
|
||||
$getFileEp = RIMO_API_JSON_URL.RIMO_API_JSON_EP_GET_JSON_FOR_BUILDING;
|
||||
|
||||
$get_url = $getFileEp."?".$qs;
|
||||
$ctx = stream_context_create($ctx_opts);
|
||||
$log->debug(__METHOD__.": Getting GeoJson from Rimo: $get_url");
|
||||
$response = file_get_contents($get_url, false, $ctx);
|
||||
|
||||
if($response === false) {
|
||||
$log->error("Error retrieving GeoJson from RIMO for $building_id");
|
||||
return false;
|
||||
}
|
||||
|
||||
$resp_data = json_decode($response);
|
||||
return $resp_data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user