Skip to content

Commit

Permalink
updated v0.2.6
Browse files Browse the repository at this point in the history
- Skysat area are calculated using EPSG:3857 to resolve metadata EPSG issue
- General improvements
  • Loading branch information
samapriya committed Apr 15, 2019
1 parent 5badcb3 commit 313b4fd
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ A simple setup would be

## Changelog

### v0.2.6
- Skysat area are calculated using EPSG:3857 to resolve metadata EPSG issue
- General improvements

### v0.2.5
- Fixed issue with area calculation estimates
- General improvements
Expand Down
Binary file removed dist/porder-0.2.5.tar.gz
Binary file not shown.
Binary file added dist/porder-0.2.6.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion porder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = 'Samapriya Roy'
__email__ = '[email protected]'
__version__ = '0.2.5'
__version__ = '0.2.6'
22 changes: 15 additions & 7 deletions porder/geojson2id.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
far=[]
n=0

def handle_page(page,asset,num,outfile,gmain,ovp):
def handle_page(page,item,asset,num,outfile,gmain,ovp):
global n
if num is None:
[head,tail]=os.path.split(outfile)
Expand All @@ -60,11 +60,15 @@ def handle_page(page,asset,num,outfile,gmain,ovp):
if items['geometry']['type']=="Polygon":
bounds=items['geometry']['coordinates']
temp['coordinates']=bounds
epsgcode=items['properties']['epsg_code']
#https://stackoverflow.com/questions/51554602/how-do-i-get-the-area-of-a-geojson-polygon-with-python
if item.startswith('SkySat'):
epsgcode='3857'
else:
epsgcode=items['properties']['epsg_code']
geom2=shape(temp)
if gmain.area>geom2.area:
intersect=(geom2).intersection(gmain)
elif geom2.area>gmain.area:
elif geom2.area>=gmain.area:
intersect=(gmain).intersection(geom2)
#print('ID '+str(it)+' has percentage overlap: '+str(intersect.area/geommain.area*100))
proj = partial(pyproj.transform, pyproj.Proj(init='epsg:4326'),
Expand All @@ -89,11 +93,15 @@ def handle_page(page,asset,num,outfile,gmain,ovp):
if items['geometry']['type']=="Polygon":
bounds=items['geometry']['coordinates']
temp['coordinates']=bounds
epsgcode=items['properties']['epsg_code']
#https://stackoverflow.com/questions/51554602/how-do-i-get-the-area-of-a-geojson-polygon-with-python
if item.startswith('SkySat'):
epsgcode='3857'
else:
epsgcode=items['properties']['epsg_code']
geom2=shape(temp)
if gmain.area>geom2.area:
intersect=(geom2).intersection(gmain)
elif geom2.area>gmain.area:
elif geom2.area>=gmain.area:
intersect=(gmain).intersection(geom2)
#print('ID '+str(it)+' has percentage overlap: '+str(intersect.area/geommain.area*100))
proj = partial(pyproj.transform, pyproj.Proj(init='epsg:4326'),
Expand Down Expand Up @@ -184,13 +192,13 @@ def idl(infile,start,end,item,asset,num,cmin,cmax,outfile,ovp):
headers=headers, data=data, params=querystring,
auth=(PL_API_KEY, ''))
page=result.json()
final_list = handle_page(page,asset,num,outfile,gmain,ovp)
final_list = handle_page(page,item,asset,num,outfile,gmain,ovp)
try:
while page['_links'].get('_next') is not None:
page_url = page['_links'].get('_next')
r = SESSION.get(page_url)
page=r.json()
ids = handle_page(page,asset,num,outfile,gmain,ovp)
ids = handle_page(page,item,asset,num,outfile,gmain,ovp)
except SystemExit:
sys.exit()
except requests.exceptions.Timeout:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def readme():
return f.read()
setuptools.setup(
name='porder',
version='0.2.5',
version='0.2.6',
packages=['porder'],
url='https://github.com/samapriya/porder',
package_data={'': ['bundles.json']},
Expand Down

0 comments on commit 313b4fd

Please sign in to comment.