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 @@ -