Select to view content in your preferred language

geometryService.intersect problem

723
2
10-05-2012 05:27 AM
AndrewIosida
Emerging Contributor
Hello! I have two polygons. One contain another. After completing intersectTask however I got problem: area of intersection is more than area of bigger polygon.
Any help would be appreciated.
Tags (2)
0 Kudos
2 Replies
KenBuja
MVP Esteemed Contributor
Are you projecting the area of the returned polygon into something other than Web Mercator? If not, be aware that the measuring distances and areas in Web Mercator will likely give you incorrect results. Please see this blog posting on the subject.
0 Kudos
AndrewIosida
Emerging Contributor
Hello!
What I'm doing that I selecting a polygon, then with IdentifyTask I got an arrayOfPolygons with which mainPolygon has any intersection. Next step, I'm making geometryService.intersect(arrayOfPolygons[0] , mainPolygon). When I got an intersection I'm launching geometryService.areasAndLengths for it. After I launch geometryService.intersect(arrayOfPolygons[1] , mainPolygon) and so on. Till the last of arrayOfPolygons. So, in the end I got an array of areas of polygons that intersected with mainPolygon. And if you add this areas one to another you got as result area of mainPolygon.
This worked almost perfect for me. I tested many polygons and got expected results. But(!) one day I found a polygon, I launched an IdentifyTask, then, after completing geometryService.intersect and geometryService.areasAndLengths, I got a problem: area of one polygon contained by mainPolygon is too much bigger than area of mainPolygon.
If you take a look at image added to my post you can see that mainPolygon contains 3 polygons. After geometryService.areasAndLengths I got areas of these polygons. And area of second and third polygons are right. But area of first polygon (blue color) is more then area of mainPolygon. For example, area of mainPolygon is 14, area of second polygon is 2, area of third polygon is 3, and area of first polygon must be 9. But I got 16.
I don't know, maybe problem is how it building a polygon after geometryService.intersect. Because first polygon is complicated polygon, with "hole" in it.
[ATTACH=CONFIG]18239[/ATTACH]
Thanks in advance.
0 Kudos