You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@sis.apache.org by Suryaa Charan Shivakumar <ss...@ucr.edu> on 2025/02/11 19:09:21 UTC

Support for custom CRS

Hello team,

Hope you are doing well. I have been trying to use Apache SIS as part of my
GIS application. For the EPSG data I have used the non-free dependency to
install the data and apache derby to access it. In case, I'd like to store
non-standard CRS. Is there any way to do it currently or is it in the
plans?

It will be helpful for processing Raster Data from satellite images that
may have non-standard CRS.

Thank you for your amazing work and time.

Best,
Suryaa

Re: Support for custom CRS

Posted by Suryaa Charan Shivakumar <ss...@ucr.edu>.
Hello Martin,

Thank you for your prompt response and adding the supporting information. I
am still working on developing the proof of concept, I will update if the
documentation needs any changes. Have a nice day.

Best,
Suryaa

On Wed, Feb 12, 2025 at 3:27 AM Martin Desruisseaux <
martin.desruisseaux@geomatys.com> wrote:

> Hello again Suryaa
>
> Le 2025-02-11 à 20 h 09, Suryaa Charan Shivakumar a écrit :
>
> > (…snip…) I'd like to store non-standard CRS. Is there any way to do it
> > currently or is it in the plans?
>
> Since this is a question that was raised a bit often by other users too,
> I added an "How to" page:
>
>      https://sis.apache.org/howto/custom_crs.html
>
> Please let me know if there is anything unclear or not working as expected.
>
> Martin
>
>
>

Re: Support for custom CRS

Posted by Martin Desruisseaux <ma...@geomatys.com>.
Hello again Suryaa

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

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

Since this is a question that was raised a bit often by other users too, 
I added an "How to" page:

     https://sis.apache.org/howto/custom_crs.html

Please let me know if there is anything unclear or not working as expected.

Martin



Re: Support for custom CRS

Posted by Martin Desruisseaux <ma...@geomatys.com>.
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