proj4j icon indicating copy to clipboard operation
proj4j copied to clipboard

Projection.getEPSGCode() always returns 0

Open securedimensions opened this issue 5 years ago • 2 comments

What is the method to get the integer code for a CRS identified by name?

The method getESPGCode() has hardcodes return 0:

    /**
     * Returns the ESPG code for this projection, or 0 if unknown.
     */
    public int getEPSGCode() {
        return 0;
    }

[lines 750-755 of file òrg.locationtech.proj4j.proj.Projection']

securedimensions avatar Mar 18 '19 08:03 securedimensions

It is an a way to define default methods here. Usually it is overloaded in some child class, for example like it is done in a WebMercator class.

pomadchin avatar Jun 25 '19 16:06 pomadchin

To clarify these issue further, this would not the the CRS EPSG but rather the EPSG code of the Projection or OperationMethod in EPSG parlance.

For instance EqualAreaAzimuthalProjection.java would be EPSG::9820

I think the only way to really handle address this issue to manually review the list of projections offered here and update the method override. Although I have to say that at least in my use case I have never had to consider the Projection EPSG code as separate from CRS EPSG code.

echeipesh avatar Aug 26 '19 17:08 echeipesh