user8866982
user8866982

Reputation: 21

Netlogo - GIS Movement History of Turtles

I've got a Netlogo model running on a couple of raster layers which I imported using the GIS extension. All good so far

Next, I'd like to record and export the movement history of my turtles (in real world coordinates), along with the turtle number and the tick number.

I've looked at writing out xcor and ycor but that's not much help as I need GIS locations. I've also looked at hatching a separate breed (tracker) at each turtle location to store the locations and then exporting the tracker breed at the end using gis:store-dataset. But this substantially reduces the run speed of the model, even for a relatively small number of turtles, to the extent that it's almost unusable. I also can't figure out how to get the turtle number into the tracker breed.

Does anyone have any bright ideas of alternative faster approaches and which also include the turtle number?

Key elements of existing code are

breed [ tracker trackers ]
trackers-own [ tick_no ]

ask turtles [     
    my-move-turtles-routine
    hatch-trackers 1 [
      set hidden? true
      set tick_no ticks
    ]
]

gis:store-dataset gis:turtle-dataset trackers "tracking"

Many thanks

Upvotes: 1

Views: 184

Answers (1)

Luke C
Luke C

Reputation: 10301

What kind of output are you looking for? Are you writing this out to a csv?

I think this to-report procedure outputs what you need (when called by a turtle) but you will likely have to modify it or split it into multiple pieces depending on your desired output format.

to-report turtle-coords-who-tick 
  let t_env gis:envelope-of self
  let x first t_env
  let y last t_env
  let me who
  report ( list x y me ticks) 
end

Upvotes: 1

Related Questions