Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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,

share|improve this question

1 Answer 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);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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