Netlogo:SHP偏移世界显示

时间:2019-06-12 00:26:39

标签: gis netlogo

我正在加载用于城市模拟的城市网格SHP文件,但是显示偏离了世界窗口,如该图所示:

enter image description here

红色箭头显示意外的额外空间,蓝色箭头表示更多的城市网格所占据的区域,但未被世界窗口覆盖。这是设置代码:

to setup
  clear-all
  ask patches [set pcolor [225 226 228]]
  load-dataset

  draw-ins_industr20_a
  draw-curva_nivel20_l
  draw-cuerpo_agua20_a
  draw-corriente_ag20_l
  draw-carretera20_l
  draw-camino20_l
  draw-camellon20_a
  draw-manzana20_a
  draw-movilidad

  copy-values-to-patch
  fitness
  set threshold 4
  reset-ticks
end

这是加载数据集的过程:

to load-dataset
  set ins_industr20_a-dataset gis:load-dataset "datos/ins_industr20_a.shp"
  set manzana20_a-dataset gis:load-dataset "datos/manzana20_a.shp"
  set curva_nivel20_l-dataset gis:load-dataset "datos/curva_nivel20_l.shp"
  set cuerpo_agua20_a-dataset gis:load-dataset "datos/cuerpo_agua20_a.shp"
  set corriente_ag20_l-dataset gis:load-dataset "datos/corriente_ag20_l.shp"
  set carretera20_l-dataset gis:load-dataset "datos/carretera20_l.shp"
  set camino20_l-dataset gis:load-dataset "datos/camino20_l.shp"
  set camellon20_a-dataset gis:load-dataset "datos/camellon20_a.shp"
  set area_cultivo20_a-dataset gis:load-dataset "datos/area_cultivo20_a.shp"
  set movilidad-dataset gis:load-dataset "datos/Movilidad.shp"
end

,关联的prj文件为here

结果是,模拟输出在红色箭头的灰色区域中的城市增长,这是错误的。我该如何解决此问题,以便模拟不考虑灰色区域,而是将所有城市网格与世界显示的范围对齐?

1 个答案:

答案 0 :(得分:5)

这解决了问题:

set envelope gis:load-dataset "data/polygon.shp" 
gis:set-world-envelope gis:envelope-of envelope

polygon.shp等于要在世界窗口中显示的视图范围。然后,要消除多余的灰色空间,请在“模型设置”对话框中使用max-pxcor和max-pycor值,直到窗口视图与shp文件的范围匹配为止。信封命令可确保始终显示shp文件的范围。

相关问题