(NetLogo: re-) transformation of turtle xcor/ycor to real-world coords

跟風遠走 提交于 2019-12-13 06:50:05

问题


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).



来源:https://stackoverflow.com/questions/28842474/netlogo-re-transformation-of-turtle-xcor-ycor-to-real-world-coords

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!