Netlogo 不识别定义的世界范围内的 GIS 坐标,它将它们视为 netologo 世界坐标
Netlogo doesen't recognize the GIS coordinates in the defined envelope of the world, it treats them as netologo world coordinates
我想从 shapefile 中导入一些多边形并创建具有特定坐标的海龟(一组将放置在特定多边形中的点)。我成功导入了多边形,设置了世界的包络...但是,当我尝试添加海龟并将它们放在特定位置(setxy)时,它会将它们添加到同一点(就像那两个点具有相同的坐标,而他们没有)。我选择了我知道它们在空间上属于不同导入多边形的点的坐标。我改变了像素大小(尽管这可能是问题所在),但没有。我意识到 NetLogo 将这些坐标解释为它的本地坐标,而不是 GIS。但是 Netlogo 不应该在定义的世界范围内识别 GIS 坐标吗?
谁能帮我解决这个问题并告诉我我做错了什么。
我的设置过程:
to setup
set paldrino gis:load-dataset "paldrino.shp"
let world ( gis:envelope-of paldrino )
gis:set-world-envelope (world)
;; Make them visible
foreach gis:feature-list-of paldrino [ ;for each polygon
polygon ->
ask patches gis:intersecting polygon [
set pcolor pink
]]
create-turtles 1[
set color blue
set size 15
setxy 34.6255826 48.2408635 ;; here's the problem, netlogo treats this as the network coordinates of the world, not as GIS coordinates
]
create-turtles 1[
set color green
set size 15
setxy 34.8056851 48.1885275 ;; here's the problem, netlogo treats this as the network coordinates of the world, not as GIS coordinates
end
我找到了替代解决方案。当然不是最好的,但现在是我唯一拥有的。
我创建了一个额外的程序,将 GIS 坐标重新调整为 NetLogo 坐标。
to-report nl-x [#x]
let world gis:envelope-of paldrino
let minx item 0 world
let maxx item 1 world
report ((#x - minx) / (maxx - minx)) * (max-pxcor - min-pxcor) + min-pxcor
end
to-report nl-y [#y]
let world gis:envelope-of paldrino
let miny item 2 world
let maxy item 3 world
report ((#y - miny) / (maxy - miny)) * (max-pycor - min-pycor) + min-pycor
end
当我想设置乌龟的坐标时,我按以下方式调用程序:
setxy nl-x(34.6255826) nl-y(48.2408635)
如果有人有更好的计算解决方案并且我可以解释为什么我的问题中的代码不起作用,请这样做。我会接受那个答案而不是这个。
我想从 shapefile 中导入一些多边形并创建具有特定坐标的海龟(一组将放置在特定多边形中的点)。我成功导入了多边形,设置了世界的包络...但是,当我尝试添加海龟并将它们放在特定位置(setxy)时,它会将它们添加到同一点(就像那两个点具有相同的坐标,而他们没有)。我选择了我知道它们在空间上属于不同导入多边形的点的坐标。我改变了像素大小(尽管这可能是问题所在),但没有。我意识到 NetLogo 将这些坐标解释为它的本地坐标,而不是 GIS。但是 Netlogo 不应该在定义的世界范围内识别 GIS 坐标吗?
谁能帮我解决这个问题并告诉我我做错了什么。
我的设置过程:
to setup
set paldrino gis:load-dataset "paldrino.shp"
let world ( gis:envelope-of paldrino )
gis:set-world-envelope (world)
;; Make them visible
foreach gis:feature-list-of paldrino [ ;for each polygon
polygon ->
ask patches gis:intersecting polygon [
set pcolor pink
]]
create-turtles 1[
set color blue
set size 15
setxy 34.6255826 48.2408635 ;; here's the problem, netlogo treats this as the network coordinates of the world, not as GIS coordinates
]
create-turtles 1[
set color green
set size 15
setxy 34.8056851 48.1885275 ;; here's the problem, netlogo treats this as the network coordinates of the world, not as GIS coordinates
end
我找到了替代解决方案。当然不是最好的,但现在是我唯一拥有的。 我创建了一个额外的程序,将 GIS 坐标重新调整为 NetLogo 坐标。
to-report nl-x [#x]
let world gis:envelope-of paldrino
let minx item 0 world
let maxx item 1 world
report ((#x - minx) / (maxx - minx)) * (max-pxcor - min-pxcor) + min-pxcor
end
to-report nl-y [#y]
let world gis:envelope-of paldrino
let miny item 2 world
let maxy item 3 world
report ((#y - miny) / (maxy - miny)) * (max-pycor - min-pycor) + min-pycor
end
当我想设置乌龟的坐标时,我按以下方式调用程序:
setxy nl-x(34.6255826) nl-y(48.2408635)
如果有人有更好的计算解决方案并且我可以解释为什么我的问题中的代码不起作用,请这样做。我会接受那个答案而不是这个。