From 696ad70278a36c3bdaceb0251a336ee080b61f00 Mon Sep 17 00:00:00 2001 From: Doug Wright Date: Thu, 11 Nov 2021 16:31:19 +0000 Subject: [PATCH] Remove unused extents --- src/EPSG/Import/EPSGCodegenFromDataImport.php | 37 ++++++---- .../Import/EPSGCodegenFromGeoRepository.php | 24 +++++- src/EPSG/Import/generateData.php | 2 +- .../Extents/BoundingBoxOnly/Extent1038.php | 43 ----------- .../Extents/BoundingBoxOnly/Extent1281.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2292.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2293.php | 48 ------------ .../Extents/BoundingBoxOnly/Extent2307.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2308.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2309.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2310.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2317.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2318.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2320.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2321.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2322.php | 38 ---------- .../Extents/BoundingBoxOnly/Extent2402.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2403.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2422.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2548.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2549.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2550.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2551.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2553.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2554.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2556.php | 38 ---------- .../Extents/BoundingBoxOnly/Extent2557.php | 48 ------------ .../Extents/BoundingBoxOnly/Extent2558.php | 38 ---------- .../Extents/BoundingBoxOnly/Extent2559.php | 33 --------- .../Extents/BoundingBoxOnly/Extent2578.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2579.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2580.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2581.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2582.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2583.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2584.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2585.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2586.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2587.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2601.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2877.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2878.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2962.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2965.php | 28 ------- .../Extents/BoundingBoxOnly/Extent2966.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3227.php | 43 ----------- .../Extents/BoundingBoxOnly/Extent3332.php | 73 ------------------- .../Extents/BoundingBoxOnly/Extent3345.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3346.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3347.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3348.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3349.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3350.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3351.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3352.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3353.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3354.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3358.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3359.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3360.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3397.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3560.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3695.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3701.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3702.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3704.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3706.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3708.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3709.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3710.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3711.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3712.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3714.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3715.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3717.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3718.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3719.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3722.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3723.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3724.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3725.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3728.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3729.php | 28 ------- .../Extents/BoundingBoxOnly/Extent3848.php | 33 --------- .../Extents/BoundingBoxOnly/Extent3850.php | 33 --------- .../Extents/BoundingBoxOnly/Extent4614.php | 28 ------- src/Geometry/Extents/Extent2732.php | 28 ------- src/Geometry/Extents/Extent2733.php | 28 ------- src/Geometry/Extents/Extent2734.php | 28 ------- src/Geometry/Extents/Extent2735.php | 28 ------- src/Geometry/Extents/Extent2736.php | 28 ------- src/Geometry/Extents/Extent2737.php | 28 ------- src/Geometry/Extents/Extent2738.php | 28 ------- src/Geometry/Extents/Extent2739.php | 28 ------- src/Geometry/Extents/Extent2740.php | 28 ------- 95 files changed, 42 insertions(+), 2757 deletions(-) delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent1038.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent1281.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2292.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2293.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2307.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2308.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2309.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2310.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2317.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2318.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2320.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2321.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2322.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2402.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2403.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2422.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2548.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2549.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2550.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2551.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2553.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2554.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2556.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2557.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2558.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2559.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2578.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2579.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2580.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2581.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2582.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2583.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2584.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2585.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2586.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2587.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2601.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2877.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2878.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2962.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2965.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent2966.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3227.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3332.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3345.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3346.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3347.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3348.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3349.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3350.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3351.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3352.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3353.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3354.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3358.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3359.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3360.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3397.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3560.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3695.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3701.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3702.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3704.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3706.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3708.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3709.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3710.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3711.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3712.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3714.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3715.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3717.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3718.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3719.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3722.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3723.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3724.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3725.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3728.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3729.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3848.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent3850.php delete mode 100644 src/Geometry/Extents/BoundingBoxOnly/Extent4614.php delete mode 100644 src/Geometry/Extents/Extent2732.php delete mode 100644 src/Geometry/Extents/Extent2733.php delete mode 100644 src/Geometry/Extents/Extent2734.php delete mode 100644 src/Geometry/Extents/Extent2735.php delete mode 100644 src/Geometry/Extents/Extent2736.php delete mode 100644 src/Geometry/Extents/Extent2737.php delete mode 100644 src/Geometry/Extents/Extent2738.php delete mode 100644 src/Geometry/Extents/Extent2739.php delete mode 100644 src/Geometry/Extents/Extent2740.php diff --git a/src/EPSG/Import/EPSGCodegenFromDataImport.php b/src/EPSG/Import/EPSGCodegenFromDataImport.php index e0da82f51..e08f1a87f 100644 --- a/src/EPSG/Import/EPSGCodegenFromDataImport.php +++ b/src/EPSG/Import/EPSGCodegenFromDataImport.php @@ -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 @@ -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 = " diff --git a/src/EPSG/Import/EPSGCodegenFromGeoRepository.php b/src/EPSG/Import/EPSGCodegenFromGeoRepository.php index 29fea2c53..0181ef5fe 100644 --- a/src/EPSG/Import/EPSGCodegenFromGeoRepository.php +++ b/src/EPSG/Import/EPSGCodegenFromGeoRepository.php @@ -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(); @@ -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 '; diff --git a/src/EPSG/Import/generateData.php b/src/EPSG/Import/generateData.php index ac2684cac..12715c764 100644 --- a/src/EPSG/Import/generateData.php +++ b/src/EPSG/Import/generateData.php @@ -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(); diff --git a/src/Geometry/Extents/BoundingBoxOnly/Extent1038.php b/src/Geometry/Extents/BoundingBoxOnly/Extent1038.php deleted file mode 100644 index 171563b2f..000000000 --- a/src/Geometry/Extents/BoundingBoxOnly/Extent1038.php +++ /dev/null @@ -1,43 +0,0 @@ -