From: Subbarao, S. B. <Sum...@jh...> - 2012-04-23 18:51:54
|
Hello, I just started using Geotools. I have two shapefiles generated via ArcGIS. With GeoTools I am trying to find the areas of each along with determining if they intersect and if so, the area of the intersecting polygon. Below is my code snippet to getArea(): File file = new File(shapefile); FileDataStore store = null; try { store = FileDataStoreFinder.getDataStore(file); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } SimpleFeatureSource featureSource = null; : while (fShape.hasNext()) { SimpleFeature ft = fShape.next(); Geometry geometry = (Geometry)ft.getDefaultGeometry(); double area= geometry.getArea(); : } I get totally different numbers when I try to lookup the area in acres from ArcGIS. I tried printing the wkt and noticed the unit as "m" and assuming my answer is in square meters here... Also, the shapefiles are generated from ArcGIS without Mercator projection (GCS_WGS_1984). There is an example in the userguide about doing a transform to reproject to a standard CRS. Because I am using the standard projection, do I still have to do the math transform? I am not sure what my targetCRS must be? Any help is greatly appreciated!! Thanks, Suma. |