Merge branch 'fronkdev' into 'master'
Importing adb netzgebiet borderpoly See merge request fronk/thetool!239
This commit is contained in:
@@ -57,6 +57,7 @@ foreach($netowners as $apiOwner) {
|
||||
$epGetWorkorders = $apiUrl.RIMO_API_JSON_EP_QUERY_WORKORDERS;
|
||||
$epGetService = $apiUrl.RIMO_API_JSON_EP_QUERY_SERVICE;
|
||||
$epGetGeoJsonForBuilding = $apiUrl.RIMO_API_JSON_EP_GET_JSON_FOR_BUILDING;
|
||||
$epGetGeoJsonForCluster = $apiUrl.RIMO_API_JSON_EP_GET_JSON_FOR_CLUSTER;
|
||||
|
||||
$import_count = 0;
|
||||
|
||||
@@ -116,9 +117,45 @@ foreach($netowners as $apiOwner) {
|
||||
}
|
||||
|
||||
|
||||
if($cluster_rimo_id != "SDISalesCluster_85942336257_1707118316") {
|
||||
/*if($cluster_rimo_id != "SDISalesCluster_85942336257_1707118316") {
|
||||
// wettmannstaettten
|
||||
continue;
|
||||
}*/
|
||||
|
||||
/*
|
||||
* get Cluster Outline Coords
|
||||
*/
|
||||
|
||||
$params = $baseParams;
|
||||
$params['clusterId'] = $cluster_rimo_id;
|
||||
$qs = http_build_query($params);
|
||||
$req_url = $epGetGeoJsonForCluster."?".$qs;
|
||||
$req_ctx = stream_context_create($ctxOptsGet);
|
||||
//echo $req_url."\n";
|
||||
$responseText = file_get_contents($req_url, false, $req_ctx);
|
||||
if($responseText === false) {
|
||||
//echo "Error fetching Workorders for building $rimo_building_id\n";
|
||||
continue;
|
||||
}
|
||||
$geodataResponse = json_decode($responseText);
|
||||
|
||||
if(is_object($geodataResponse) && is_array($geodataResponse->features)) {
|
||||
foreach($geodataResponse->features as $feature) {
|
||||
if(is_object($feature) && property_exists($feature, "geometry") && is_array($feature->geometry->coordinates)) {
|
||||
$coords = $feature->geometry->coordinates[0];
|
||||
$poly = [];
|
||||
foreach($coords as $coord) {
|
||||
$long = $coord[0];
|
||||
$lat = $coord[1];
|
||||
$poly[] = [$lat, $long];
|
||||
}
|
||||
if($poly) $poly = json_encode($poly);
|
||||
if($adb_netzgebiet->borderpoly != $poly) {
|
||||
$adb_netzgebiet->borderpoly = $poly;
|
||||
$adb_netzgebiet->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$AddressHelper = new ADBAddressHelper\AddressHelper(["log" => $log, "db" => $adb, "netzgebiet" => $adb_netzgebiet]);
|
||||
|
||||
Reference in New Issue
Block a user