Import shp in net logo

No preview image

1 collaborator

Default-person Joshua Lee (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.3.1 • Viewed 455 times • Downloaded 48 times • Run 0 times
Download the 'Import shp in net logo' modelDownload this modelEmbed this model

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

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

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.

Uploaded by When Description Download
Joshua Lee almost 9 years ago import shp file Download this version
Joshua Lee almost 9 years ago Initial upload Download this version

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.