Commit aae3818c authored by Chef Projet Prodige's avatar Chef Projet Prodige
Browse files

add queryFeature and identify layername for object param

parent 67b2ffd6
......@@ -111,10 +111,12 @@ Trait ContextTrait
}
$object = $this->request->getQuery('object');
//try WFS Request to find object and get associated extent
// exemple : object=layer6;identifian;2015-001457
if($object!=""){
$queryExtent = $this->getObjectExtent($object, $fileContentAsJson, $accountPath, $account);
if($queryExtent && is_array($queryExtent)){
//ajout d'une tolérance pour les objets ponctuels
......@@ -132,6 +134,11 @@ Trait ContextTrait
$fileContentAsJson["properties"]["bbox"][2] = (float) $queryExtent[0]["maxx"];
$fileContentAsJson["properties"]["bbox"][3] = (float) $queryExtent[0]["maxy"];
$layers = array($queryExtent[1]);
$geoJson = $queryExtent[2];
if($geoJson){
$fileContentAsJson["properties"]["extension"]["queryFeature"] = json_encode($geoJson);
}
}
}
......@@ -225,6 +232,7 @@ Trait ContextTrait
$layerTitle = $properties[0];
$layerName = $this->getLayerName($layerTitle, $contextJson["properties"]["extension"]["layers"]);
$key = $properties[1];
$value = $properties[2];
......@@ -253,13 +261,14 @@ Trait ContextTrait
$geoJson = curl_exec($ch);
//transform featureCollection to extent
try{
$featureCollection = \geoPHP::load($geoJson, 'json');
if($featureCollection){
$bbox = $featureCollection->getBBox();
return array($bbox, $layerName);
return array($bbox, $layerName, $geoJson);
}
} catch (\Exception $e) {
//throw $e; //for dev
......@@ -457,6 +466,12 @@ Trait ContextTrait
&& strcmp($contextLayers["extension"]["layerIdentifier"],$layerTitle)===0) {
return $contextLayers["extension"]["layerName"];
}
//test with mapfile layername
if (array_key_exists('extension', $contextLayers) &&
array_key_exists('name', $contextLayers["extension"])
&& strcmp($contextLayers["extension"]["layerName"],$layerTitle)===0) {
return $contextLayers["extension"]["layerName"];
}
}else{
//pour les groupes, parcours du tableau de layers
foreach ($contextLayers["layers"] as $key => $contextLayer){
......
Supports Markdown
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