Select to view content in your preferred language

Layer is not shown in the TOC after load shapefile

2971
21
Jump to solution
12-13-2012 09:44 AM
LeonardoAraújo
Deactivated User
Hi all,

I'm trying to use the Load Shapefile widget (http://www.arcgis.com/home/item.html?id=bc6a88cf51364d9ea767347954363d7d) and am having a problem after loading a file. The features are loaded successfully but the TOC does not display the new layer. Could anyone help me on this?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Leonardo,

  The featureCollection needs a LayerDetails

var layerDetails:LayerDetails = new LayerDetails(); featureLayer.featureCollection = new FeatureCollection(featureSet, layerDetails);


I will be coming out with an enhanced Shapefile widget very soon that handles re-projecting the shapefile and adding each shapefile and labels as different layers in the TOC, as well as other features.

View solution in original post

0 Kudos
21 Replies
RobertScheitlin__GISP
MVP Emeritus
Leonardo,

  That is because the ShapeFile widget adds the shapefiles to a graphics layer and not a normal type that would show in the TOC.

Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow these steps as shown in the below graphic:

0 Kudos
LeonardoAraújo
Deactivated User
Leonardo,

  That is because the ShapeFile widget adds the shapefiles to a graphics layer and not a normal type that would show in the TOC.

Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow these steps as shown in the below graphic:



Dear Robert,

I've tried changing the GraphicsLayer to FeatureLayer according to the code below but had no success. The layer is displayed in the table but the features were not shown on the map. Am I doing something wrong?

while (shpReader.hasMore()) {
   array.push(new Graphic(...
}

var features:Array = [];
for each (var geometry:Geometry in GraphicUtil.getGeometries(array))
{
features.push({ geometry:geometry });
}

featureSet.spatialReference = map.spatialReference;
featureSet.features = features;
featureLayer.featureCollection = new FeatureCollection(featureSet);
featureLayer.id = layerName;
featureLayer.name = layerName;
map.addLayer(featureLayer, 1000);
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Leonardo,

  The featureCollection needs a LayerDetails

var layerDetails:LayerDetails = new LayerDetails(); featureLayer.featureCollection = new FeatureCollection(featureSet, layerDetails);


I will be coming out with an enhanced Shapefile widget very soon that handles re-projecting the shapefile and adding each shapefile and labels as different layers in the TOC, as well as other features.
0 Kudos
LeonardoAraújo
Deactivated User
Leonardo,

  The featureCollection needs a LayerDetails

var layerDetails:LayerDetails = new LayerDetails();
featureLayer.featureCollection = new FeatureCollection(featureSet, layerDetails);


I will be coming out with an enhanced Shapefile widget very soon that handles re-projecting the shapefile and adding each shapefile and labels as different layers in the TOC, as well as other features.


Thank you very much Robert! It worked perfectly. I'll be waiting for your new widget and certainly will use it in my application.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
0 Kudos
LeonardoAraújo
Deactivated User
Leonardo,

   Here is the link

http://www.arcgis.com/home/item.html?id=2e9096c5d5044d39a264df759611686f


Thank you Robert, I am trying to use your new widget but there must be some problem with my geoprocessing service. The reprojection task never ends and a empty alert window is shown. You could tell what can be?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Leonardo,

   Did you read the readme.txt where it said you need to use an ArcGIS Server 10 Geometry Service.
0 Kudos
LeonardoAraújo
Deactivated User
Leonardo,

   Did you read the readme.txt where it said you need to use an ArcGIS Server 10 Geometry Service.


Yes, I am using ArcGIS Server 10 SP4 geoprocessing service.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Leonardo,

   You are meaning to say Geometry Service right?... And you have you Flex Viewers main config.xml point to your Geometry Service?
0 Kudos