Skip to content

Commit

Permalink
Remove unused extents
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdoug committed Nov 11, 2021
1 parent 78ded9e commit 696ad70
Show file tree
Hide file tree
Showing 95 changed files with 42 additions and 2,757 deletions.
37 changes: 21 additions & 16 deletions src/EPSG/Import/EPSGCodegenFromDataImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -1506,22 +1506,7 @@ public function generateDataCoordinateOperations(): void
$filenameToProviderMap = require 'FilenameToProviderMap.php';
$regionMap = (new RegionMap())();

$wgs84CopiesFromETRS89 = $this->determineOperationsToWGS84CopiedFromETRS89();
$etrs89CopiesFromWGS84 = $this->determineOperationsToETRS89CopiedFromWGS84();
$wgs84CopiesFromGDA94 = $this->determineOperationsToWGS84CopiedFromGDA94();
$wgs84CopiesFromSIRGAS = $this->determineOperationsToWGS84CopiedFromSIRGAS();
$wgs84CopiesFromNZGD = $this->determineOperationsToWGS84CopiedFromNZGD2000();
$projectedToProjected = $this->determineOperationsProjectedToProjected();

$blackListedOperations = [
...self::BLACKLISTED_OPERATIONS,
...$wgs84CopiesFromETRS89,
...$etrs89CopiesFromWGS84,
...$wgs84CopiesFromGDA94,
...$wgs84CopiesFromSIRGAS,
...$wgs84CopiesFromNZGD,
...$projectedToProjected,
];
$blackListedOperations = $this->getBlackedListedOperations();

$sql = "
SELECT
Expand Down Expand Up @@ -1732,6 +1717,26 @@ protected static function makeParamName(string $string): string
return $string;
}

public function getBlacklistedOperations(): array
{
$wgs84CopiesFromETRS89 = $this->determineOperationsToWGS84CopiedFromETRS89();
$etrs89CopiesFromWGS84 = $this->determineOperationsToETRS89CopiedFromWGS84();
$wgs84CopiesFromGDA94 = $this->determineOperationsToWGS84CopiedFromGDA94();
$wgs84CopiesFromSIRGAS = $this->determineOperationsToWGS84CopiedFromSIRGAS();
$wgs84CopiesFromNZGD = $this->determineOperationsToWGS84CopiedFromNZGD2000();
$projectedToProjected = $this->determineOperationsProjectedToProjected();

return [
...self::BLACKLISTED_OPERATIONS,
...$wgs84CopiesFromETRS89,
...$etrs89CopiesFromWGS84,
...$wgs84CopiesFromGDA94,
...$wgs84CopiesFromSIRGAS,
...$wgs84CopiesFromNZGD,
...$projectedToProjected,
];
}

