Commit 36df6bf8 authored by Raph El's avatar Raph El
Browse files

Add Bash Polynésie française

parent 908f5aed
......@@ -7335,6 +7335,60 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
$events = Element::getLastEvents("organizations", "5e203fc98b509c36568b4584", 4, "2016-01-23T00:00:00+04:00");
Rest::json($events); exit;
}
public function actionAddZonePF(){
//$level1 = Zone::createLevel("PF", "Polynésie française", "1");
$url = "https://nominatim.openstreetmap.org/details.php?osmtype=R&osmid=3412620&class=boundary&format=json&email=".Yii::app()->params["contactEmail"];
$nominatim = SIG::getUrl($url);
//var_dump(json_decode($nominatim)); exit;
$nominatim = json_decode($nominatim, true);
$zone=array();
$info=array();
$translates=array();
if(!empty($nominatim)){
$zone["name"] = $nominatim["localname"];
$zone["countryCode"] = "PF";
$zone["level"] = array("1");
// $zone["geo"] = SIG::getFormatGeo($nominatim["lat"], $nominatim["lon"]);
// $zone["geoPosition"] = SIG::getFormatGeoPosition($nominatim["lat"], $nominatim["lon"]);
$lat = $nominatim["geometry"]["coordinates"][1];
$lon = $nominatim["geometry"]["coordinates"][0];
$zone["geo"] = SIG::getFormatGeo($lat, $lon);
$zone["geoPosition"] = SIG::getFormatGeoPosition($lat, $lon);
//$zone["geoShape"] = $nominatim["geojson"];
if(!empty($nominatim["osm_id"]))
$zone["osmID"] = $nominatim["osm_id"];
if(!empty($nominatim["extratags"]["wikidata"]))
$zone["wikidataID"] = $nominatim["extratags"]["wikidata"];
if(!empty($nominatim["names"])){
foreach ($nominatim["names"] as $keyName => $valueName) {
$arrayName = explode(":", $keyName);
if(!empty($arrayName[1]) && $arrayName[0] == "name" && strlen($arrayName[1]) == 2 && $nominatim["localname"] != $valueName){
$translates[strtoupper($arrayName[1])] = $valueName;
}
}
}
$info["countryCode"] = $zone["countryCode"];
$info["parentType"] = Zone::COLLECTION;
$info["translates"] = $translates;
$info["origin"] = $nominatim["localname"];
}
$res = array(
"zone" =>$zone,
"info" =>$info
);
// PHDB::insert(Zone::COLLECTION, $zone );
// $info["parentId"] = (String) $zone["_id"];
// PHDB::insert(Zone::TRANSLATE, $info);
// PHDB::update(Zone::COLLECTION,
// array("_id"=>new MongoId((String) $zone["_id"])),
// array('$set' => array("translateId" => (String)$info["_id"]))
// );
Rest::json($res);
}
public function actionBashforeachActiveTags() {
if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment