Comments (7)
@rbavery it might be an intermittent issue because I was able to run it using your idlist and geojson you provided. I would suggest you retry using the same tool
porder order --name "rtest" --idlist "C:\Users\samapriya\Downloads\test_tile_eighth.txt" --item "PSScene4Band" --asset "analytic" --boundary "C:\Users\samapriya\Downloads\ryan.geojson" --op clip
Order created at https://api.planet.com/compute/ops/orders/v2/01fb6868-12b8-467b-9c58-c76905aed67b and url copied to clipboard
from porder.
I've tried that function call multiple times over the past few days and I keep getting the same error, so I think something else is going on. I found the portion of the code in order_now.py that is failing, this try block
for key,value in kwargs.items():
if key=='boundary' and value!=None:
for items in k['tools']:
if items.get('clip'):
try:
if value.endswith('.geojson'):
with open(value) as aoi:
aoi_resp = json.load(aoi)
items['clip']['aoi']['coordinates']= aoi_resp['features'][0]['geometry']['coordinates']
elif value.endswith('.json'):
with open (value) as aoi:
aoi_resp=json.load(aoi)
items['clip']['aoi']['coordinates']=aoi_resp['config'][0]['config']['coordinates']
elif value.endswith('.kml'):
getcoord=kml2coord(value)
items['clip']['aoi']['coordinates']=getcoord
except Exception as e:
print('Could not parse geometry')
So I tried to replicate the try block in my porder env... and I can read in the geojson just fine.
>>> import json
>>> json.load(open("test_tile_eighth.geojson"))
{u'type': u'FeatureCollection', u'name': u'test_tile_eighth', u'features': [{u'geometry': {u'type': u'Polygon', u'coordinates': [[[-0.831053947078279, 5.72196597574407], [-0.831, 5.71], [-0.815323594266615, 5.709838158765161], [-0.815377541344895, 5.721804134509231], [-0.831053947078279, 5.72196597574407]]]}, u'type': u'Feature', u'properties': {u'id': 0}}]}
>>> aoi_resp = json.load(open("test_tile_eighth.geojson"))
>>> aoi_resp['features']
[{u'geometry': {u'type': u'Polygon', u'coordinates': [[[-0.831053947078279, 5.72196597574407], [-0.831, 5.71], [-0.815323594266615, 5.709838158765161], [-0.815377541344895, 5.721804134509231], [-0.831053947078279, 5.72196597574407]]]}, u'type': u'Feature', u'properties': {u'id': 0}}]
>>> aoi_resp['features'][0]
{u'geometry': {u'type': u'Polygon', u'coordinates': [[[-0.831053947078279, 5.72196597574407], [-0.831, 5.71], [-0.815323594266615, 5.709838158765161], [-0.815377541344895, 5.721804134509231], [-0.831053947078279, 5.72196597574407]]]}, u'type': u'Feature', u'properties': {u'id': 0}}
>>> aoi_resp['features'][0]['geometry']
{u'type': u'Polygon', u'coordinates': [[[-0.831053947078279, 5.72196597574407], [-0.831, 5.71], [-0.815323594266615, 5.709838158765161], [-0.815377541344895, 5.721804134509231], [-0.831053947078279, 5.72196597574407]]]}
>>> aoi_resp['features'][0]['geometry']['coordinates']
[[[-0.831053947078279, 5.72196597574407], [-0.831, 5.71], [-0.815323594266615, 5.709838158765161], [-0.815377541344895, 5.721804134509231], [-0.831053947078279, 5.72196597574407]]]
my hunch is that this is failing because the value that is associated with key boundary
is not a string that ends with '.geojson' on my linux system, but something else. thus it would fail on value.endswith('.geojson')
. But I'm not at all sure, that's just the only thing I can think of since my porder env can parse the geometry correctly I don't know where or how else it would fail on the try block.
I'm still digging into it trying to debug, but can't seem to get my debugger in vscode to work on the file. I keep seeing an error in the call stack that says Source code string cannot contain null bytes
Have you seen this type of error before and any suggestions?
from porder.
Seems to be resolvable by changing the line here.
Loading from a string works: aoi_resp = json.loads(aoi.read())
from porder.
Thanks @bosth and @samapriya , changing that line fixed the issue
from porder.
Just a heads up this was also a problem for a colleague still, should the suggestion from @bosth be incorporated into porder?
from porder.
Hi @rbavery made the change suggested by @bosth and updated it in the new version. Was traveling hence the delay in getting this fixed :)
from porder.
Note: if users still get the error after seeing aoi_resp = json.loads(aoi.read())
has been fixed, make sure to pip install --upgrade porder
.
from porder.
Related Issues (20)
- Missing import progressbar in async_down.py HOT 1
- can't seem to get gcs delievery working HOT 1
- can't seem to switch subscriptions HOT 1
- AOI clip error HOT 1
- Missing files after download HOT 2
- idlist command not completeing, no error message HOT 5
- order download link HOT 1
- zipped cloud delivery KeyError HOT 2
- AttributeError: 'Namespace' object has no attribute 'func' for python 3.6 or greater HOT 5
- init deprecation warnings for each scene that is searched with porder search HOT 2
- support n string or range filters HOT 2
- UDM2 mask download HOT 1
- bad request, no acceptable assets even though asset set to "visual" or "analytic" HOT 4
- unexpected behavior of porder idlist - returning empty file HOT 4
- Suggestion: filter by acquisition time HOT 3
- When downloading an order, manifest.json sometime overwrites contents of another file HOT 7
- accessing analytic_8b_sr_udm2
- Error converting to geojson from shapefile
- Issues with MultiPolygon AOI and Order Command
- Support for PSScene
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from porder.