(NetLogo: re-) transformation of turtle xcor/ycor

2019-09-05 15:36发布

问题:

I have a well functioning NetLogo model of pedestrians in a generic, urban environment loaded from shapefiles - including projection/transformation (See selected code lines below).

How do I export the xcor's and ycors of turtles to text files, projected/transformed into the original projection system?

Thanks in advance

code examples...

gis:load-coordinate-system (word "../data/testLines_2.prj") 
set ODLines gis:load-dataset "../data/testLines_2.shp" 
setUpEnvelopeExtented ODLines 10

回答1:

maybe you can use gis:store-dataset dataset file

You need two steps :

  1. create a dataset with your agents
  2. export your dataset in

You can use something like

to export-turtles
  gis:set-world-envelope [-90 90 -90 90 ]
  gis:store-dataset gis:turtle-dataset turtles "bugs"
end


回答2:

Ok. Thanks Delaye. I probably need to be a little more explicit: What I need is at every tick of my model to export the locations (and more) of every turtle.

file-open "locations.txt" to go ask turtles [ file-write xcor file-write ycor ] end file-close

But instead of x- and ycor (which I believe are in netlogo space) I need them to be projected into the current GIS-system of the model (as per my load-coordinatesystem primitive).