Laurent Grégoire
Laurent Grégoire

Reputation: 4146

Convert string representation of coordinate from given CRS using geo tools

I have a string representation of a point in a given CRS (namely, EPSG:3035), such as "N10160E21266". I'd like to parse it using GeoTools to create a DirectPosition, or any another X/Y representation (in order to transform it from a CRS to another CRS; I have a MathTransform at hand).

Is there a parse method already implemented somewhere in GeoTools?

It's probably not difficult to create a custom one, but this may be error-prone and I'm not a GIS specialist (how to properly handle north/easting etc).

Upvotes: 2

Views: 488

Answers (1)

Ian Turton
Ian Turton

Reputation: 10976

That is not a well known representation so there will be no standard parser. It shouldn't be too hard to write one that returns a DirectPosition or a JTS.Point.

The only geographic issue that you need to bear in mind is that epsg:3035 stores east as X and north as Y (which in this case is what you'd expect). You'll need to check the axis order of your target projection.

Upvotes: 1

Related Questions