AnsweredAssumed Answered

Graphic always shows at mappoint 0,0 while using latitude and longitude

Question asked by obelixasterix_ on May 12, 2016
Latest reply on May 17, 2016 by sgill-esristaff


Hi I am using this code to add a Text SYmbol at given latitude and longitude.(San Francisco)

 

TextSymbol txtSymbol = new TextSymbol(30, "50", Color.BLUE);

{

     Point mapPoint = ConvertMyLocationPoint(-122.4600595,37.7532508);

     gr = new Graphic((mapPoint), txtSymbol);

     graphicsLayer = new GraphicsLayer();

     //add the graphic to the map
        graphicsLayer.addGraphic(gr);

 

        mMapView.addLayer(graphicsLayer);

}

 

private Point ConvertMyLocationPoint(final double longitude, final double latitude) {

  Point wgspoint = new Point(longitude, latitude);

  Point mapPoint = GeometryEngine.project(longitude,latitude,

   mMapView.getSpatialReference());

 

   return mapPoint;

}

 

The point always shows up at 0,0(lat, long) in the map.

 

Is this a wrong way to add point when I have latitude and longitude?

 

Could anyone suggest how to approach this.

 

Thanks.

Outcomes