NetLogo - misalignment with imported GIS shapefiles

房东的猫 提交于 2019-12-01 01:10:24

Nice screen shot, thanks for providing that, it makes the problem easy to grasp. It looks like the farther from the origin, the worse the discrepancy is, like the error is radiating out from the origin.

I know the GIS extension documentation recommends gis:set-world-envelope (list min-pxcor max-pxcor min-pycor max-pycor), but I have to wonder if it's actually correct. min/max-pxcor/pycor are the minimum and maximum patch coordinates, not the minimum and maximum turtle coordinates. So for example if max-pxcor is 10, then a turtle's x coordinate can be as high as 10.499999[...], and if min-pxcor is -10, a turtle's x coordinate can be as low -10.5. Thus world-width is 21, not 20.

Maybe try changing it to gis:set-world-envelope (list min-pxcor - 0.5 max-pxcor + 0.5 min-pycor - 0.5 max-pycor + 0.5) and see if that fixes it. Or if it doesn't fix it exactly, try flipping the signs or try 1 instead of 0.5. It sure looks from the screen shot like the problem is an off-by-one or off-by-0.5 error.

I think Seth is correct that it's an off-by-one error in mapping patch coordinates to world coordinates. It may be related to the bug that was mentioned here. His proposed solution of using (list min-pxcor - 0.5 max-pxcor + 0.5 min-pycor - 0.5 max-pycor + 0.5) should work. If not, send me the model and I'll take a look if I have time.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!