Error: "Invalid argument : wkt.size() == 0" when open shapefile

3133
1
11-10-2015 08:32 AM
Jean-ChristopheBertolini
New Contributor III

The code that raises the exception:

   private async Task LoadShapefile(string path)

 

   try

  FeatureOverlay.Visibility = Visibility.Collapsed;

 

   // open shapefile table

   var shapefile = await ShapefileTable.OpenAsync(path);

 

   // clear existing map and spatial reference

   if (Map1.Map.Layers.Any())

 

  Map1.Map = new Map();

  

   // create feature layer based on the shapefile

   var flayer = new FeatureLayer(shapefile)

 

   // Add the feature layer to the map

  txtInfo.Visibility = Visibility.Visible;

 

   catch (Exception ex)

 

   MessageBox.Show("Error creating feature layer: " + ex.Message, "Sample Error");

  txtInfo.Visibility = Visibility.Collapsed;

 

Any idea ?

0 Kudos
1 Reply
FreddieGibson
Regular Contributor II

Hi Jean,

This error appears to be related to the custom coordinate system. From looking at your projection it appears that you're using 2154 : RGF_1993_Lambert_93. In your shapefile you've renamed this coordinate system to RGF93_Lambert_93, which makes the system treat this as a custom coordinate system even though it appears that you've only only changed the name and none of the other values within the system's definition.

I've been able to replicate this issue using the developer sample for loading shapefiles, which I've included in the attachments. Is there a reason why you're needing to use the custom name for this system? Everything appears to work fine if I use the exact definition as shown in the documentation.

Projected Coordinate Systems

Projected coordinate systems—ArcGIS Runtime SDK for .NET | ArcGIS for Developers

PROJCS["RGF_1993_Lambert_93",GEOGCS["GCS_RGF_1993",DATUM["D_RGF_1993",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",700000.0],PARAMETER["False_Northing",6600000.0],PARAMETER["Central_Meridian",3.0],PARAMETER["Standard_Parallel_1",44.0],PARAMETER["Standard_Parallel_2",49.0],PARAMETER["Latitude_Of_Origin",46.5],UNIT["Meter",1.0]]

0 Kudos