Problem with reprojection

1480
4
04-27-2012 12:22 PM
by Anonymous User
Not applicable
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.
0 Kudos
4 Replies
DeminHu
New Contributor
How you add that green point,  can you show your code here?
0 Kudos
by Anonymous User
Not applicable
Original User: jenniferdnery

Does your GraphicsLayer Graphic.Geometry has its SpatialReference set?
0 Kudos
by Anonymous User
Not applicable
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.
0 Kudos
by Anonymous User
Not applicable
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.
0 Kudos