ccaspani

Newbie: graphic is always at map center (projection problem?)

Discussion created by ccaspani on Sep 15, 2010
Latest reply on Sep 20, 2010 by ccaspani
Hi,

I'm starting a small project that basically is a map that should show up some POI but I'm already on a dead end.

I've created the map using:

      
function init() {
        map = new esri.Map("map", {spatialReference:{wkid: 4326}});
        dojo.connect(map, "onLoad", loadHQDataSample);
        var tiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
        map.addLayer(tiledMapServiceLayer);
       }


The map show up perfectly showing the world; then I'm trying to add a single POI via JSON using:

var myPoint1 = {
      "geometry":
      {
       "spatialReference":
       {
        "wkid": 4326
       },
       "x": -115.199,
       "y": 32.0207
      },
      "symbol":
      {
       "angle": 0,
       "color":[0,0,0,255],
       "height": 30,
       "size": 9,
       "style":"esriPMS",
       "type":"esriPMS",
       "url":"images/bluedot.png",
       "width": 30,
       "xoffset": 0,
       "yoffset": 0
      },
      "infoTemplate":
      {
       "title":"5 - 48.0 mi SSE of Calexico, CA",
       "content":"<img src=\"http://earthquake.usgs.gov/eqcenter/shakemap/thumbs/shakemap_sc_10798005.jpg\" width=\"100\" align=\"left\" hspace=\"10\"/><p>Date: Tue, 14 Sep 2010 10:52:17 UTC<br/>Lat/Lon: 32.0207/-115.199<br/>Depth: 10</p>"
      }      
       };
 var graphic1 = new esri.Graphic(myPoint1);
 map.graphics.add(graphic1);


What is happening is that the graphics is always put in the center of the map. I think that may be is a problem with projection but... no idea.
Looking at other sample seems that this should work... 

Anyone could shed some light on me?

Thank you in advance.

Regards Claudio

Outcomes