Adding GIS data to your NetLogo model is useful when you want to create visualizations of spatial data. The NetLogo GIS extension can handle both raster and vector data. Raster data are directly added to NetLogo as ASCII (.asc) or ESRI grid (.grd) files while vector data (points, lines, and polygons) are added as ESRI shapefiles (.shp) format.
Shapefile is the most common format for storing and exchanging vector GIS data, and this section will briefly tackle on how to load shapefiles as well as introduce some of the GIS primitives.
The code on the left uses gis:set-world-envelope-ds. As shown in the first image below, the scale along the x axis is stretched that it occupies almost the entire NetLogo View. The second code that uses gis:set-world-envelope has the scale along the x and y axis the same.
GIS loading in NetLogo 6.2.2
I have a recent research that made use of GIS .SHP and .PRJ files, and the previous codes I've written are no longer working. So, I am sharing here now the code for those who might be encountering issues with GIS.
I haven't countered that exception. However, based on the GIS manual, the GIS extension does not support all WKT coordinate systems and projections. I am not sure if there is a big difference with Lambert_Conformal_Conic_2SP and Lambert_Conformal_Conic. Please keep me posted regarding this issue =)
ReplyDeleteThanks!
Hi! I'm doing exactly the same thing. I really struggle with the projection issue too. To get around this, I have been opening the sample model layer files (raster in my case) in GIS. This sets the dataframe to be the projection of the sample model layer file. Then, I add my layers on top, and export with the dataframe's projection. Then, I use the projection file from the sample model - I just rename it to match my file. For some reason when I use the projection file from my file (even with the projection!) it doesn't read it properly and I get the same error as shaimy. Hope that makes sense!
ReplyDeleteI am having a lot of struggles doing more complicated stuff with GIS files in netlogo, so I will be curious to follow this blog!
Deletecan I ask for the shape files and code for reference? im making a similar model.
ReplyDeleteAny updates, this doesn't work
ReplyDelete