Import shp in net logo
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
Netlogo includes a GIS Extension that allows you to load vector and raster data into your model as well as perform some basic GIS operations. Theses extensions support vector data in the form of ESRI shapefiles and raster data in the form of ESRI ASCII Grid files. This model however is a shapefile of Ohio State University campus imported into Netlogo through the use of these GIS extensions.
HOW IT WORKS
We first define a transformation between GIS data space and netlogo space. We then load our datasets and performs GIS operations with the datasets. One way of defining a transformation between GIS space and Netlogo space is to take the union of the 'envelopes' or the bounding rectangles of all yur GIS data and map that directly to the bounds of the Netlogo world. Once coordinate system are defined we cn load our data set using gis:load-dataset
HOW TO USE IT
Use the setup to prepare Netlogo world. First load the display-pavement to display all pavements from the shapefile. Next, click on the display-building to display all buildings from the shapefile. Click on te create-netlogo-data to fill in all paches for pavements and buildings. You can control the display of labels by using the hide-labels or show labels button.
NETLOGO FEATURES
Note use of GIS extension extensions [gis] gis:load-dataset gis:envelope-of gis:load-coordinate-system
RELATED MODELS
GIS General Example
Author
Joshua Z. Tovuor Geographic Information Science tovuor.1@osu.edu 6145991964
Comments and Questions
extensions [ gis ] globals [building-dataset pavement-dataset] breed [ building-labels building-label] breed [ pavement-labels pavement-label] to set-up clear-all set building-dataset gis:load-dataset "/Users/student/Documents/Geog5226/lab5/OSU_data/buildings.shp" set pavement-dataset gis:load-dataset "/Users/student/Documents/Geog5226/lab5/OSU_data/pavement.shp" gis:set-world-envelope (gis:envelope-union-of (gis:envelope-of building-dataset) (gis:envelope-of pavement-dataset)) reset-ticks end to display-buildings ask building-labels [die] gis:set-drawing-color green gis:draw building-dataset 1 if True [foreach gis:feature-list-of building-dataset [ let centroid gis:location-of gis:centroid-of ? if not empty? centroid [ create-building-labels 1 [ set xcor item 0 centroid set ycor item 1 centroid set size 0 set label gis:property-value ? "BLDG_NAME"]]]] end to display-pavement gis:set-drawing-color orange gis:draw pavement-dataset 1 end to hide-labels ask building-labels [hide-turtle] end to show-labels ask building-labels [show-turtle] end to create-NetLogo-data create-buildings create-paths end to create-buildings hide-labels ask patches gis:intersecting building-dataset [set pcolor green] end to create-paths ask patches gis:intersecting pavement-dataset [set pcolor orange] end
There are 2 versions of this model.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.