Select to view content in your preferred language

Heisenbug importing Shapefiles

4811
12
Jump to solution
04-28-2014 06:20 AM
Labels (1)
Cristian_Galindo
Frequent Contributor
DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far???

I checked the example that is posted in [HTML]http://www.arcgis.com/home/item.html?id=953a530ada30477d95cc69e788268bc9[/HTML] and successfully tried to reproduce it in a new application, it works smothly. Then I proceed to implement it in a robust application that use MVVM pattern under PRIMS framework, I copied and pasted the code in the applicaction, but when the code tries to get the details from the feature layer to create the renderer, it fails...it comes with an exception

                             arcGisLocalDynamicMapServiceLayer.GetDetails(dynamicLayerInfo.ID, (featureLayerInfo, exception) =>                                                         {                                 switch (featureLayerInfo.GeometryType)                                 {                                     case ESRI.ArcGIS.Client.Tasks.GeometryType.Envelope:                                         layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleFillSymbol() { Fill = new SolidColorBrush(GetRandomColor()), BorderBrush = new SolidColorBrush(GetRandomColor()) } };                                         break;                                     case ESRI.ArcGIS.Client.Tasks.GeometryType.MultiPoint:                                         layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleMarkerSymbol() { Color = new SolidColorBrush(GetRandomColor()), Size = 8 } };                                         break;                                     case ESRI.ArcGIS.Client.Tasks.GeometryType.Point:                                         layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleMarkerSymbol() { Color = new SolidColorBrush(GetRandomColor()), Size = 8 } };                                         break;                                     case ESRI.ArcGIS.Client.Tasks.GeometryType.Polygon:                                         layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleFillSymbol() { Fill = new SolidColorBrush(GetRandomColor()), BorderBrush = new SolidColorBrush(GetRandomColor()) } };                                         break;                                     case ESRI.ArcGIS.Client.Tasks.GeometryType.Polyline:                                         layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleLineSymbol() { Color = new SolidColorBrush(GetRandomColor()) } };                                         break;                                     default:                                         break;                                 }                                 // Set the LayerDrawingOptions property on the local dynamic map service layer (the LayerID property ties this to the DynamicLayerInfo object).                                 layerDrawingOptionsCollection.Add(layerDrawOpt);                                  // Refresh the dynamic map service layer to render the result of the datasource/layer change.                                 arcGisLocalDynamicMapServiceLayer.Refresh();                             });


The object featureLayerInfo is null, I check the local ArcGIS server, and it is present with the map service, and the exception states : "Unable to find the specified 'dataSourceName' in 'dataSource' for dynamic dataLayer with 'id': 0."


I dont know what to check for, I have been debugging side-by-side the code of both applications, and one of them works but the other one fails (I use two different shapefiles in the process, and I have change between them in the apps with the same result).
0 Kudos
1 Solution

Accepted Solutions
Cristian_Galindo
Frequent Contributor
well....finally I solved the issue.

this is quite tricky:

App A: Works Fine

References to the dll in the program files folder.


App B: do not work

references to a third party references folder in TFS. build drop folder contains a Deploy folder created with the ArcGIS Runtime WPF Deployment Builder 10.2.2


Something that is not mentioned neither in the documentation of the example or in the documentation of the classes involved in the creation of a Dynamic layer is that you must select some items for a correct deployment.
My application was run from a folder with a deployment folder inside, so it instantiate a local server using the dll's and configuration specified for it (that was the reason i did'nt get any log file).

I was reading something for deployment task when I found what i was missing, so i rebuild a deployment folder including the Vector additional data format, also the logging feature.
the problem was solved.

Funny fact:
after replacing the folder the issue descriped here http://forums.arcgis.com/threads/109301-Legend-item-template-brings-a-huge-image....Why was fixed!!!! Why, How, i do not know.


Thanks a lot for your replies

P.S.

It is necessary an improvement in the documentation, really.

View solution in original post

0 Kudos
12 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

Please can you confirm the product and version you are using? (e.g. ArcGIS Runtime SDK for WPF 10.2.2)

Also - if you can attach your application to the thread that would greatly help the forum folk support you.

Cheers

Mike
0 Kudos
Cristian_Galindo
Frequent Contributor
Hi,

Please can you confirm the product and version you are using? (e.g. ArcGIS Runtime SDK for WPF 10.2.2)

Also - if you can attach your application to the thread that would greatly help the forum folk support you.

Cheers

Mike


Hello Mike,

currently i am using ArcGIS Runtime SDK for WPF 10.2.2, post the whole application is not possible, but I would like to have some hints to take into account in this process, I'm not going to lie, i use the method AddFileDatasetToDynamicMapServiceLayer that is implemented in the sample that is included with SDK (Add shapefiles and rasters).
0 Kudos
Cristian_Galindo
Frequent Contributor
My app uses a MVVM and it does not work, i'm pulling out my hair of my head...i don't know what to do.
0 Kudos
AnttiKajanus1
Deactivated User
It would help if you can create small repro (just isolate the issue with bootstrapped app) and send that to us, so we could investigate what might be the issue.

Have you used Fiddler or other similar app to see what traffic is happening when in that point? If you can, you could try to see that and then post it here so we have better view on the traffic?

You also could try to use QueryTask to validate that data is coming correctly from the service that is created.

Can you also check that there call to GetDetails is executed when it is available and before initialization is done?
0 Kudos
Cristian_Galindo
Frequent Contributor
Hi, I'm struggling with fiddler (thanks, I'm learning a new tool) to capture the trafic generated by the server.