private function determineOperationsToWGS84CopiedFromETRS89(): array
{
$sql = "
Expand Down
24 changes: 20 additions & 4 deletions src/EPSG/Import/EPSGCodegenFromGeoRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class EPSGCodegenFromGeoRepository

private Codegen $codeGen;

public function __construct()
public function __construct(private array $blackListedOperations)
{
$this->sourceDir = dirname(__DIR__, 2);
$this->codeGen = new Codegen();
Expand Down Expand Up @@ -85,13 +85,29 @@ public function generateExtents(): void
SELECT e.extent_code, e.extent_name
FROM epsg_coordoperation o
JOIN epsg_coordinatereferencesystem sourcecrs ON sourcecrs.coord_ref_sys_code = o.source_crs_code AND sourcecrs.coord_ref_sys_kind NOT IN ('engineering', 'derived') AND sourcecrs.deprecated = 0
JOIN epsg_usage u ON u.object_code = o.coord_op_code AND u.object_table_name = 'epsg_coordoperation'
JOIN epsg_extent e ON u.extent_code = e.extent_code
LEFT JOIN epsg_deprecation dep ON dep.object_table_name = 'epsg_coordoperation' AND dep.object_code = o.coord_op_code AND dep.deprecation_date <= '2020-12-14'
WHERE dep.deprecation_id IS NULL AND e.deprecated = 0
AND o.coord_op_name NOT LIKE '%example%'
LEFT JOIN epsg_supersession s ON s.object_table_name = 'epsg_coordoperation' AND s.object_code = o.coord_op_code
WHERE dep.deprecation_id IS NULL AND e.deprecated = 0 AND s.supersession_id IS NULL
AND o.coord_op_type != 'conversion' AND o.coord_op_type != 'concatenated operation' AND o.coord_op_name NOT LIKE '%example%' AND o.coord_op_name NOT LIKE '%mining%'
AND o.coord_op_method_code NOT IN (" . implode(',', EPSGCodegenFromDataImport::BLACKLISTED_METHODS) . ')
AND o.coord_op_code NOT IN (' . implode(',', $this->blackListedOperations) . ")
UNION
SELECT e.extent_code, e.extent_name
FROM epsg_coordoperation o
JOIN epsg_coordinatereferencesystem projcrs ON projcrs.projection_conv_code = o.coord_op_code AND projcrs.coord_ref_sys_kind NOT IN ('engineering', 'derived') AND projcrs.deprecated = 0
JOIN epsg_usage u ON u.object_code = o.coord_op_code AND u.object_table_name = 'epsg_coordoperation'
JOIN epsg_extent e ON u.extent_code = e.extent_code
LEFT JOIN epsg_deprecation dep ON dep.object_table_name = 'epsg_coordoperation' AND dep.object_code = o.coord_op_code AND dep.deprecation_date <= '2020-12-14'
LEFT JOIN epsg_supersession s ON s.object_table_name = 'epsg_coordoperation' AND s.object_code = o.coord_op_code
WHERE dep.deprecation_id IS NULL AND e.deprecated = 0 AND s.supersession_id IS NULL
AND o.coord_op_type = 'conversion' AND o.coord_op_type != 'concatenated operation' AND o.coord_op_name NOT LIKE '%example%' AND o.coord_op_name NOT LIKE '%mining%'
AND o.coord_op_method_code NOT IN (" . implode(',', EPSGCodegenFromDataImport::BLACKLISTED_METHODS) . ')
AND o.coord_op_code NOT IN (' . implode(',', EPSGCodegenFromDataImport::BLACKLISTED_OPERATIONS) . ')
AND o.coord_op_code NOT IN (' . implode(',', $this->blackListedOperations) . ')
GROUP BY e.extent_code
';
Expand Down
2 changes: 1 addition & 1 deletion src/EPSG/Import/generateData.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
require __DIR__ . '/../../../vendor/autoload.php';

$fileImporter = new EPSGCodegenFromDataImport();
$webImporter = new EPSGCodegenFromGeoRepository();
$webImporter = new EPSGCodegenFromGeoRepository($fileImporter->getBlacklistedOperations());
echo '--PERFORMING CODEGEN--' . PHP_EOL;

$fileImporter->generateDataUnitsOfMeasure();
Expand Down
43 changes: 0 additions & 43 deletions src/Geometry/Extents/BoundingBoxOnly/Extent1038.php

This file was deleted.

28 changes: 0 additions & 28 deletions src/Geometry/Extents/BoundingBoxOnly/Extent1281.php

This file was deleted.

28 changes: 0 additions & 28 deletions src/Geometry/Extents/BoundingBoxOnly/Extent2292.php

This file was deleted.

48 changes: 0 additions & 48 deletions src/Geometry/Extents/BoundingBoxOnly/Extent2293.php

This file was deleted.

28 changes: 0 additions & 28 deletions src/Geometry/Extents/BoundingBoxOnly/Extent2307.php

This file was deleted.

28 changes: 0 additions & 28 deletions src/Geometry/Extents/BoundingBoxOnly/Extent2308.php

This file was deleted.

28 changes: 0 additions & 28 deletions src/Geometry/Extents/BoundingBoxOnly/Extent2309.php

This file was deleted.

28 changes: 0 additions & 28 deletions src/Geometry/Extents/BoundingBoxOnly/Extent2310.php

This file was deleted.

28 changes: 0 additions & 28 deletions src/Geometry/Extents/BoundingBoxOnly/Extent2317.php

This file was deleted.

Loading

0 comments on commit 696ad70

Please sign in to comment.