CoastalResilienceNetwork / GeositeFramework

Mapping Framework powering TNC Coastal Resilience programs
http://maps.coastalresilience.org/network/
GNU General Public License v3.0
13 stars 10 forks source link

Upload Shapefile to CR Site #996

Open matts5517 opened 6 years ago

matts5517 commented 6 years ago

image

zferdana commented 6 years ago

Hey Casey C - can you respond to Matt on this one. He tagged this as a priority bug fix, but really this is a question of an enhancement. Thanks!

caseycesari commented 6 years ago

Hi @matts5517,

I took a look at the sandbox you linked to, and, as far as I know, we haven't ever implemented this feature in the framework. It's possible that a plugin has implemented it, though.

I think this would be a somewhat significant undertaking at this point in our current contract. We would need to come up with a workflow and do some UI prototyping if this is something we wanted to support in the core framework.

However, it could be implemented in a plugin if a plugin author saw a need for it. Do you remember the problems you ran into when you were trying it out? Were you implementing it in a plugin or the framework?

matts5517 commented 6 years ago

Hey @caseycesari

At this point I would just need help implementing this into a plugin I am building for Wisconsin. It will be used in 3 different apps.

I was having trouble implementing the code in our framework, specifically on the request (lines 109 -125 in the sandbox) and it was a json error.

let me know what you think and if you can help me implement this into a plugin.

Thanks, Matt

caseycesari commented 6 years ago

Hey @matts5517. Is that plugin on Github somewhere? I can take a look at the code.

matts5517 commented 6 years ago

Hey Casey,

My attempt is here: https://github.com/FreshwaterNetwork/wetlands-watershed-explorer/blob/development/js/addShapefile.js

I never made it very far and I disconnected addShapefile.js from the main code for now.

let me know what you think.

caseycesari commented 6 years ago

Hi Matt,

I spent a good amount of time looking into this today, and I also couldn't get it to work within the framework. The main difference between using it in a plugin and using it in the sandbox appears to be the way that the parameters required by the ArcGIS.com API are serialized for use in the request.

This difference is first made apparent after you select a shapefile and before the request is fired off.

In the sandbox, the parameters get added to the form as hidden fields:

pasted image at 2017_11_20 02_11 pm

In the framework, they are added as a block of quoted text:

image

Then, in the actual you request, you can see that the form data is serialized differently in each instance.

In the sandbox:

image

In the framework:

image

I first started by modifying the plugin you linked to. I then started fresh and integrated the upload code into the framework sample plugin. I copied the form and code verbatim from the sandbox example. In both your plugin and the sample plugin, I run into the same issue.

I downloaded a copy of the sandbox and ran it locally. I was able to upload shapefiles successfully. I tried eliminating code in the example to see if I could reproduce the error, but I was unable to.

I also did some searches online, but I was unable to come up with anyone else that ran into this problem.

That's all I have to report for now. If something else comes to mind, I'll take another shot at this.

zferdana commented 6 years ago

Casey - thanks for exploring this. I would say let's prioritize bug issues for current contract enhancements, plus the new build for Azure, as this will likely take up our Support time. If we continue to have a solid use case for this function we can build it into a subsequent contract. Thanks.