locationtech / proj4j

Java port of the Proj.4 library for coordinate reprojection
Other
184 stars 73 forks source link

Projection.getEPSGCode() always returns 0 #24

Open securedimensions opened 5 years ago

securedimensions commented 5 years ago

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']

pomadchin commented 5 years ago

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.

echeipesh commented 5 years ago

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.