lowgas

lat,lng to webmercator

Discussion created by lowgas on Dec 22, 2010
Latest reply on Jul 21, 2011 by bcales
ok, well i have been searching for info on this for a chunk of the day today, and finally found this thread that looked like it was what i needed....

so i new have this function:
  function findLocation(){
   
   console.log('find location');
   var lat = latToFind;  //44.071
   var lng = lngToFind; //-122.199
   
   console.log('make new point');
   var pt = new esri.geometry.Point(lng,lat,new esri.SpatialReference({'wkid':2994}));
   console.log(pt);
   console.log('make new webmercator point');
   var xyPt = new esri.geometry.geographicToWebMercator(pt);
   console.log(xyPt);
   var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_DIAMOND, 14,
           new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
            new dojo.Color(MARK_OUTLINE_COLOR), 2), new dojo.Color(MARK_FILL_COLOR));
   var graphic = new esri.Graphic(xyPt,symbol);
   
   console.log('add graphic');
   map.graphics.add(graphic);
   
  }



so, this code all seams to run ok... the console logs all my messages with no errors.
however....

my graphic is not being added to the map (or at least not on the visible map).

when i examine the xyPt information inside the console, i noticed that the wkid is 102100.

so, my question is, what am i doing wrong, how can i get this functionality but have the wkid remain 2994?

thanks for any help you can offer.

Outcomes