Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
prodige
bdl_visualiseur_core
Commits
aae3818c
Commit
aae3818c
authored
Jul 15, 2021
by
Chef Projet Prodige
Browse files
add queryFeature and identify layername for object param
parent
67b2ffd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Controllers/Traits/ContextTrait.php
View file @
aae3818c
...
...
@@ -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
){
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment