Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
259 changes: 259 additions & 0 deletions src/NN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "USA-HI",
"properties": {
"fips": "15",
"name": "NN"
},
"geometry": {
"type": "MultiPolygon",
"coordinates":[
[
[
[
47.771103,
57.888329
],
[
47.386658,
58.023322
],
[
46.341325,
58.074737
],
[
45.569993,
57.931938
],
[
44.989433999999996,
58.091102
],
[
44.802217,
58.019157
],
[
44.867767,
57.879991
],
[
44.747215,
57.706384
],
[
44.315543999999996,
57.519442
],
[
43.841376999999994,
57.429995999999996
],
[
43.524711999999994,
57.563883
],
[
43.47693699999999,
57.624162
],
[
43.160653999999994,
57.279852
],
[
43.199535999999995,
56.862739
],
[
42.832215,
56.808046999999995
],
[
42.9011,
56.65193599999999
],
[
42.879433999999996,
56.46583299999999
],
[
42.588044,
56.42027899999999
],
[
42.976937,
56.18721699999999
],
[
42.685823,
56.13889199999999
],
[
42.713327,
56.00417399999999
],
[
42.090547,
55.65027799999999
],
[
42.138047,
55.442499999999995
],
[
41.792497,
55.08056199999999
],
[
41.956939999999996,
55.003893999999995
],
[
42.18665299999999,
54.94639299999999
],
[
42.473876999999995,
55.00556499999999
],
[
42.46690399999999,
54.87139599999999
],
[
42.62860099999999,
54.78445199999999
],
[
43.07638399999999,
54.78334599999999
],
[
43.41971399999999,
54.94666699999999
],
[
44.438039999999994,
54.53667199999999

],
[
44.62526499999999,
54.58555999999999
],
[
44.59832699999999,
54.46972299999999
],
[
45.10110399999999,
54.48750599999999
],
[
45.053602999999995,
54.75278799999999
],
[
45.425824999999996,
54.880557999999986
],
[
45.477208999999995,
55.08972399999999
],
[
45.726093999999996,
55.18055899999999
],
[
45.698041999999994,
54.975557999999985
],
[
46.016102999999994,
55.015557999999984
],
[
46.382206999999994,
55.43888899999998
],
[
45.956936999999996,
55.627493999999984
],
[
46.21353499999999,
56.049520999999984
],
[
46.086651999999994,
56.17138399999998
],
[
45.879155999999995,
56.24860899999998
],
[
45.949712,
56.43832899999998
],
[
45.651379,
56.46388699999998
],
[
45.646101,
56.58888599999998
],
[
45.92777,
56.650545999999984
],
[
45.957768,
56.87276699999998
],
[
46.752773000000005,
56.96859899999998
],
[
46.726376,
57.199998999999984
],
[
46.851933,
57.234436999999986
],
[
46.676099,
57.34999899999998
],
[
46.744435,
57.52332299999998
],
[
47.471097,
57.52860299999998
],
[
47.561101,
57.802489999999985
],
[
47.76971,
57.881658999999985
]
]
]
]
}
}
]
}
24 changes: 24 additions & 0 deletions src/size_of_area.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from pyproj import Geod
from shapely.geometry import shape, Polygon
from shapely.ops import orient
from sentinelhub import read_data
from area import area
import sys
import argparse

def size_of_area(area):
geod = Geod(ellps="WGS84")
poly_area, poly_perimeter = geod.geometry_area_perimeter(orient(area))
return poly_area

def main():
parser = argparse.ArgumentParser(
description='Size calculator', add_help=False)
args = parser.add_argument_group('Options')
args.add_argument('-a', '--area', type=str, required=True)
geo_json = read_data(parser.parse_args().area)
area = shape(geo_json["features"][0]["geometry"])
print(size_of_area(area))

if __name__ == '__main__':
sys.exit(main() or 0)