moovida / dart_shp

Dart shapefile reader/writer
BSD 3-Clause "New" or "Revised" License
7 stars 7 forks source link

web support for file import #2

Closed raphael-bmec-co closed 6 months ago

raphael-bmec-co commented 2 years ago

The library used io.File however only http.File is permitted on web. It would be great to provide a mechanism/workaround. I have been unable to come up with one.

moovida commented 2 years ago

Hi @raphael-bmec-co , I am not sure how a shapefile could be loaded into a browser. What is your usecase? What could be a workaround?

This lib was not written/ported thinking that web could be a possible platform.

raphael-bmec-co commented 2 years ago

Hi @moovida thanks for getting back to me.

Our use case is a web app for an agritech application. We load data, in ShapeFile format from 3rd party vendors into our platform for further processing.

We currently have an angularJS platform that we are porting to flutter. This is the library we are currently using.

I have spent quite some time looking for a workaround. However, the html.File only allows files to be read as string or data and cannot return a system path. I can't seem to find a way to use your available APIs to process the shapefile from the raw data. One possible work around - required package changes - would be to expose APIs that could parse the files from the raw data instead of the io.File object (maybe these are already exposed and I can't find them?).

Anyway, I have to hard expectation of you doing this work, I just haven't found an alternative that supports web so it would be nice not to have to start from scratch.

Thanks!

moovida commented 2 years ago

Hi @raphael-bmec-co , I see the point. So shps are uploaded and then need to be converted to some internal format.

Well yes, you would then need to change the various readers substantially (shp, shx, dbf). They currently work with file channels, while you will need them to work with buffers (guess LByteBuffer, which at some point are used).

raphael-bmec-co commented 2 years ago

Okay thanks @moovida. We will look into making a fork if it comes to that.