5

I have some data in NAD_1983_StatePlane_Texas_Central_FIPS_4203_Feet

I wish to programmatically transform the coordinates to Lat long in WGS84 datum using JTS.

I know that JTS can transform the coordinates using the following code:

import org.geotools.geometry.jts.JTS;
import org.geotools.referencing.CRS;

CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4326");
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:23032");

MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS);
Geometry targetGeometry = JTS.transform( sourceGeometry, transform);

But my projection does not have an EPSG code.

How do I define the coordinate system in this case? How do I transform my data into EPSG:3857?

  • isn't that the same as spatialreference.org/ref/epsg/2277 – Ian Turton Feb 17 '15 at 7:47
  • @iant: Looks like it is pretty much the same, based on the projection parameters. Someone how I didn't find it. Somehow GDAL had a problem recognizing it. – Devdatta Tengshe Feb 17 '15 at 8:58
  • in general all the state planes have an EPSG code you just need to look by state, datum and unit to work out which one – Ian Turton Feb 17 '15 at 9:03
2

Have a look at this documentation of CRS http://docs.geotools.org/latest/userguide/library/referencing/crs.html#well-known-text

It is possible to set the CRS from WKT. The documentation says:

CoordinateReferenceSystem can also be defined by a text format ((called “Well Known Text” or WKT). This is a standard provided by the OGC and shows up in inside a shapefile “prj” file, or in a databases such as PostGIS and Oracle.

To parse WKT please use the CRS.parseWKT( txt ) method.

It is possible to get the WKT from the PRJ file or even from http://spatialreference.org/ref/sr-org/nad_1983_stateplane_texas_central_fips_4203_feet/ogcwkt/

Once the CRS is set from the WKT, the rest of the process is as it was.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.