0

I am working on a batch process for generalizing data (Using a combination of algorithms including Douglas Peucker). Since both the source data (from ESRI shape files) and the required output format data can be in a variety of coordinate reference systems, I am using Proj4j to convert the data between them. Is it possible using Proj4j to project a point from its native real world value onto a flat plane and back again?

ie: If I were writing an application for viewing this data, I would typically take my geometries, apply this transform to them to convert the data into a flat plane, and then apply an AffineTransform to the result to do things like panning and zooming. If I were using WGS84, the distances between projected points would be stretched towards the poles, but this may not necessarily be the case with other coordinate reference systems.

There seems to be plenty in the API for converting between coordinate reference systems, but I have not seen a way of simply projecting the data. (Which I would have assumed would be complimentary functionality.)

Any info on ways of doing this in Proj4, Proj4j or Proj4js would be useful. Failing this, can somebody point me in the direction of a library / API which can do what I am looking for?

tofarr
  • 7,682
  • 5
  • 22
  • 30

1 Answers1

0

It is relatively simple

CoordinateReferenceSystem crs = ...
Projection projection = crs.getProjection();
ProjCoordinate latLng = new ProjCoordinate(45, 35);
ProjCoordinate projected = new ProjCoordinate();
projection.transform(latLng, projected);
tofarr
  • 7,682
  • 5
  • 22
  • 30