Package com.ibm.geolib.crs

Provides a factory to create instance of a coordinate reference system.

See: Description

Package com.ibm.geolib.crs Description

Provides a factory to create instance of a coordinate reference system.

The default coordinate system for location object creation is the geographic coordinate system, EPSG:4326 (longitude, latitude). See http://spatialreference.org/ref/epsg/4326/ for more details.

In case other coordinate system is required, a new coordinate reference system can be created, by specifying its parameters, in the following way:

   CoordinateReferenceSystemFactory crsFactory = GeoSpatialService.getService().getCoordinateReferenceSystemFactory();

   CoordinateSystemAxis xAxis = new CoordinateSystemAxis("x", 0, 100, LengthUnit.METER);
   CoordinateSystemAxis yAxis = new CoordinateSystemAxis("y", 0, 100, LengthUnit.METER);

   CoordinateReferenceSystem crs = crsFactory.getCoordinateSystem("My Coordinate System", "coord1", new CoordinateSystemAxis[]{xAxis, yAxis});
 
Later, when new spatial object are created, their points can be created using the defined coordinate system as in this example:
   GeometryFactory gf = GeoSpatialService.getService().getGeometryFactory();

   Point p1 = gf.getPoint(crs, 0,0);
   Point p2 = gf.getPoint(crs, 0,10);

   double d = p1.getDistance(p2, LengthUnit.METER);
 
Decision Server Insights

© Copyright IBM 2017