Hi,
I have a problem of projection with shapefile after the committransaction when I deletefeature in a shapefile.
In fact i have the same problem as this one in this post.
thinkgeo.com/forums/MapSuite/tabid/143/aft/11634/Default.aspx
The dll of thinkgeo that I use is 7.0.0.245
I want to display a shapefile in the map control.
Sometimes shapefile have truncated polygon and so I test if all polygons are valid.
If not, I ask to the user if he wants to delete these features and if he says yes, I delete.
The code is
internal bool TesterValiditeShapeFileFeatureLayer(ShapeFileFeatureLayer shapeFileLayer, string nomShpFichier)
{
Dictionary<string, string> invalidFT = shapeFileLayer.Validate();
bool importOK = !invalidFT.Any();
var r = MessageBoxResult.Cancel;
if (!importOK)
{
r = InvivoMessageBox.Show(this, “”, string.Format(Properties.Resources.Corps_ImportShpErrorLstId, invalidFT.Count.ToString(), nomShpFichier.Split(’\’).Last()),
Properties.Resources.Entete_ShpImport, MessageBoxButton.YesNo, MessageBoxImage.Information);
}
if (r == MessageBoxResult.Yes)
{
shapeFileLayer.FeatureSource.BeginTransaction();
foreach (KeyValuePair<string, string> d in invalidFT)
{
shapeFileLayer.FeatureSource.DeleteFeature(d.Key);
}
shapeFileLayer.FeatureSource.CommitTransaction();
importOK = !shapeFileLayer.Validate().Any();
}
}
private void ajouterLayer( … )
{
if (TestValidAvtAction.TesterValiditeShapeFileFeatureLayer(shpFileLayer, nomShpFile))
{
LayerOverlay staticOverlay = MapVm.MapActif.Overlays[ConstantsMap.NOMOVERLAYSTATIC + “_KEY”] as LayerOverlay;
staticOverlay.Layers.Add(nomLayerShp, shpFileLayer);
if (!shpFileLayer.IsOpen) shpFileLayer.Open();
MapVm.MapActif.CurrentExtent = shpFileLayer.GetBoundingBox();
MapVm.MapActif.Refresh();
MapVm.LayersViewModel.MettreAJourListeLayers(shpFile, ModeActionShpFile.Ajout);
}
}
And there is a problem with the coordinates of the polygons
Before the committransaction (ie. …ProjectionBeforeCommitTransaction_20140516.jpg)
After the committransaction (ie …ProjectionAfterCommitTransaction_20140516.jpg)
I also tested the proposed solution in the post
thinkgeo.com/forums/MapSuite/tabid/143/aft/11634/Default.aspx
and the coordinates of the polygons are also false ;-(
For info, the projection of the shapefile is Lambert93 (french projection).
Thanks for your help.
Regards.
Steph.
ProjectionBeforeCommitTransaction_20140516.jpg (39.6 KB)
ProjectionAfterCommitTransaction_20140516.jpg (40.8 KB)
Error projection shapefile after commitransaction
Hi Steph,
I have verified the thread 11634 issue and it have been fixed with their data since map suite 7.0 version. I also tested the version 7.0.0.245 and the latest development version 7.0.338.0, both of them also work fine.
Would you please try the 7.0.338.0 and have a try? also does you try the solution answered by Don in thread 11634?
If the issue persists, could you please provide us a contain-self sample to recreate the issue, as soon as we create it, I think it should be easy to fix it.
If the data/sample is too large, please follow this guide to setup FTP account.
Thanks,
Troy
Hi Troy,
It turns out that this shp file was defective. Even with other mapping software, opening the file was not possible.
Thanks.
Regards.
Steph.
Steph,
Ok, good to hear you figure it out.
Any other question, please feel free to let us know.
Thanks,
Troy