Welcome to the BEAM Forum!

We encourage you to sign in our forum and participate in the BEAM community. The forum is maintained by the BEAM project team who will most likely answer your questions within 24 hours (except during common holidays) - if not done by other community members. Collaborate, share your knowledge and learn from other users!

If you don't find what you are looking for, please also consider the following external forums:

Combination View Flat View Tree View
Threads [ Previous | Next ]
RE: Utilising Geotools CRS in BEAM
toggle
Utilising Geotools CRS in BEAM
epsg geotools
10/9/09 11:25 AM
Hi,

I am wanting to add the ability to directly resample to grids other than latlon in the binning package. I have tried to use the Geotools CRS class to provide a generic approach based on EPSG codes, e.g.

CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4326", true);
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:27700", true);
MathTransform wgs84ToGrid = CRS.findMathTransform(sourceCRS, targetCRS, true);

but the problem is that it fails somewhere in the Geotools code on the first line (the CRS decode static method).
I have tried to catch an exception but none seems to be thrown.

Are there any know issues with generating specific CoordinateReferenceSystem instances?

Tom
Flag Flag
RE: Utilising Geotools CRS in BEAM
10/9/09 11:45 AM as a reply to Thomas Henry Gervase Lankester.
Hi Tom,

I don't know your project settings, but probably you don't have the gt-epsg-hsql.jar on your classpath.
The library defines a database for decoding all the EPSG codes.

Hope this will help you

best wishes
Marco
Flag Flag
RE: Utilising Geotools CRS in BEAM
10/9/09 11:59 AM as a reply to Marco Peters.
Hi Marco,

Yes, I have lib\gt-epsg-hsql-2.5.3.jar in my compile time libraries list.

Tom
Flag Flag
RE: Utilising Geotools CRS in BEAM
10/9/09 1:38 PM as a reply to Thomas Henry Gervase Lankester.
Also in the run-time library list?

It's not sufficient to have during compilation it must be also present while the application is running.

Marco
Flag Flag
RE: Utilising Geotools CRS in BEAM
10/9/09 2:09 PM as a reply to Marco Peters.
Also, if you can't catch an Exception, keep in mind that NoClassDefFoundError in java is an Error, not an exception. If you want to catch Exceptions and errors, catch Throwable - at least to get to the root cause of your problem. Most likely a class cannot be found, as Marco suggested when he asked for them to be included on the runtime classpath.
Flag Flag
RE: Utilising Geotools CRS in BEAM
10/12/09 12:24 PM as a reply to Olaf Kock.
Olaf, Marco,

Thanks. Catching 'throwable' showed that I was indeed missing an org.hsql class.
I had failed to have the hsqldb.jar in my class path.

This should allow me to add a generic way to do flux-conserving resampling to any grid (not just latlon) to the L3 binning package.
I would like to use the same tag for the EPSG code as used in the map reprojection module.

Can you tell me or give me an example of the process request XML with an EPSG or projection tag in it?

Thanks again

Tom
Flag Flag
RE: Utilising Geotools CRS in BEAM
10/15/09 9:21 AM as a reply to Thomas Henry Gervase Lankester.
I'm not sure what example I should show you.

The new reprojection which can handle EPSG codes is not a processor.
It is a GPF operator. It can be invoked from the command-line with the gpt tool.
I've attached a file which contains the help for the reprojection operator dumped by the gpt tool.

You can configure your IDE to start the GPT tool.
Use the same configuration as you use to start VISAT, but with an additional VM parameter
-Dbeam.mainClass=org.esa.beam.framework.gpf.main.Main.

You can also invoke the operator from the source code.
For an example see the org.esa.beam.gpf.common.reproject.ReprojectionOpTest class.
In the method createReprojectedProduct() the operator is invoked.

But be aware that this operator is still under development, so things might change till the next release.

best wishes
Marco
Attachments: Reprojection_Usage.txt (3.1k)
Flag Flag
RE: Utilising Geotools CRS in BEAM
10/26/09 1:40 PM as a reply to Marco Peters.
Ok,
so I suppose that the XML element is <crsCode>string</crsCode> to store the EPSG code.

I think I may need to start a separate thread on my current problem. Having carried out resampling in a generic fashion using (any?) EPSG codes, the final product output reprojects the grid back to lat-long.
Flag Flag