mggl

Adding a graphic on a spefisific location on the map

Discussion created by mggl on Jan 17, 2012
Latest reply on Jan 18, 2012 by sebgre
Below is the part of the application code that I've written. When the application is run, the graphic is added on the map. Hovewer, it is not in the right location though the lattitude and longitude values are right. What could be the reason? I could not figure it out.
                
                someGraphicsLayer = new GraphicsLayer();
  map.addLayer(someGraphicsLayer);

  HashMap<String, Object> attrMap = new HashMap<String, Object>();
  attrMap.put("Title", "a graphic");

  double locx = 32.039821;
  double locy = 39.8858262;
  
                Point p = new Point(locx, locy);
  Point point = (Point) GeometryEngine.project(p, SpatialReference.create(4326), map.getSpatialReference());    

  Symbol symbol = someIcon;

  someGraphicsLayer.addGraphic(new Graphic(point, symbol, attrMap, null));

Outcomes