Select to view content in your preferred language

Why are my layers not being displayed?

2019
14
Jump to solution
11-08-2012 05:25 AM
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
14 Replies
GeorgeFaraj
Frequent Contributor
I have not resolved this issue. Can someone please help?
0 Kudos
haowoo
by
Emerging Contributor
Adding spatialrefrence to the mapcontrol may solve the problem, try this:
           
 
           ArcGISLocalFeatureLayer pLocalFeatureLayer = new ArcGISLocalFeatureLayer(mapname2, 0);
            Envelope env = new Envelope(-180, -90, 180, 90);
            //4326 refers to WGS84
            SpatialReference sp = new SpatialReference(4326);
            env.SpatialReference = sp;

            mapControl.Layers.Add(pLocalFeatureLayer);
            mapControl.Extent = env;


the ids of spatialrefrence can be found here:
Geographic Coordinate Systems :http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/gcs.html
Projected Coordinate Systems : http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/pcs.html

hope that would help you.
0 Kudos
GeorgeFaraj
Frequent Contributor
Nope, that didn't work. How come I could load this map with no problems using the ArcObjects SDK, and with the Runtime SDK I can't reasonably load a feature map that has more than 20000 records? Am I doing it correctly?
0 Kudos
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.
0 Kudos
GeorgeFaraj
Frequent Contributor

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.


OK, I think this is what I'm looking for. I tested the OnDemand option and it does allow me to view all features when I'm at a large scale. I would like the map to be visible at small scales too though, so can you provide sample code that does what you described?

Thank you.
0 Kudos