Skip to content

Commit

Permalink
feat: racine du endpoint dans la métadonnée #452
Browse files Browse the repository at this point in the history
  • Loading branch information
ocruze committed Jun 27, 2024
1 parent cf7ef7e commit b0f5b37
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Services/EntrepotApi/CartesMetadataApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use App\Entity\CswMetadata\CswStyleFile;
use App\Exception\AppException;
use App\Exception\CartesApiException;
use App\Services\CapabilitiesService;
use App\Services\CswMetadataHelper;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\Response;
Expand All @@ -31,7 +30,6 @@ public function __construct(
private MetadataApiService $metadataApiService,
private ConfigurationApiService $configurationApiService,
private CswMetadataHelper $cswMetadataHelper,
private CapabilitiesService $capabilitiesService,
private CartesServiceApiService $cartesServiceApiService,
) {
}
Expand Down Expand Up @@ -264,17 +262,18 @@ private function getMetadataLayers(string $datastoreId, string $datasheetName):

switch ($configuration['type']) {
case ConfigurationTypes::WFS:
$subLayers = $this->getWfsSubLayers($configuration, $offering, $serviceEndpoint['endpoint']['urls'][0]['url']);
$endpointUrl = $serviceEndpoint['endpoint']['urls'][0]['url'];
$subLayers = $this->getWfsSubLayers($configuration, $offering, $endpointUrl);
$layers = array_merge($layers, $subLayers);

break;

case ConfigurationTypes::WMSVECTOR:
$layerName = $offering['layer_name'];
$endpointType = 'OGC:WMS';
$getCapUrl = $this->capabilitiesService->getGetCapUrl($serviceEndpoint['endpoint']['urls'][0]['url'], $offering['urls'][0]['url'], 'WMS');
$endpointUrl = $serviceEndpoint['endpoint']['urls'][0]['url'];

$layers[] = new CswMetadataLayer($layerName, $endpointType, $getCapUrl, $offering['_id']);
$layers[] = new CswMetadataLayer($layerName, $endpointType, $endpointUrl, $offering['_id']);
break;

case ConfigurationTypes::WMTSTMS:
Expand Down Expand Up @@ -309,9 +308,8 @@ private function getWfsSubLayers(array $configuration, array $offering, string $
$relationLayers = array_map(function ($relation) use ($offering, $serviceEndpointUrl) {
$layerName = sprintf('%s:%s', $offering['layer_name'], $relation['native_name']);
$endpointType = 'OGC:WFS';
$getCapUrl = $this->capabilitiesService->getGetCapUrl($serviceEndpointUrl, $offering['urls'][0]['url'], 'WFS');

return new CswMetadataLayer($layerName, $endpointType, $getCapUrl, $offering['_id']);
return new CswMetadataLayer($layerName, $endpointType, $serviceEndpointUrl, $offering['_id']);
}, $configRelations);

return $relationLayers;
Expand Down

0 comments on commit b0f5b37

Please sign in to comment.