Select to view content in your preferred language

Why are my layers not being displayed?

1564
14
Jump to solution
11-08-2012 05:25 AM
Labels (1)
GeorgeFaraj
Frequent Contributor
I'm adding feature layers to my map at runtime, but they're not showing up. They show up correctly in the Legend control, but they're not visible in the map. What am I doing wrong here?

LocalFeatureService.GetServiceAsync(@"\\dtdev7240w7\Terminated\GIS Data\clark gis\clark2layers.mpk", featureService =>  {   foreach (var layerDetails in featureService.MapLayers)   {    var featureLayer = new ArcGISLocalFeatureLayer(featureService, layerDetails.Name);    featureLayer.ID = layerDetails.Name;    MyMap.Layers.Add(featureLayer);   }  } );
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
There is a limitation in the number of features that can be returned by a query.
This maximum number  can be set at the server side but will still be there if you have a huge number of features to load.

Anyway as you noticed, after loading a huge number of features, you may run into performance issues.

One possible approach is to set 2 layers with disjoint resolution scales: one dynamic layer at small scale in order to be able to see all features as image, and one feature layer at large scale in order to load the features only at these scales.
In this case you have to set the Mode of the feature layer to 'OnDemand' in order to reexecute a query after each extent change.

View solution in original post

0 Kudos
14 Replies
KerrieScholefield
Deactivated User
Hi,

The code you gave to add the ArcGISLocalFeatureLayer should work without any issues. I suspect there is an issue with the .mpk or network. Can you see the expected layers and the access UrlFeatureService if you debug the featureservice?

Cheers,

Kerrie
0 Kudos
GeorgeFaraj
Frequent Contributor

Can you see the expected layers and the access UrlFeatureService if you debug the featureservice?



Hi Kerrie, can you be more specific about the above?

The following displays the layers that are in the package correctly, but I need them as feature layers since I want to be able to select features and things like that.

LocalMapService localMapService = new LocalMapService()
{
 Path = @"\\dtdev7240w7\Terminated\GIS Data\clark gis\clark2layers.mpk",
 EnableDynamicLayers = true,
};
localMapService.StartAsync(localService =>
{
 if (localService.Error != null)
  return;
 var layer = new ArcGISLocalDynamicMapServiceLayer(localMapService);
 layer.EnableDynamicLayers = true;
 MyMap.Layers.Add(layer);
});
0 Kudos
KerrieScholefield
Deactivated User
Hi Kerrie, can you be more specific about the above?


Hi,

Both code examples you have posted should work. It is worth checking the Error property to confirm that the local feature service is starting correctly. Insert a breakpoint after the local feature service is started. Once the breakpoint is hit - check the Error property to confirm there was no problem encountered starting the service. Then get the UrlFeatureService property and paste it into a browser (while the app is still in debug mode and the local server is still running). This will display the HTML view of the service and will tell you what layers are available.

Cheers,

Kerrie
0 Kudos
GeorgeFaraj
Frequent Contributor
The Error property is null and the UrlFeatureService contains:

http://127.0.0.1:50001/b1HFRp/arcgis/rest/services/clark2layers-label/FeatureServer

This opens up a page that displays:

clark2layers-label (FeatureServer)

Description: 

Layers:
majorrds (0)
parcels (1)
Supported Operations:   Query   Apply Edits 


Clicking on parcels shows:

Feature Layer: parcels (1)

Supported Operations: Query
Display Field: AREA
Type: Feature Layer
Geometry Type: esriGeometryPolygon
Description: 
Copyright Text: 
Min. Scale: 0
Max. Scale: 0
Extent:
XMin: 1052541.625
YMin: 77508.4375
XMax: 1197424.875
YMax: 273556.5
Spatial Reference: 102749
Drawing Info: 
Renderer:
Simple Renderer:
Label: 
Description: 
Symbol:
Simple Fill Symbol.
Transparency: 0
Labeling Info: [object Object]
Has Attachments: false
HTML Popup Type: esriServerHTMLPopupTypeAsHTMLText
Object ID Field: FID
Global ID Field: 
Type ID Field: 
Fields: 
FID (Type: esriFieldTypeOID, Alias: FID, Editable: false)
AREA (Type: esriFieldTypeSingle, Alias: AREA, Editable: true)
PERIMETER (Type: esriFieldTypeSingle, Alias: PERIMETER, Editable: true)
PARCELS_ (Type: esriFieldTypeDouble, Alias: PARCELS_, Editable: true)
PARCELS_ID (Type: esriFieldTypeDouble, Alias: PARCELS_ID, Editable: true)
PROP_ID (Type: esriFieldTypeDouble, Alias: PROP_ID, Editable: true)
PARCELS_C (Type: esriFieldTypeInteger, Alias: PARCELS_C, Editable: true)
CREATEDATE (Type: esriFieldTypeDate, Alias: CREATEDATE, Editable: true, Length: 8)
MODDATE (Type: esriFieldTypeDate, Alias: MODDATE, Editable: true, Length: 8)
Types: 


I should mention that the layers show up in the Legend with their correct Symbol legend items, but I don't see anything in the map, even when I click "Full Extent" in the navigation control.
0 Kudos
KerrieScholefield
Deactivated User
Hi,

The local feature service is starting without issues. Do you have the spatial reference set on the Map? If not, you could try setting the spatial reference and extent of the Map using similar to the .XAML code below:

   <esri:Map x:Name="MyMap" >
            <esri:Map.Extent>
                <esri:Envelope XMin="661140" YMin="-1420246" XMax="3015668" YMax="1594451" >
                    <esri:Envelope.SpatialReference>
                        <esri:SpatialReference WKID="enter WKID"/>
                    </esri:Envelope.SpatialReference>
                </esri:Envelope>
            </esri:Map.Extent>

You could also try adding an online ArcGISTiledMapServiceLayer and see if this helps you find the layer.

    <esri:ArcGISTiledMapServiceLayer ID="MyLayer"
                Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />


What version of the ArcGIS Runtime SDK for WPF are you using?

Cheers,

Kerrie
0 Kudos
GeorgeFaraj
Frequent Contributor
I'm using version 1.0 129851 (the installer's name is ArcGIS_Runtime_SDK_for_WPF_10_129851.exe). The ESRI.ArcGIS.Client assembly has a Runtime version of v4.0.30319 and Version of 3.0.0.396.

What should I use as a WKID value in the sample you provided?
0 Kudos
KerrieScholefield
Deactivated User
Hi,


What should I use as a WKID value in the sample you provided?

No,  this was just an example of using the Map.Extent property. You will need to specify your own extent and WKID depending on the spatial reference of your data.

Cheers,

Kerrie
0 Kudos
GeorgeFaraj
Frequent Contributor
I've tried this with no success. Apparently, if I set the MaxRecords of the service to a higher number, a small part of the map gets displayed and navigation is extremely slow. This looks like a performance issue.

I can use an ArcGISLocalDynamicMapServiceLayer like I mentioned before, and the layers get displayed correctly and navigation is not that bad, but then I don't have the feature functionality that I need. I need to be able to select features, do symbology and labeling on them, as well as perform local spatial operations.

What do you recommend?
0 Kudos
AnttiKajanus1
Deactivated User
Generally I considered best practice to show operational data as a image (dynamic rendering) when you have a a lot of stuff visible from the feature / dynamic service. But this off course depends on the case.

One thing to remember when using Accelerated grapchis is that the rendering engine cannot draw symbols with custom DataTemplate so check if you have renderer / symbol that is supported by the engine. If you use symbol that is not supported the symbol is not drawn into the layers.

</caje>
0 Kudos