Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to insert sites table properly #55

Open
im-prakher opened this issue Jul 17, 2020 · 2 comments
Open

Not able to insert sites table properly #55

im-prakher opened this issue Jul 17, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@im-prakher
Copy link
Contributor

Actually, when I was inserting sites table using the client route,

curl -F "fileName=@input_files/sites.csv" \
-F "shp_file=@input_files/S8_two_row_polys.shp" \
-F "dbf_file=@input_files/S8_two_row_polys.dbf" \
-F "prj_file=@input_files/S8_two_row_polys.prj" \
-F "shx_file=@input_files/S8_two_row_polys.shx" \
http://localhost:6001/sites

the app returned the response 410 and logged this error,

ERROR:root:Traceback (most recent call last):
yaba_api_1 | File "fiona/_shim.pyx", line 74, in fiona._shim.gdal_open_vector
yaba_api_1 | File "fiona/_err.pyx", line 270, in fiona._err.exc_wrap_pointer
yaba_api_1 | fiona._err.CPLE_OpenFailedError: '/code/temp/shp_file' not recognized as a supported file format.
yaba_api_1 |
yaba_api_1 | During handling of the above exception, another exception occurred:
yaba_api_1 |
yaba_api_1 | Traceback (most recent call last):
yaba_api_1 | File "/code/Meta.py", line 132, in insert_sites
yaba_api_1 | data_g1=gpd.read_file(shp_file_target)
yaba_api_1 | File "/usr/local/lib/python3.7/site-packages/geopandas/io/file.py", line 77, in read_file
yaba_api_1 | with reader(path_or_bytes, **kwargs) as features:
yaba_api_1 | File "/usr/local/lib/python3.7/site-packages/fiona/env.py", line 398, in wrapper
yaba_api_1 | return f(*args, **kwargs)
yaba_api_1 | File "/usr/local/lib/python3.7/site-packages/fiona/__init__.py", line 254, in open
yaba_api_1 | layer=layer, enabled_drivers=enabled_drivers, **kwargs)
yaba_api_1 | File "/usr/local/lib/python3.7/site-packages/fiona/collection.py", line 154, in __init__
yaba_api_1 | self.session.start(self, **kwargs)
yaba_api_1 | File "fiona/ogrext.pyx", line 484, in fiona.ogrext.Session.start
yaba_api_1 | File "fiona/_shim.pyx", line 81, in fiona._shim.gdal_open_vector
yaba_api_1 | fiona.errors.DriverError: '/code/temp/shp_file' not recognized as a supported file format.

But when I use the yaba_api route for inserting sites table,

curl -F "fileName=@input_files/sites.csv" \
-F "shp_file=@input_files/S8_two_row_polys.shp" \
-F "dbf_file=@input_files/S8_two_row_polys.dbf" \
-F "prj_file=@input_files/S8_two_row_polys.prj" \
-F "shx_file=@input_files/S8_two_row_polys.shx" \
http://localhost:5001/yaba/v1/sites

it succeeded in doing so. Also, when I am making a request using the browser, both routes log the same error. Don't know what is causing this.

@Chris-Schnaufer @saurabh1969 @dlebauer @KristinaRiemer

@saurabh1969
Copy link
Contributor

@im-prakher Firstly,the above api call are POST.And when you request through browser,it is always GET call.And,whenever you are using client api route( http://localhost:6001/sites) ,make sure your server is running properly.

And for above error,it seems like it is file path issue.Please check this link : Toblerity/Fiona#742.
It will surely help.

@im-prakher
Copy link
Contributor Author

Making requests using cuRL or browser doesn't make any difference on the request method part, and the request method here is POST for the route. Also, I am making POST requests to the other routes and that's working fine.

@app.route('/sites',methods = ['POST'])
def sites():
if request.method == 'POST':
response=postRequest_with_shpFile(request,'sites')
return Response(response.text,mimetype="application/json")

Will look into this Toblerity/Fiona/issues/742.
Thanks!

@dlebauer dlebauer added the bug Something isn't working label Jul 29, 2020
@im-prakher im-prakher assigned im-prakher and unassigned im-prakher Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants