NetLogo GIS extension: How to create turtles according to location information in shapefile

Jan Veen

In the process of making a NetLogo model with the gis extension, I am getting stuck at wanting to create turtles according to the shapefile location information. How do I create turtles on the location contained in the shapefile and make sure that they have properties also contained in the shapefile?

So far I managed to make a dataset in R and convert it into a shapefile and import it into NetLogo. With the code provided I am able to draw points on a map.

But I want to create agents on every location that is contained in the shapefile dataset. I have searched on the internet, but I cannot find it. Also when I look at the Netlogo user manual, I am not able to do it.

And in the shapefile dataset an extra characteristic is present which must be assigned to every agent because I want to create an household (agent) per location and according to the characteristic assign a color to it.

The shapefile contains an ID no., a boolean variable and coordinates

1 16823 0 c(1.7474251, 4.9600897)
2 16873 0 c(1.3272039, 5.1185999) 
3 16874 1 c(1.327054, 5.1162204)
4 16875 0 c(1.3270068, 5.115111)
5 16876 1 c(1.3268986, 5.1130956)

Based on this code I can implement the following code:

set-patch-size 6.5
set dataset gis:load-dataset "PlotLocations_HARV.shp"
gis:set-world-envelope gis:envelope-of dataset
gis:set-drawing-color white
gis:draw dataset 1

Which draws points on a map, but I want to sprout agents on the points, keeping the ID no. and the boolean variable for every agent.

Jan Veen

In the meantime with the help of you guys and other sources, I've managed to get what I wanted with the following code:

to setup
      ca
      resize-world 0 120 0 120
      set-patch-size 6.5
      set dataset gis:load-dataset "PlotLocations_HARV3.shp"
      gis:set-world-envelope gis:envelope-of dataset
      gis:set-drawing-color white
      gis:draw dataset 1
      displayhh
end

to displayhh
  foreach gis:feature-list-of dataset [
    vector-feature ->
    let coord-tuple gis:location-of (first (first (gis:vertex-lists-of vector-feature)))
    let pv gis:property-value vector-feature "CC_PV_A"

   let long-coord item 0 coord-tuple
    let lat-coord item 1 coord-tuple

    create-turtles 1 [ set pv1 pv setxy long-coord lat-coord ]
  ]

end

Where the shapefile is the database to be imported. And CC_PV_A is the boolean variable that is stated in the shapefile and assigned to turtles in the form of pv1 (with pv as an intermediary variable).

I hope this can help somebody!

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How to ask turtles to import values for a csv.file in NETLOGO

分類Dev

NetLogo: How to ask to turtles who on the cells except the origin cell?

分類Dev

How to distribute agents' attributes randomly according to specific probabilities in Netlogo?

分類Dev

How to persist information for a vscode extension?

分類Dev

NetLogo - using BehaviorSpace get all turtles locations as the result of each repetition

分類Dev

NetLogo - plot sum of all turtles with value in certain range

分類Dev

How to retrieve information from Pubmed according to date and term using Python?

分類Dev

How to create hidden chrome Extension

分類Dev

How import all information of location history KML file on Fusion Table?

分類Dev

Is there any extension or some method to read xml file in netlogo? #netlogo

分類Dev

How to create a URL object that points to an hdfs location?

分類Dev

How to create visual studio extension for .cshtml files?

分類Dev

How to create postgis extension for postgresql in docker?

分類Dev

How to create a csv file that labels unstructured dataset according to filenames

分類Dev

R extension breaks connection to extensions directory in NetLogo

分類Dev

Getting Geographic Information Systems GIS of a Street / Road in any Maps Api

分類Dev

Netlogo:GISベクター機能からリストを作成する

分類Dev

netlogo GIS拡張例外:5行目のセルサイズが無効です

分類Dev

How to make a size slider in netlogo?

分類Dev

how to pass a scala List to NetLogo

分類Dev

interchangeable network and GPS location providers according to gps status android

分類Dev

How to use 2GIS map in iOS app

分類Dev

How to extract the data in a netcdf file based on a shapefile in R?

分類Dev

ラスターGISデータをパッチnetlogoに適用するより高速な方法

分類Dev

How to add power law likelihood to Netlogo Model

分類Dev

Create a static Extension method in Dart

分類Dev

Unable to create PHP extension with swig

分類Dev

How to add the values according to subject

分類Dev

How to agg function according to condition?

Related 関連記事

  1. 1

    How to ask turtles to import values for a csv.file in NETLOGO

  2. 2

    NetLogo: How to ask to turtles who on the cells except the origin cell?

  3. 3

    How to distribute agents' attributes randomly according to specific probabilities in Netlogo?

  4. 4

    How to persist information for a vscode extension?

  5. 5

    NetLogo - using BehaviorSpace get all turtles locations as the result of each repetition

  6. 6

    NetLogo - plot sum of all turtles with value in certain range

  7. 7

    How to retrieve information from Pubmed according to date and term using Python?

  8. 8

    How to create hidden chrome Extension

  9. 9

    How import all information of location history KML file on Fusion Table?

  10. 10

    Is there any extension or some method to read xml file in netlogo? #netlogo

  11. 11

    How to create a URL object that points to an hdfs location?

  12. 12

    How to create visual studio extension for .cshtml files?

  13. 13

    How to create postgis extension for postgresql in docker?

  14. 14

    How to create a csv file that labels unstructured dataset according to filenames

  15. 15

    R extension breaks connection to extensions directory in NetLogo

  16. 16

    Getting Geographic Information Systems GIS of a Street / Road in any Maps Api

  17. 17

    Netlogo:GISベクター機能からリストを作成する

  18. 18

    netlogo GIS拡張例外:5行目のセルサイズが無効です

  19. 19

    How to make a size slider in netlogo?

  20. 20

    how to pass a scala List to NetLogo

  21. 21

    interchangeable network and GPS location providers according to gps status android

  22. 22

    How to use 2GIS map in iOS app

  23. 23

    How to extract the data in a netcdf file based on a shapefile in R?

  24. 24

    ラスターGISデータをパッチnetlogoに適用するより高速な方法

  25. 25

    How to add power law likelihood to Netlogo Model

  26. 26

    Create a static Extension method in Dart

  27. 27

    Unable to create PHP extension with swig

  28. 28

    How to add the values according to subject

  29. 29

    How to agg function according to condition?

ホットタグ

アーカイブ