1

I am getting a very strange problem when converting from mappoint to screenpoint.

I am using the following code:

var sp = esri.geometry.ScreenPoint(512, 151);
    mp = map.toMap(screenPoint);

After converting from screenpoint(512, 151) to mappoint, I get the following map coordinates:

338638.7275175141, 4404774.250335829

Now when I perform the reverse conversion (i.e., from the same point above which is mappoint(338638.7275175141, 4404774.250335829) to screenPoint), I get a very different screenpoint (i.e. 31563417740, -72455974). I think I should get the same screenpoint(512, 151) coordinate. For this reverse conversion I am using the following code:

mp1 = new esri.geometry.Point(338638.7275175141, 4404774.250335829);
sp1 = map.toScreen(mp1);

With it, I get a very different screenpoint as I showed before and no the value (512,151).

Any help will be appreciated,

1

you're using at the beginning:

var sp = esri.geometry.ScreenPoint(512, 151);
    mp = map.toMap(screenPoint);

and then:

mp1 = new esri.geometry.Point(338638.7275175141, 4404774.250335829);
sp1 = map.toScreen(mp1);

I'm wondering if the right syntax is this:

var sp = esri.geometry.ScreenPoint(512, 151);
var mp = map.toMap(sp);

var mp1 = new esri.geometry.Point(338638.7275175141, 4404774.250335829);
var sp1 = map.toScreen(mp1);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.