I cannot figure this out. I am trying to add a graphic to the map and zoom to it based on a reproject. My location entry is in lat/long and my map is in state plane. I am passed back the coordinates correctly, but cannot do add or centerat. Says they are undefined.
I am attaching a word document with what I am using. I have been trying to figure this out since yesterday.
Solved! Go to Solution.
Great - so the cheat way is to assign this to 'that' right before the function --> var that = this;
Then inside the function use: that.map.....
From what I can tell, the fancy way is to use lang.hitch from dojo (dojo/_base/lang — The Dojo Toolkit - Reference Guide)) .
I have two thoughts:
That's an interesting image you attached...I'm no expert but it looks like the 'map' that is printing is actually the HTML map div element, not the javascript map object. Is it possible that earlier in your code the 'map' variable was overwritten by referencing the div (maybe by using it's id, 'map')?
Because it is returning the HTML, the graphics property would definitely be undefined.
try printing just 'this' and see what it is actually referencing, maybe it's the DOM.
Yes it is losing the this.map as soon as I get into the project function.
gsvc.project([inpoint], outSR, function(projPoints) {
once I enter this the reference to the map is lost.
Great - so the cheat way is to assign this to 'that' right before the function --> var that = this;
Then inside the function use: that.map.....
From what I can tell, the fancy way is to use lang.hitch from dojo (dojo/_base/lang — The Dojo Toolkit - Reference Guide)) .
Thank you so much Sarah.