Extract shapefile from web map???

2745
8
10-15-2019 08:33 AM
TomLewis
New Contributor II

This task is going to be the death me. I know just enough about ESRI and GIS to be dangerous.

I feel like my task should be simple, but I just can't figure it out after searching forums and trying different methods for weeks. All I want to do is click a button on the map and export the current viewable extent to the user in the form of a shapefile. I've tried several built-in processes with absolutely no luck. I cross one hurdle only to fall face first into the next one.

I'm currently focused on ExtractData but am running into a login prompt because the creation of the ExtractData object is trying to access arcgis/rest/info?f=json on my server and it doesn't have access to that. I'm so frustrated. This may not even be the best way to do what I'm attempting.

Can anybody tell me, or point me to sample code (which I'm having no luck finding,) how to export spatial data from a web map?

Thanks in advance!!!

0 Kudos
8 Replies
RobertBorchert
Frequent Contributor III

You cannot do such a thing unless the owner of the data has set up permissions to do so

0 Kudos
TomLewis
New Contributor II

I am the owner of the data.

0 Kudos
Noah-Sager
Esri Regular Contributor

Have you seen some of the samples posted in this thread?

https://community.esri.com/thread/176528 

They might provide some guidance or inspiration.

0 Kudos
TomLewis
New Contributor II

I have gone through all of them. I'm just not understanding all of the pieces I guess.

I thought the JavaScript ExtractData class was going to give me what I need, but for some reason, the construction of the ExtractData object is making a call to the root of my rest service (arcgis/rest/info?f=json) and it's bringing up a logon prompt. I can't have a logon prompt coming up.

0 Kudos
Noah-Sager
Esri Regular Contributor
0 Kudos
TomLewis
New Contributor II

I do use a proxy. This is what my 2 URL's look like from the browser (development, hence the http):

For the ExtractData:

http://localhost/proxy.ashx?http://xxx.xxx/arcgis/rest/services/TDMS/MapExport/GPServer?f=json

Then for some reason, called during creation of ExtractData object which causes the login prompt:

http://localhost/proxy.ashx?http://xxx.xxx/arcgis/rest/info?f=json

Strange thing is that both URLs passed through the proxy return without login and with no problems.

Edit: I mean when I access the URLs directly without the proxy in a browser, there is no login.

0 Kudos
AndreaBoero
New Contributor

Are you still trying to work on this? 

0 Kudos
TomLewis
New Contributor II

No. I gave up since ESRI made it next to impossible to implement something so simple. I now create my own shapefiles by reading the features from the REST service and that is much easier. It's also super easy when I'm dealing with my dynamic graphics layers that aren't coming from the server.

0 Kudos