Hello Suryaa

Le 2025-02-11 à 20 h 09, Suryaa Charan Shivakumar a écrit :

I'd like to store non-standard CRS. Is there any way to do it currently or is it in the plans?

Yes, it is possible. First, we need to choose an "authority" name. Let's take "MyAuthority" for this email. Then, the additional CRS can be specified in a WKT file like this one:

https://sis.apache.org/apidocs/org.apache.sis.referencing/org/apache/sis/io/wkt/doc-files/ESRI.txt

Note: the above example uses an SIS-specific syntax, which is to declare fragments of WKT with something like "SET WGS84=...", then reuse these fragments with the dollar sign. For example, "$WGS84" is substituted with the value of "SET WGS84=...". This syntax can reduce a lot the amount of duplications when there is many CRS to define, but is specific to Apache SIS. If you want portable WKT definitions, this part of above-cited example file needs to be ignored.

It is important that each CRS definition contains an "ID["MyAuthority", xxxx]" WKT element, where "MyAuthority" is the authority name chosen for the custom CRS. Then, create a subclass of WKTDictionary as documented there (substitute "MyAuthority" by the chosen authority name):

https://sis.apache.org/apidocs/org.apache.sis.referencing/org/apache/sis/io/wkt/WKTDictionary.html#example-heading

Register your custom implementation in META-INF/services or module-info.java, depending on whether you are using Java modules system. After all those steps have been completed, the method which was used for fetching EPSG code (e.g. CRS.forCode("EPSG:4326")) should recognize also the custom CRS (e.g. CRS.forCode("MyAuthority:1234")).

    Martin


Reply via email to