0

We have a GeoJSON file that contains an array of features each with their associated geometry. How can I calculate the area of each feature? Are there any Java or Swift libraries to help me? Any advice on how to get started here?

Please excuse the naive nature of this question. I'm new to this GeoJSON stuff.

2

3 Answers 3

6

GeoTools is a Java library which can read and write GeoJSON and provides access to features like area via the JTS library. It will also help you to reproject the geometries from the lat/lon of GeoJSON to a suitable projection for calculating areas in m^2.

3
  • I thought this was off-topic considering the ios and javascript tags but there is indeed a javascript port of GeoTools github.com/jillesvangurp/geotools-js.
    – user30184
    Nov 24, 2015 at 9:13
  • I was doubtful too but he specifically mentions java in the question
    – Ian Turton
    Nov 24, 2015 at 9:15
  • I should have made that more clear. I am currently trying to make the decision to do this on the back end (Java/Clojure) or on the front end (iOS and Android) and am trying to figure out the tradeoffs.
    – Bob Kuhar
    Nov 24, 2015 at 17:56
5

You can do this several ways, I think that the easiest (if you only have a few GIS things to do)
is to use Turf see here

There are also a couple of GIS library whom are a bit heavier (size wise) leaflet: how to

After you can also try openlayers3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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