4 Replies Latest reply on May 2, 2012 8:10 AM by geonetadmin

    Problem with reprojection

    geonetadmin
      Original User: rogeryc

      Hi, I'm having the following issue:

      [ATTACH=CONFIG]13896[/ATTACH]

      The yellow flag is a point feature with WGS 84 zone 20S projection (wkid: 32720), in a feature layer. Using Bing or ArcGIS Online map, that point is correctly drawn by the viewer. The green star is a graphic added to a graphic layer in the same projection (32720) with the same x,y coordinate.

      Why are they drawn in different places?

      Regards,
      Roger.
        • Re: Problem with reprojection
          demin
          How you add that green point,  can you show your code here?
          • Re: Problem with reprojection
            geonetadmin
            Original User: jenniferdnery

            Does your GraphicsLayer Graphic.Geometry has its SpatialReference set?
            • Re: Problem with reprojection
              geonetadmin
              Original User: rogeryc

              How you add that green point,  can you show your code here?


              This is the code:

              var point = results[0].Geometry as MapPoint;
                             
              GraphicsLayer graphicsLayer;

              Layer layer = Mapa.Layers["X,Y Point"];
              bool isNull = (layer != null);
              bool isGraphicLayer = (layer is GraphicsLayer);
              if (isNull && isGraphicLayer)
              {
                  graphicsLayer = layer as GraphicsLayer;
              }
              else
              {
                  graphicsLayer = new GraphicsLayer();
                  graphicsLayer.ID = "X,Y Point";
                  graphicsLayer.SetValue(MapApplication.LayerNameProperty, nombreCapaGrafica);
              }

              graphicsLayer.ClearGraphics();
              graphicsLayer.Graphics.Add(results[0]);

              if (MapApplication.Current.Map.Layers[graphicsLayer.ID] == null)
              {
                  MapApplication.Current.Map.Layers.Add(graphicsLayer);
              }

              Regards.
              • Re: Problem with reprojection
                geonetadmin
                Original User: rogeryc

                Does your GraphicsLayer Graphic.Geometry has its SpatialReference set?


                No, the spatial reference is null, and I don't know how to set it, because the SpatialReference property is read only. What am I missing?

                Regards.