从GIS常规示例中的shp文件中创建节点/海龟

时间:2015-11-21 18:13:13

标签: gis netlogo shapefile

我需要从GIS的一般例子的城市shapefile创建节点,所以我可以将它们用作海龟的目标。 我尝试了以下解决方案,但它不起作用: http://netlogo-users.18673.x6.nabble.com/Creating-nodes-turtles-out-of-a-shp-file-and-linking-them-td5004359.html http://netlogoabm.blogspot.com/2015/07/loading-gis-and-csv-data-to-model-to-be.html#more

这是代码:

extensions [ gis ]
globals [ cities-dataset
      countries-dataset ]
breed [ city-labels city-label ]
breed [ country-labels country-label ]
breed [ country-vertices country-vertex ]

to setup
  clear-all
  gis:load-coordinate-system (word "data/" projection ".prj")
  set cities-dataset gis:load-dataset "data/cities.shp"
  set countries-dataset gis:load-dataset "data/countries.shp"
  gis:set-world-envelope (gis:envelope-union-of (gis:envelope-of cities-dataset)
                                                (gis:envelope-of countries-dataset))
end

to display-cities
  ask city-labels [ die ]
 foreach gis:feature-list-of cities-dataset
  [ gis:set-drawing-color blue
    gis:fill ? 2.0
    if label-cities
[ let location gis:location-of (first (first (gis:vertex-lists-of ?)))
  if not empty? location
  [ create-city-labels 1
    [ set xcor item 0 location
      set ycor item 1 location
      set size 0
      set label gis:property-value ? "NAME" ] ] ] ]
end

有人能帮帮我吗?

0 个答案:

没有答案