Select to view content in your preferred language

Design: Instances of Geometry do not have a Spatial Reference

927
0
04-09-2012 03:44 PM
Jan-Tschada
Esri Contributor
We do not really understand why the implemented geometries (Point, Envelope, Polygon and so on) do not have a spatial reference. For each spatial operation on geometries you have to know the spatial reference of each. So we come up with defining our on class wrapping the geometry implementation and offering the access to the corresponding spatial reference.

public class SpatialGeometry {

 private final Geometry geometry;
 private final SpatialReference spatialReference;
 
 public SpatialGeometry(Geometry geometry, SpatialReference spatialReference) {
  this.geometry = geometry;
  this.spatialReference = spatialReference;
 }
 
 public static SpatialGeometry createWgs84Geometry(Geometry geometry) {
  return new SpatialGeometry(geometry, SpatialReference.create(SpatialReferenceCode.Wgs84.getCode()));
 }
 .
 .
 . 

 public Geometry getGeometry() {
  return geometry;
 }

 public SpatialReference getSpatialReference() {
  return spatialReference;
 }
}


It would be nice to get some feedback why the geometries are implemented without having a spatial reference.
Product Manager
Developers and Location Services
Germany and Switzerland
0 Kudos
0 Replies