so far when i try to isolate the issue in a new application it works :(.

I was thinking that maybe it will be some kind of incompatibility between the Geometry service and the feature service, due i use the geometry service in the application, in that ideas order, i remove the geometry service, but still I get the issue.

I already check the order of calling the GetDetails, and it is called when the arcGisLocalDynamicMapServiceLayer is inittialized..I mean after initialization (Likewise in the example packed with the runtime).

Checking the fiddler captures, here is the one when the sample application works :

{"currentVersion":10.21,"name":"18BANSAM","type":"Feature Layer","description":"","geometryType":"esriGeometryPoint","copyrightText":"","subLayers":[],"minScale":0,"maxScale":0,"defaultVisibility":true,"extent":{"xmin":-72.225719444444451,"ymin":6.9261805555555558,"xmax":-71.813094444444445,"ymax":7.0953861111111109,"spatialReference":{"wkid":4326,"latestWkid":4326}},"hasAttachments":false,"htmlPopupType":"esriServerHTMLPopupTypeNone","displayField":"X","typeIdField":null,"fields":[{"name":"FID","type":"esriFieldTypeOID","alias":"FID","domain":null},{"name":"Shape","type":"esriFieldTypeGeometry","alias":"Shape","domain":null},{"name":"X","type":"esriFieldTypeDouble","alias":"X","domain":null},{"name":"Y","type":"esriFieldTypeDouble","alias":"Y","domain":null},{"name":"Z","type":"esriFieldTypeDouble","alias":"Z","domain":null}],"relationships":[],"canModifyLayer":true,"canScaleSymbols":false,"hasLabels":false,"capabilities":"Map,Query,Data","maxRecordCount":1000,"supportsStatistics":false,"supportsAdvancedQueries":false,"hasZ":true,"hasM":true,"supportedQueryFormats":"JSON, AMF","ownershipBasedAccessControlForFeatures":{"allowOthersToQuery":true},"useStandardizedQueries":true,"id":0}



But when my real application is running, this is what i got:

{"error":{"code":400,"message":"Unable to find the specified 'dataSourceName' in 'dataSource' for dynamic dataLayer with 'id': 0.","details":[]}}


I already enable the HTTP Debugging of .NET client applications

Furthermore, I also summon several acient spirits and order a brand new ouija board from amazon, but it wont arrive until next week...so...i will try anything meanwhile.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

I think the clue is in the error message which indicates the workspace and/or dataset name within the workspace are incorrect:

{"error":{"code":400,"message":"Unable to find the specified 'dataSourceName' in 'dataSource' for dynamic dataLayer with 'id': 0.","details":[]}}


What is the URL request which generated this response?

Cheers

Mike
0 Kudos
Cristian_Galindo
Frequent Contributor
Hi, thanks for your answer, the funny thing is that both applications are using the same shapefile (not at the same time)

Here is the query string that works:

http://localhost.:50001/arcgis/rest/services/emptympk_wgs84/MapServer/dynamicLayer?f=json&layer=%7b%22id%22%3a0%2c%22source%22%3a%7b%22type%22%3a%22dataLayer%22%2c%22dataSource%22%3a%7b%22type%22%3a%22table%22%2c%22workspaceId%22%3a%22b1125da0-abba-4ea5-af43-c89369524b3f%22%2c%22dataSourceName%22%3a%2218BANSAM%22%7d%7d%7d HTTP/1.1





Here is the one that gives the ERROR:


http://localhost.:50000/arcgis/rest/services/emptympk_wgs84/MapServer/dynamicLayer?f=json&layer=%7b%22id%22%3a0%2c%22source%22%3a%7b%22type%22%3a%22dataLayer%22%2c%22dataSource%22%3a%7b%22type%22%3a%22table%22%2c%22workspaceId%22%3a%22d49fab1c-b4a8-43dc-9f0b-57aa9ee2f053%22%2c%22dataSourceName%22%3a%2218BANSAM%22%7d%7d%7d HTTP/1.1 



i just spoted that the only diference is the GUID used to identify the workspace.
0 Kudos
Cristian_Galindo
Frequent Contributor
Weird behavior......the local service is not creating the log, despite the fact that enable logging option was selected 😞
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

So here are your two examples:

http://localhost.:50001/arcgis/rest/services/emptympk_wgs84/MapServer/dynamicLayer?f=json&layer={"id":0,"source":{"type":"dataLayer","dataSource":{"type":"table","workspaceId":"b1125da0-abba-4ea5-af43-c89369524b3f","dataSourceName":"18BANSAM"}}} HTTP/1.1


http://localhost.:50000/arcgis/rest/services/emptympk_wgs84/MapServer/dynamicLayer?f=json&layer={"id":0,"source":{"type":"dataLayer","dataSource":{"type":"table","workspaceId":"d49fab1c-b4a8-43dc-9f0b-57aa9ee2f053","dataSourceName":"18BANSAM"}}} HTTP/1.1


And one from me running the Sample App just now:

http://localhost.:50000/arcgis/rest/services/emptympk_wgs84/MapServer/dynamicLayer?f=json&layer={"id":0,"source":{"type":"dataLayer","dataSource":{"type":"table","workspaceId":"6c4696a4-fb40-41b9-9a3b-76639a2cb5c6","dataSourceName":"Points"}}}


Your request which causes the error (your 2nd example) appears to be ok. We wondered whether the MVVM framework you are using has possibly introduced a threading / context issue for the layer (and the exception is being swallowed somewhere in the framework?). Note layers can only be access on the UI thread.

Cheers

Mike
0 Kudos