This project is read-only.

ProjectionException

Jul 1, 2011 at 9:33 AM

Hi,

I've got some problem when i want to load a shapeFile that I have saved before.

I have changed some attributes and save it. When i want to load it on my project it raise me this error:

ProjectionException The conic lat_1 value cannot be its -lat_2.

I have not idea what could be my error when I save it, i use the method FeatureSet.saveAs(string nameFile,bool overwrite)

Thx.

LordTj

Jul 8, 2011 at 8:19 AM

I try to resolve my problem, without success.

I put my code here and hope that somebody can help me.

My code to opening the ShapeFile:

            try
            {
                ////////////////////////////////////
                //Couche des tags///////////////////
                ////////////////////////////////////
                MapPointLayer coucheTag = (MapPointLayer)CarteTags.AddLayer(EmplacementTag);
                coucheTag.Projection = CarteTags.Projection;
             

                PointScheme couleursPoints = new PointScheme();
                couleursPoints.CreateCategories(coucheTag.DataSet.DataTable);
                couleursPoints.ClearCategories();
                couleursPoints.AddCategory(couleurD);
                couleursPoints.AddCategory(couleurN);
                couleursPoints.AddCategory(couleurNC);
                couleursPoints.AddCategory(couleurO);
                couleursPoints.AddCategory(couleurP);
                couleursPoints.AddCategory(couleurPB);
                coucheTag.Symbology = couleursPoints;

                coucheTag.LegendText = NomCoucheTag;
                coucheTag.SelectionEnabled = true;

                //coucheTag.SelectionSymbolizer = new PointSymbolizer(System.Drawing.Color.Red, DotSpatial.Symbology.PointShape.Ellipse, 8);

                coucheTag.UseDynamicVisibility = true;
                coucheTag.DynamicVisibilityWidth = TailleTag;
                coucheTag.DynamicVisibilityMode = DynamicVisibilityMode.ZoomedIn;

           
            }
            catch (Exception e)
            {
                System.Windows.MessageBox.Show("Impossible de charger " + EmplacementTag + " : " + e.ToString(), "Erreur", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

 

And my code to create a new point on the ShapeFile:

 

private void DebutCreationPoint(Coordinate coordClick)
        {
            /* Premi�re �tape, on cr�e le point sur la carte, et on ajoute les donn�es relatives � la carte et on sauvegarde la couche*/
            int index = ChercherCouche(CarteTags, NomCoucheTag);
            if (index == -1)
            {
                System.Windows.MessageBox.Show("Impossible de localiser la couche des tags", "Erreur", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            IMapFeatureLayer coucheTag = (IMapFeatureLayer)CarteTags.Layers[ChercherCouche(CarteTags, NomCoucheTag)];
            DotSpatial.Topology.Point point=new DotSpatial.Topology.Point(coordClick);
            IFeatureSet ensembleTag = coucheTag.DataSet;
            coucheTag.EditMode = true;
            IFeature nouveauTag = ensembleTag.AddFeature(point);
            IFeature parcelle = trouverElementPolygon(coordClick,NomCoucheParcelle);
            IFeature noImm = trouverPointCouche(new DotSpatial.Topology.Point(coordClick), NomCoucheNoImm);
            IFeature ilot = trouverElementPolygon(coordClick, NomCoucheIlot);
            IFeature propre = trouverElementPolygon(coordClick, NomCoucheZP);
            if (parcelle != null)
            {
                nouveauTag.DataRow["ADRES"] = parcelle.DataRow["ADRES"];
                nouveauTag.DataRow["IDPAR"] = parcelle.DataRow["IDPAR"];
                nouveauTag.DataRow["IDRUE"] = parcelle.DataRow["IDRUE"];
                nouveauTag.DataRow["IDPRO"] = parcelle.DataRow["IDPRO"];
                nouveauTag.DataRow["CONTA"] = parcelle.DataRow["DENOM"];
                nouveauTag.DataRow["DEPCO"] = parcelle.DataRow["DEPCO"];
            }
            if (noImm != null)
            {
                nouveauTag.DataRow["NOIMM"] = noImm.DataRow["NOIMM"];
                nouveauTag.DataRow["LIBRU"] = noImm.DataRow["LIBRU"];
            }
            if (ilot != null)
            {
                nouveauTag.DataRow["DCOMIRIS"] = ilot.DataRow["LIRIS"];
            }
            if (propre != null)
            {
                nouveauTag.DataRow["ZPROPRE"] = propre.DataRow["ZONE"];
            }
            nouveauTag.DataRow["CDTRT"] = "N";
            //nouveauTag.DataRow["X"] = coordClick.X;
            //nouveauTag.DataRow["Y"] = coordClick.Y;
            //nouveauTag.DataRow["NUMEROID"] = 0;
            coucheTag.Invalidate();
            coucheTag.EditMode = false;
            coucheTag.DataSet = ensembleTag;
        }

 

I think the problem comes from the fact, the source is a shapefile. Because when I want to refresh the map, I've got an indexOutOfRangeExpcetion error.