ConstructionConsent: Plan from Mapbox with Rimo coords

This commit is contained in:
Frank Schubert
2025-01-20 13:59:22 +01:00
parent 27cc45e23c
commit 269456eed6
4 changed files with 207 additions and 26 deletions

View File

@@ -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;
}
}