CSIRO-Precision-Agriculture / PAT_QGIS_Plugin

PAT is a QGIS plugin containing a collection of tools for processing precision agriculture data.
Other
25 stars 8 forks source link

ValueError: No JSON object could be decoded #42

Closed cratcliff closed 4 years ago

cratcliff commented 4 years ago

The following error is occurring when using some of the tools.

Traceback (most recent call last):
File "C:/Users/XXID/.qgis2/python/plugins\pat\gui\stripTrialPoints_dialog.py", line 471, in accept
lines_desc = describe.VectorDescribe(line_shapefile)
File "C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\pyprecag\describe.py", line 55, in __init__
self.describeFile()
File "C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\pyprecag\describe.py", line 72, in describeFile
self.crs.getFromWKT(fio_coll.crs_wkt)
File "C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\pyprecag\crs.py", line 85, in getFromWKT
code = self.getEPSGFromSRS(source, bOnlineLookup=True, bUpdateToCorrectDefn=bUpdateByEPSG)
File "C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\pyprecag\crs.py", line 193, in getEPSGFromSRS
jres = json.loads(webres.read())
File "C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\json\__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\json\decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\json\decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
cratcliff commented 4 years ago

When a new shapefile is created in QGIS using Australian MGA coordinates the .prj file uses the ESRI style keywords like GDA94_MGA_zone_50. The .qpj file uses the standard "GDA94 / MGA zone 50" keyword.

For PAT to run correctly it needs to use "GDA94 / MGA zone 50" in the .prj file. To fix this, use the Define current projection tool from the Vector -> Data Management menu to overwrite the .prj file with the correct keyword.

bensmith213 commented 4 years ago

Thanks for putting this fix up Christina, has everything working perfectly again!