banner



How To Upload Gis Layers To Netlogo

NetLogo Gis Extension

Using

This extension adds GIS (Geographic Information Systems) back up to NetLogo. It provides the ability to load vector GIS data (points, lines, and polygons), and raster GIS data (grids) into your model.

The extension supports vector data in the grade of ESRI shapefiles and GeoJSON files. The shapefile (.shp) and GeoJSON (.geojson) formats are the nearly common format for storing and exchanging vector GIS information. The extension supports raster information in the form of ESRI ASCII Filigree files. The ASCII grid file (.asc or .grd) is not as common as the shapefile, just is supported as an interchange format past about GIS platforms.

How to use

In general, you commencement define a transformation between GIS data space and NetLogo space, and so load datasets and perform diverse operations on them. The easiest mode to define a transformation between GIS space and NetLogo infinite is to accept the union of the "envelopes" or bounding rectangles of all of your datasets in GIS space and map that directly to the premises of the NetLogo world. See GIS Full general Examples for an case of this technique.

You may also optionally define a projection for the GIS space, in which example datasets will be re-projected to friction match that projection as they are loaded, as long as each of your data files has an associated .prj file that describes the projection or geographic coordinate system of the information. If no associated .prj file is found, the extension will assume that the dataset already uses the current project, regardless of what that project is.

Once the coordinate arrangement is defined, you tin can load datasets using gis:load-dataset. This primitive reports either a VectorDataset or a RasterDataset, depending on what blazon of file you laissez passer information technology.

A VectorDataset consists of a collection of VectorFeatures, each ane of which is a indicate, line, or polygon, forth with a set of property values. A unmarried VectorDataset may contain simply 1 of the iii possible types of features.

There are several things you tin do with a VectorDataset: inquire it for the names of the backdrop of its features, ask it for its "envelope" (bounding rectangle), ask for a list of all VectorFeatures in the dataset, search for a unmarried VectorFeature or list of VectorFeatures whose value for a particular holding is less than or greater than a particular value, or lies within a given range, or matches a given string using wildcard matching ("*", which matches whatsoever number of occurrences of any characters). If the VectorFeatures are polygons, you can too utilise the values of a item property of the dataset'south features to a given patch variable.

There are also several things yous tin can do with a VectorFeature from a VectorDataset: enquire information technology for a list of vertex lists, inquire information technology for a property value by proper name, enquire information technology for its centroid (center of gravity), and ask for a subset of a given agentset whose agents intersect the given VectorFeature. For point data, each vertex list will be a one-element listing. For line data, each vertex list will represent the vertices of a line that makes up that feature. For polygon data, each vertex listing will represent one "ring" of the polygon, and the first and last vertex of the list will be the aforementioned. The vertex lists are fabricated up of values of type Vertex, and the centroid will exist a value of type Vertex equally well.

There are a number of operations defined for RasterDatasets as well. Generally these involve sampling the values in the dataset, or re-sampling a raster to a different resolution. You lot can also apply a raster to a given patch variable, and convolve a raster using an arbitrary convolution matrix.

Code Example: GIS General Examples has full general examples of how to utilize the extension

Code Example: GIS Slope Case is a more than advanced example of raster dataset analysis.

Known Problems

Values of type RasterDataset, VectorDataset, VectorFeature, and Vertex are not handled properly by export-earth and import-world. To salvage datasets, y'all must use the gis:store-dataset primitive.

There is currently no way to distinguish positive-area "beat out" polygons from negative-surface area "hole" polygons, or to determine which holes are associated with which shells.

Credits

The primary developer of the GIS extension was Eric Russell.

Significant updates, features, and fixes were added past James Hovet in 2020 and 2021.

The GIS extension makes utilize of several open-source software libraries. For copyright and license data on those, see the copyright section of the transmission. The extension also contains elements borrowed from My Globe GIS.

This documentation and the example NetLogo models are in the public domain. The GIS extension itself is free and open source software. See the README.md file in the extension/gis directory for details.

We would love to hear your suggestions on how to better the GIS extension, or just about what you're using it for. Post questions and comments at the NetLogo Users Group, or write directly to Eric Russell and the NetLogo squad at ccl-gis@ccl.northwestern.edu

Primitives

RasterDataset Primitives

Dataset Primitives

VectorDataset Primitives

Coordinate Arrangement Primitives

Drawing Primitives

gis:set up-transformation

gis:fix-transformation gis-envelope netlogo-envelope

Defines a mapping betwixt GIS coordinates and NetLogo coordinates. The gis-envelope and netlogo-envelope parameters must each be four-chemical element lists consisting of:

          [minimum-x maximum-x minimum-y maximum-y]                  

The scale of the transformation will be equal to the minimum of the scale necessary to make the mapping between the ranges of x values and the scale necessary to make the mapping between the ranges of y values. The GIS space will exist centered in NetLogo space.

For example, the following two lists would map all of geographic (latitude and longitude) space in degrees to NetLogo world space, regardless of the electric current dimensions of the NetLogo world:

          (list -180 180 -90 90) (list min-pxcor max-pxcor min-pycor max-pycor)                  

However, if you lot're setting the envelope of the NetLogo world, you should probably be using set-world-envelope.

gis:set up-transformation-ds

gis:fix-transformation-ds gis-envelope netlogo-envelope

Does the same thing every bit ready-transformation higher up, except that information technology allows the scale for mapping the range of ten values to exist different than the calibration for y values. The "-ds" on the stop stands for "different scales". Using different scales volition cause baloney of the shape of GIS features, then information technology is by and large not recommended, just it may be useful for some models.

Here is an example of the difference between set-transformation and set-transformation-ds:

gis:set-earth-envelope

gis:set-world-envelope gis-envelope

A shorthand for setting the transformation by mapping the envelope of the NetLogo world to the given envelope in GIS space, while keeping the scales forth the 10 and y axis the same. Information technology is equivalent to:

          set-transformation gis-envelope (listing min-pxcor max-pxcor min-pycor max-pycor)                  

This primitive is supplied because most of the time you'll want to set up the envelope of the entire NetLogo globe, rather than just a part of information technology.

gis:fix-world-envelope-ds

gis:gear up-earth-envelope-ds gis-envelope

A autograph for setting the transformation by mapping the envelope of the NetLogo world to the given envelope in GIS space, using unlike scales forth the 10 and y axis if necessary. It is equivalent to:

          set-transformation-ds gis-envelope (list min-pxcor max-pxcor min-pycor max-pycor)                  

See the pictures above for the divergence between using equal scales for 10 and y coordinates and using dissimilar scales.

gis:world-envelope

gis:globe-envelope

Reports the envelope (bounding rectangle) of the NetLogo world, transformed into GIS space. An envelope consists of a four-element list of the form:

          [minimum-x maximum-ten minimum-y maximum-y]                  

gis:envelope-of

gis:envelope-of thing

Reports the envelope (bounding rectangle) of affair in GIS coordinates. The thing may be an Agent, an AgentSet, a RasterDataset, a VectorDataset, or a VectorFeature. An envelope consists of a four-element list of the form:

          [minimum-x maximum-x minimum-y maximum-y]                  

gis:envelope-matrimony-of

gis:envelope-marriage-of envelope1 envelope2 gis:envelope-union-of envelope1...

Reports an envelope (bounding rectangle) that entirely contains the given envelopes. An envelope consists of a four-element listing of the form

          [minimum-x maximum-x minimum-y maximum-y]                  

No supposition is made nearly the coordinate system of the arguments, though if they are not in the same coordinate system, results volition be unpredictable.

gis:load-coordinate-system

gis:load-coordinate-system file

Loads a new global projection used for projecting or re- projecting GIS information as it is loaded from a file. The file must comprise a valid Well-Known Text (WKT) projection description.

WKT project files are often distributed alongside GIS data files, and normally have a ".prj" filename extension.

Relative paths are resolved relative to the location of the electric current model, or the user's home directory if the current model hasn't been saved yet.

The GIS extension does not support all WKT coordinate systems and projections. Only geographic ("GEOGCS") and projected ("PROJCS") coordinate systems are supported. For projected coordinate systems, simply the post-obit projections are supported:

  • Albers_Conic_Equal_Area
  • Lambert_Conformal_Conic_2SP
  • Polyconic
  • Lambert_Azimuthal_Equal_Area
  • Mercator_1SP
  • Robinson
  • Azimuthal_Equidistant
  • Miller
  • Stereographic
  • Cylindrical_Equal_Area
  • Oblique_Mercator
  • Transverse_Mercator
  • Equidistant_Conic
  • hotine_oblique_mercator
  • Gnomonic
  • Orthographic

See remotesensing.org for a consummate listing of WKT projections and their parameters.

gis:ready-coordinate-system

gis:prepare-coordinate-arrangement organisation

Sets the global projection used for projecting or re- projecting GIS data as it is loaded. The system must be either a string in Well-Known Text (WKT) format, or a NetLogo listing that consists of WKT converted to a list by moving each keyword inside its associated brackets and putting quotes around it. The latter is preferred because it makes the lawmaking much more readable.

The same limitations on WKT support apply as described to a higher place in the documentation for load-coordinate-arrangement

gis:projection-lat-lon

gis:project-lat-lon latitude longitude

          Report the position, in NetLogo space, of the given latitude and longitude pair co-ordinate to the current map projection and transformation.   Like the `location-of` primitive, the reported xcor and ycor values are reported in a two-item list of `[xcor ycor]`  and an empty list if the specified point is exterior of  the bounds of the netlogo earth.  For instance: ``` let location-of-abbey-road-studios gis:project-lat-lon 51.5320787 -0.1802646 allow abbey-route-xcor particular 0 location-of-abbey-route-studios let abbey-road-ycor particular 1 location-of-abbey-road-studios ```  Note that this primitive assumes that the given lat/lon pair  are relative to the WGS84 datum/ellipsoid. If your data is based on GPS observations or GeoJson files, and then your  data is already relative to WGS84. If yous are unsure about  what datum your data is, then yous should probably merely presume it is WGS84 and use this primitive. However, if you exercise know that your data is relative to a different datum and that extra caste of precision is of import to you lot (if you are, say, comparing values from location-of and projection-lat-lon) then you should use `project-lat-lon-from-ellipsoid` and  specify the desired datum's ellipsoid.                  

gis:projection-lat-lon-from-ellipsoid

gis:project-lat-lon-from-ellipsoid breadth longitude ellipsoid-radius ellipsoid-changed-flattening

          Study the position, in NetLogo space, of the given latitude and longitude pair according to the electric current map projection and transformation and the given ellipsoid parameters.   Similar the `location-of` primitive, the reported xcor and ycor values are reported in a two-item list of `[xcor ycor]` and an empty listing if the specified bespeak is outside of  the bounds of the netlogo earth.   The 2 defining parameters of a  ellipsoid for  the purposes of this primitive are the radius and the  inverse flattening metric. These parameters can be  hands plant by examining either the WKT definition of a given projection/datum pair or the .prj file for  the desired datum. For example, if yous open the .prj file for a shapefile exported with the WGS66 datum in a text editor,  y'all will see, somewhere in the file, this fleck of text: `DATUM["D_WGS_1966",SPHEROID["NWL_9D",6378145,298.25]]`.  If yous look at the `SPHEROID` section of that text, the outset number is the radius of that ellipoid and the  second is the inverse flattening.   Once we have these numbers, we can project data that is  relative to WGS66 like so: ``` let location gis:project-lat-lon my-lat my-lon 6378145 298.25 ```  For more than on earth ellipoids, come across: https://en.wikipedia.org/wiki/Earth_ellipsoid                  

gis:load-dataset

gis:load-dataset file

Loads the given data file, re-projecting the data as necessary.

Relative paths are resolved relative to the location of the current model, or the user's home directory if the current model hasn't been saved yet.

For ESRI shapefiles and ESRI grid files, if there is a ".prj" file associated with the file, then load-datset volition consult that file and re-projection to the current global projection if needed. If no ".prj" file is found, then the data is causeless to use the same projection equally the current global coordinate organisation.

For GeoJSON files, as per the most-recent specification (RFC 7946), the coordinate system for GeoJSON files is ever WGS84 and will be imported accordingly.

Currently, 3 types of data file are supported:

  • ".shp" (ESRI shapefile): contains vector information, consisting of points, lines, or polygons. When the target file is a shapefile, load-dataset reports a VectorDataset.
  • ".asc" or ".grd" (ESRI ASCII grid): contains raster data, consisting of a grid of values. When the target file is an ASCII grid file, load-dataset reports a RasterDataset.
  • ".geojson" or ".json" (GeoJSON): contains vector data similar to shapefiles and similarly reports a VectorDataset.

Note that not all aspects of the GeoJSON standard are supported. In particular, to be properly imported, a GeoJSON file must satisfy the following:

  • It only contain numeric or string data within the properties. all other json data volition be stringified.
  • All "Features" within a "FeatureCollection" must be of the same shape type ("Signal", "LineString", etc.) Additionally, if not all the "Features" in the "FeatureCollection" have the same set of property names, default values volition exist supplied where there are missing entries (0 for numbers and "" for strings.)
  • It must not use "GeometryCollection", which is not supported

Elevation/Z information is partially supported. For both .geojson and .shp files, single points with Z information will have their Z coordinate moved to a new "_Z" property that tin can be accessed with gis:property-value like any other belongings. Whatever Z information for other shape types will be discarded upon import.

gis:store-dataset

gis:store-dataset dataset file

Exports the given dataset to the given file.

For VectorDatasets, ii file formats are supported, ESRI shapefiles and GeoJSON. If the given file name ends in ".geojson" or ".json", and so the file will be exported as a GeoJSON file. If the file name ends in whatever other extension or no extension at all, the dataset will be exported as a shapefile and the associated file extensions will be supplied (".shp", ".prj", etc.)

For RasterDatasets, only ESRI ASCII grid files are supported and the associated file extensions will be automatically supplied.

Relative paths are resolved relative to the location of the electric current model, or the user's abode directory if the current model hasn't been saved yet.

gis:type-of

gis:blazon-of dataset

Reports the type of the given GIS dataset: either "VECTOR" or "RASTER"

gis:patch-dataset

gis:patch-dataset patch-variable

Reports a new raster whose cells correspond directly to NetLogo patches, and whose prison cell values consist of the values of the given patch variable. This archaic is basically the changed of utilise-raster; apply-raster copies values from a raster dataset to a patch variable, while this primitive copies values from a patch variable to a raster dataset.

gis:turtle-dataset

gis:turtle-dataset turtle-set

Reports a new, point VectorDataset built from the turtles in the given agentset. The points are located at locations of the turtles, translated from NetLogo infinite into GIS space using the current coordinate transformation. And the dataset's properties consist of all of the turtle variables common to every turtle in the agentset.

gis:link-dataset

gis:link-dataset link-set

Reports a new, line VectorDataset built from the links in the given agentset. The endpoints of each line are at the location of the turtles connected past each link, translated from NetLogo space into GIS space using the current coordinate transformation. And the dataset's backdrop consist of all of the link variables mutual to every link in the agentset.

gis:shape-type-of

gis:shape-type-of VectorDataset

Reports the shape type of the given dataset. The possible output values are "POINT", "LINE", and "POLYGON".

gis:property-names

gis:belongings-names VectorDataset

Reports a list of strings where each string is the proper noun of a property possessed by each VectorFeature in the given VectorDataset, suitable for use in gis:property-value.

gis:feature-list-of

gis:feature-list-of VectorDataset

Reports a list of all VectorFeatures in the given dataset.

gis:vertex-lists-of

gis:vertex-lists-of VectorFeature

Reports a listing of lists of Vertex values. For point datasets, each vertex listing volition incorporate exactly 1 vertex: the location of a point. For line datasets, each vertex list volition contain at least two points, and will represent a "polyline", connecting each adjacent pair of vertices in the list. For polygon datasets, each vertex list will contain at least three points, representing a polygon connecting each vertex, and the showtime and last vertices in the list will be the aforementioned.

gis:centroid-of

gis:centroid-of VectorFeature

Reports a single Vertex representing the centroid (middle of gravity) of the given feature. For indicate datasets, the centroid is defined equally the average location of all points in the feature. For line datasets, the centroid is defined every bit the average of the locations of the midpoints of all line segments in the feature, weighted by segment length. For polygon datasets, the centroid is defined as the weighted sum of the centroids of a decomposition of the surface area into (possibly overlapping) triangles. See this FAQ for more than details on the polygon centroid algorithm.

gis:random-betoken-inside

gis:random-point-inside VectorFeature

Reports a single randomly-generated Vertex that lies within the given feature polygon. Generated points are uniformly distributed within the polygon and both polygon holes and multi-polygon features are supported.

          ; create 100 turtles randomly distributed throught a VectorFeature `vf` crt 100 [   let loc gis:location-of gis:random-point-within vf   prepare xcor particular 0 loc   ready ycor detail one loc ]                  

gis:location-of

gis:location-of Vertex

Reports a two-element list containing the 10 and y values (in that order) of the given vertex translated into NetLogo world space using the electric current transformation, or an empty listing if the given vertex lies exterior the NetLogo world.

gis:fix-holding-value

gis:set-belongings-value VectorFeature property-proper name value

Sets the value of the given belongings of the given VectorFeature. The type of the given value (string or number) must match the property blazon of the VectorFeature. This command may exist used in conjunction with shop-dataset to make changes to VectorFeatures and consign them dorsum as GIS datasets.

gis:property-value

gis:belongings-value VectorFeature belongings-name

Reports the value of the property with the given proper name for the given VectorDataset. The reported value may be a number, a string, or a boolean value, depending on the type of the field in the underlying data file.

For shapefiles, values from dBase Character and DATE fields are returned equally strings, values from NUMBER and Float fields are returned every bit numbers, and values from LOGICAL fields are returned as boolean values. MEMO fields are non supported. Engagement values are converted to strings using ISO 8601 format (YYYY-MM-DD).

gis:find-features

gis:find-features VectorDataset property-name specified-value

Reports a listing of all VectorFeatures in the given dataset whose value for the property belongings-name matches specified-value (a string or number).

For strings, value comparing is not case sensitive, and the wildcard character "*" will lucifer any number of occurrences (including zero) of any graphic symbol.

For numbers, beware that at that place are some numbers that are also large to be represented as an integer in NetLogo, so integer data imported into NetLogo may start to lose precision if they are larger than effectually 10^xiv.

gis:detect-one-feature

gis:notice-one-characteristic VectorDataset property-name specified-value

Reports the first VectorFeature in the dataset whose value for the property belongings-proper name matches the given cord or number. Reports nobody if no matching VectorFeature is found.

For strings, Value comparison is non instance sensitive, and the wildcard character "*" will match whatever number of occurrences (including zippo) of any grapheme. Features are searched in the order that they appear in the information file that was the source of the dataset, and searching stops equally soon as a match is found.

For numbers, beware that there are some numbers that are besides big to be represented as an integer in NetLogo, and then if you want to be able to identify features based on a unique ID, keep the IDs you apply on the relatively small side to play it safe. Any number that tin fit into a 32 bit unsigned integer will work, just whatsoever larger than x^14 and you could run into issues. (Helpfully, the NetLogo app will warn you if you try to type one of these too-large numbers into the editor if you want to check.)

gis:find-less-than

gis:find-less-than VectorDataset holding-name value

Reports a list of all VectorFeatures in the given dataset whose value for the property property-name is less than the given value. String values are compared using case-sensitive lexicographic club as defined in the Coffee Documentation. Using a cord value for a numeric property or a numeric value for a string property will cause an error.

gis:find-greater-than

gis:find-greater-than VectorDataset property-proper noun value

Reports a listing of all VectorFeatures in the given dataset whose value for the holding property-name is greater than the given value. String values are compared using case-sensitive lexicographic order as divers in the Java Documentation. Using a string value for a numeric holding or a numeric value for a string property will crusade an error.

gis:observe-range

gis:find-range VectorDataset holding-name minimum-value maximum-value

Reports a list of all VectorFeatures in the given dataset whose value for the belongings property-proper name is strictly greater than minimum-value and strictly less than maximum-value. String values are compared using case-sensitive lexicographic order every bit defined in the Coffee Documentation. Using a string value for a numeric property or a numeric value for a string belongings will cause an error.

gis:property-minimum

gis:holding-minimum VectorDataset property-name

Reports the smallest value for the given property over all of the VectorFeatures in the given dataset. String values are compared using case-sensitive lexicographic society as defined in the Java Documentation.

gis:property-maximum

gis:property-maximum VectorDataset property-name

Reports the largest value for the given property over all of the VectorFeatures in the given dataset. String values are compared using case-sensitive lexicographic order as defined in the Coffee Documentation.

gis:utilize-coverage

gis:apply-coverage VectorDataset property-name patch-variable

Copies values from the given property of the VectorDataset's features to the given patch variable. The dataset must be a polygon dataset; points and lines are not supported.

For each patch, it finds all VectorFeatures that intersect that patch. Then, if the holding is a string property, it computes the bulk value by computing the total area of the patch covered by VectorFeatures having each possible value of the property, then returning the value which represents the largest proportion of the patch area. If the holding is a numeric holding, information technology computes a weighted average of belongings values from all VectorFeatures which intersect the patch, weighted by the proportion of the patch area they cover.

There are two exceptions to this default beliefs:

  • If a pct of a patches' area greater than the coverage-maximum-threshold is covered by a single VectorFeature, then the property value from that VectorFeature is copied directly. If more than i VectorFeature covers a percentage of expanse greater than the threshold, only the outset will be used.

  • If the total percentage of a patches' area covered by VectorFeatures is less than the coverage-minimum-threshold, the target patch variable is set to Non A Number.

By default, the minimum threshold is 10% and the maximum threshold is 33%. These values may be modified using the four primitives that follow.

gis:create-turtles-from-points

gis:create-turtles-from-points VectorDataset breed commands

For each point in a VectorDataset of points, create a turtle of the specified breed at the indicate's location. For each agent variable (as divers in <breeds>-own), if at that place is a property with the same name in the dataset, set that variable's value to be the value of that belongings. Finally, execute any commands in the optional control cake. To apply generic turtles as the called brood, just supply turtles as the breed argument.

Belongings names and variable names are compared instance-insensitively. Keep in listen that when importing shapefiles, property names may be modified for backwards compatibility reasons. The names given past gis:property-names tin ever exist trusted as authoritative. For manually specifying a mapping between belongings names and variable names, see the create-turtles-from-points-transmission archaic.

For multi-point datasets, a turtle is created at each indicate of multi-point feature, each with the aforementioned prepare of variable values.

Built-in variables such as "label" and "heading" are supported. NetLogo color numeric representations are supported for setting "color" and "label-color", as well as the fifteen default color string representations ("red", "bluish", "blackness", etc.).

Every bit an example: say you wanted to create a turtle of brood "cities/city" for each metropolis in a dataset of cities similar the i included in the "GIS General Examples" model from the models library. The cities dataset has four properties, "Proper name", "COUNTRY", "POPULATION", and "CAPITAL". To map them all to NetLogo turtle variables and set up their shapes to circles, yous could do this:

          extensions [gis] breed [cities city] cities-ain [name state population capital] globals [cities-dataset]  to setup   set up cities-dataset gis:load-dataset "cities.shp"   gis:create-turtles-from-points cities-dataset cities [     ready shape "circle"   ] end                  

gis:create-turtles-from-points-transmission

gis:create-turtles-from-points-manual VectorDataset breed property-mapping commands

Like create-turtles-from-points, creates a turtle for each signal in a VectorDataset of points and populates their variables with the values of corresponding gis properties.

This primitive can be used to specify additional mappings between gis property names and NetLogo variable names. These mappings are specified as a list of lists of strings similar so: [["property-name" "turtle-variable-proper name"] ["belongings-name" "turtle-variable-name"] (etc.)]

These manual mappings alter the automated mapping process that takes place in the create-turtles-from-points primitive, so you simply need to specify the changes you desire to make to the default mappings, and the rest of the mappings volition exist untouched.

To return to the cities example from the create-turtles-from-points entry, the variable name "capital" is not very descriptive. something like "is-capital?" fits the NetLogo style much better. To make that change, you lot would change the case similar and so.

          extensions [gis] breed [cities metropolis] cities-own [name land population is-capital?] globals [cities-dataset]  to setup   set cities-dataset gis:load-dataset "cities.shp"   ;; Since we only want to change how the "CAPITAL" belongings is mapped, we only demand to specify that one change.   gis:create-turtles-from-points-transmission cities-dataset cities [["Upper-case letter" "is-capital?"]] [     fix shape "circle"   ]   ;; Each city turtle withal has a name, country, and population ready just like the not-manual version. end                  

gis:create-turtles-within-polygon

gis:create-turtles-within-polygon VectorFeature breed n commands

Randomly create "n" turtles of the given brood within the given VectorFeature and for each agent variable (every bit defined in -ain), if there is a property with the same name in the dataset, set that variable's value to be the value of that property. Finally, execute any commands in the optional control cake. To use generic turtles as the called breed, simply supply turtles every bit the breed argument.

Property names and variable names are compared case-insensitively. Continue in heed that when importing shapefiles, property names may exist modified for backwards compatibility reasons. The names given by gis:property-names tin e'er be trusted as authoritative. For manually specifying a mapping between holding names and variable names, see the create-turtles-inside-polygon-manual primitive.

Built-in variables such as "label" and "heading" are supported. NetLogo color numeric representations are supported for setting "color" and "label-colour", as well as the fifteen default colour string representations ("red", "blue", "blackness", etc.).

As an case: say yous had a VectorDataset of polygons representing different zip codes within a state and you want to create 100 dissimilar turtles within each naught code and have each turtle know which zip code it originated in. The VectorDataset has a field named "zero", and then you should add a variable named "zip" to the turtles with turtles-own. Then, loop through each VectorFeature in the VectorDataset and utilise the create-turtles-inside-polygon primitive to create 100 new turtles.

          extensions [gis] globals [dataset] turtles-own [zip]  to setup   set dataset gis:load-dataset "dataset.shp"   gis:set-earth-envelope envelope-of dataset   gis:set-drawing-color red   gis:draw dataset ane    foreach gis:characteristic-listing-of dataset [ this-vector-characteristic ->     gis:create-turtles-within this-vector-feature turtles 100 [       gear up shape "person"     ]   ] end                  

gis:create-turtles-inside-polygon-manual

gis:create-turtles-inside-polygon-transmission VectorFeature brood n property-mapping commands

Like create-turtles-inside-polygon, creates "due north" different turtles within the given VectorFeature and populates their amanuensis variables with values corresponding to the holding values of the VectorFeature.

This archaic tin can be used to specify additional mappings betwixt gis property names and NetLogo variable names. These mappings are specified as a listing of lists of strings like then: [["belongings-name" "turtle-variable-name"] ["property-proper name" "turtle-variable-proper name"] (etc.)]

These manual mappings modify the automatic mapping process that takes place in the create-turtles-inside-polygon primitive, so yous just need to specify the changes y'all desire to make to the default mappings, and the residuum of the mappings volition be untouched.

See the create-turtles-from-points-manual entry for an example of how to override default mappings with manual ones.

gis:coverage-minimum-threshold

gis:coverage-minimum-threshold

Reports the current coverage minimum threshold used by gis:apply-coverage.

gis:gear up-coverage-minimum-threshold

gis:set-coverage-minimum-threshold new-threshold

Sets the electric current coverage minimum threshold to be used by gis:utilise-coverage.

gis:coverage-maximum-threshold

gis:coverage-maximum-threshold

Reports the electric current coverage maximum threshold used by gis:utilize-coverage.

gis:set-coverage-maximum-threshold

gis:set-coverage-maximum-threshold new-threshold

Sets the electric current coverage maximum threshold to be used by gis:apply-coverage.

gis:intersects?

gis:intersects? x y

Reports true if the given objects' spatial representations share at least one bespeak in mutual, and false otherwise. The objects x and y may be whatsoever one of:

  • a VectorDataset, in which example the object's spatial representation is the wedlock of all the points, lines, or polygons the dataset contains.
  • a VectorFeature, in which instance the object's spatial representation is divers by the point, line, or polygon the feature contains.
  • A turtle, in which case the spatial representation is a point.
  • A link, whose spatial representation is a line segment connecting the two points represented by the turtles the link is connecting.
  • A patch, whose spatial representation is a rectangular polygon.
  • An agentset, whose spatial representation is the matrimony of the representations of all of the agents it contains.
  • A listing containing of any of the items listed here, including another list. The spatial representation of such a list is the matrimony of the spatial representations of its contents.

gis:contains?

gis:contains? x y

Reports true if every point of y's spatial representation is also a office of x's spatial representation. Notation that this means that polygons do contain their boundaries. The objects ten and y may be any one of

  • a VectorDataset, in which case the object'southward spatial representation is the marriage of all the points, lines, or polygons the dataset contains.
  • a VectorFeature, in which instance the object's spatial representation is defined by the bespeak, line, or polygon the characteristic contains.
  • A turtle, in which example the spatial representation is a point.
  • A link, whose spatial representation is a line segment connecting the two points represented by the turtles the link is connecting.
  • A patch, whose spatial representation is a rectangular polygon.
  • An agentset, whose spatial representation is the spousal relationship of the representations of all of the agents information technology contains.
  • A listing containing of any of the items listed here, including some other listing. The spatial representation of such a listing is the union of the spatial representations of its contents.

gis:independent-by?

gis:contained-by? x y

Reports true if every point of 10's spatial representation is also a part of y'due south spatial representation. The objects x and y may be any one of:

  • a VectorDataset, in which case the object's spatial representation is the union of all the points, lines, or polygons the dataset contains.
  • a VectorFeature, in which case the object'south spatial representation is defined by the point, line, or polygon the characteristic contains.
  • A turtle, in which example the spatial representation is a point.
  • A link, whose spatial representation is a line segment connecting the two points represented by the turtles the link is connecting.
  • A patch, whose spatial representation is a rectangular polygon.
  • An agentset, whose spatial representation is the union of the representations of all of the agents it contains.
  • A list containing of any of the items listed hither, including some other listing. The spatial representation of such a listing is the union of the spatial representations of its contents.

gis:have-relationship?

gis:take-relationship? x y

Reports true if the spatial representations of the 2 objects have the given spatial relationship, and false otherwise. The spatial human relationship is specified using a Dimensionally Extended Nine- Intersection Model (DE-9IM) matrix. The matrix consists of 9 elements, each of which specifies the required relationship between the 2 objects' interior space, boundary space, or exterior space. The elements must take one of six possible values:

  • "T", significant the spaces must intersect in some way
  • "F", pregnant the spaces must not intersect in any fashion
  • "0", meaning the dimension of the spaces' intersection must exist zip (i.east., it must be a point or not-empty fix of points).
  • "1", meaning the dimension of the spaces' intersection must be one (i.e., it must be a line or non-empty set of line segments).
  • "2", meaning the dimension of the spaces' intersection must exist two (i.e., information technology must be a polygon or set of polygons whose area is greater than nada).
  • "*", meaning that the two spaces may have any relationship.

For example, this matrix:

x
Interior Boundary Exterior
y Interior T * *
Purlieus * * *
Exterior F F *

would return true if and only if some part of object ten's interior lies within object y's interior, and no part of object x's interior or boundary intersects object y's exterior. This is essentially a more restrictive form of the contains? primitive; 1 in which polygons are non considered to contain their boundaries.

The matrix is given to the have-relationship? primitive as a string, whose elements are given in the following order:

And then to use the case matrix above, you would write:

          gis:accept-human relationship? x y "T*****FF*"                  

A much more detailed and formal clarification of the DE-9IM matrix and the associated betoken-set theory tin be found in the OpenGIS Simple Features Specification for SQL.

The objects x and y may exist any ane of:

  • a VectorDataset, in which case the object's spatial representation is the union of all the points, lines, or polygons the dataset contains.
  • a VectorFeature, in which case the object's spatial representation is defined by the point, line, or polygon the feature contains.
  • A turtle, in which example the spatial representation is a point.
  • A link, whose spatial representation is a line segment connecting the two points represented by the turtles the link is connecting.
  • A patch, whose spatial representation is a rectangular polygon.
  • An agentset, whose spatial representation is the union of the representations of all of the agents it contains.
  • A listing containing of any of the items listed here, including some other list. The spatial representation of such a list is the union of the spatial representations of its contents.

gis:human relationship-of

gis:relationship-of x y

Reports the Dimensionally Extended Nine-Intersection Model (DE-9IM) matrix that describes the spatial human relationship of the 2 objects. The matrix consists of 9 elements, each of which describes the human relationship betwixt the two objects' interior infinite, purlieus space, or exterior infinite. Each element volition describe the dimension of the intersection of two spaces, pregnant that it may have 1 of 4 possible values:

  • "-ane", meaning the spaces do non intersect
  • "0", pregnant the dimension of the spaces' intersection is null (i.e., they intersect at a signal or set of points).
  • "1", significant the dimension of the spaces' intersection is ane (i.eastward., they intersect along ane or more lines).
  • "2", meaning the dimension of the spaces' intersection is two (i.e., their intersection is a non-empty polygon).

For example, the two polygons x and y shown here:

take the following DE-9IM matrix:

x
Interior Boundary Exterior
y Interior two i 2
Purlieus 1 0 1
Exterior two 1 2

Which would be reported past the human relationship-of primitive as the string "212101212".

A much more detailed and formal description of the DE-9IM matrix and the associated point-prepare theory can be found in the OpenGIS Unproblematic Features Specification for SQL.

The objects x and y may exist whatsoever i of:

  • a VectorDataset, in which example the object'southward spatial representation is the union of all the points, lines, or polygons the dataset contains.
  • a VectorFeature, in which example the object's spatial representation is defined by the bespeak, line, or polygon the characteristic contains.
  • A turtle, in which case the spatial representation is a bespeak.
  • A link, whose spatial representation is a line segment connecting the ii points represented by the turtles the link is connecting.
  • A patch, whose spatial representation is a rectangular polygon.
  • An agentset, whose spatial representation is the marriage of the representations of all of the agents it contains.
  • A list containing of whatever of the items listed here, including some other list. The spatial representation of such a list is the union of the spatial representations of its contents.

gis:intersecting

patch-set gis:intersecting data

Reports a new agent set containing only those members of the given agent set which intersect given GIS data, which may exist any one of: a VectorDataset, a VectorFeature, an Agent, an Agent Set up, or a list containing whatever of the above.

gis:width-of

gis:width-of RasterDataset

Reports the number of columns in the dataset. Notation that this is the number of cells from left to right, non the width of the dataset in GIS space.

gis:pinnacle-of

gis:height-of RasterDataset

Reports the number of rows in the dataset. Annotation that this is the number of cells from top to bottom, not the meridian of the dataset in GIS space.

gis:raster-value

gis:raster-value RasterDataset ten y

Reports the value of the given raster dataset in the given prison cell. Prison cell coordinates are numbered from left to right, and from peak to bottom, beginning with zero. And then the upper left cell is (0, 0), and the lesser right prison cell is (gis:width-of dataset - one, gis:height-of dataset - 1).

gis:set up-raster-value

gis:set-raster-value RasterDataset x y value

Sets the value of the given raster dataset at the given cell to a new value. Jail cell coordinates are numbered from left to right, and from tiptop to bottom, starting time with zip. Then the upper left cell is (0, 0), and the bottom right prison cell is (gis:width-of dataset - 1, gis:superlative-of dataset - 1).

gis:minimum-of

gis:minimum-of RasterDataset

Reports the highest value in the given raster dataset.

gis:maximum-of

gis:maximum-of RasterDataset

Reports the lowest value in the given raster dataset.

gis:sampling-method-of

gis:sampling-method-of RasterDataset

Reports the sampling method used to compute the value of the given raster dataset at a single point, or over an area smaller than a single raster cell. Sampling is performed by the GIS extension primitives raster-sample, resample, convolve, and apply-raster. The sampling method will be one of the following:

  • "NEAREST_NEIGHBOR": the value of the cell nearest the sampling location is used.
  • "BILINEAR": the value of the iv nearest cells are sampled by linear weighting, according to their proximity to the sampling site.
  • "BICUBIC": the value of the sixteen nearest cells are sampled, and their values are combined by weight according to a piecewise cubic polynomial recommended past Rifman (come across Digital Epitome Warping, George Wolberg, 1990, pp 129-131, IEEE Computer Society Press).
  • "BICUBIC_2": the value is sampled using the same process and the same polynomial as with BICUBIC in a higher place, but using a unlike coefficient. This method may produce somewhat sharper results than BICUBIC, just that upshot is data dependent.

For more information on these sampling methods and on raster sampling in general, meet this wikipedia commodity.

gis:set-sampling-method

gis:set-sampling-method RasterDataset sampling-method

Sets the sampling method used past the given raster dataset at a single indicate, or over an area smaller than a single raster cell. Sampling is performed by the GIS extension primitives raster-sample, resample, convolve, and utilise-raster. The sampling method must be one of the post-obit:

  • "NEAREST_NEIGHBOR"
  • "BILINEAR"
  • "BICUBIC"
  • "BICUBIC_2"

See sampling-method-of in a higher place for a more specific description of each sampling method.

gis:raster-sample

gis:raster-sample RasterDataset sample-location

Reports the value of the given raster over the given location. The location may exist any of the post-obit:

  • A list of length 2, which is taken to stand for a bespeak in netlogo space ([xcor ycor]) of the sort reported by location-of Vertex. The raster dataset is sampled at the point of that location.
  • A listing of length iv, which is taken to correspond an envelope in GIS infinite, of the sort reported past envelope-of. The raster dataset is sampled over the area of that envelope.
  • A patch, in which example the raster dataset is sampled over the surface area of the patch.
  • A turtle, in which instance the raster dataset is sampled at the location of that turtle.
  • A Vertex, in which case the raster dataset is sampled at the location of that Vertex.

If the requested location is exterior the expanse covered past the raster dataset, this primitive reports the special value representing "non a number", which is printed by NetLogo as "NaN". Using the special "not a number" value as an argument to primitives that expect a number may cause an error, simply you tin can test the value reported past this primitive to filter out "not a number" values. A value that is not a number will be neither less than nor greater than a number value, then you can discover "non a number" values using the post-obit:

          let value gis:raster-sample dataset turtle 0 ; set color to bluish if value is a number, red if value is "not a number" ifelse (value <= 0) or (value >= 0) [ set colour blue ] [ fix color red ]                  

If the requested location is a indicate, the sample is ever computed using the method ready by fix-sampling-method. If the requested location is an expanse (i.eastward., an envelope or patch), the sample is computed by taking the average of all raster cells covered by the requested expanse.

gis:raster-globe-envelope

gis:raster-world-envelope RasterDataset x y

Reports the GIS envelope needed to match the boundaries of NetLogo patches with the boundaries of cells in the given raster dataset. This envelope could and so be used as an argument to set-transformation-ds.

There may be more cells in the dataset than in that location are patches in the NetLogo earth. In that case, you will need to select a subset of cells in the dataset by specifying which cell in the dataset you want to match with the upper-left corner of the NetLogo world. Cells are numbered from left to correct, and from top to bottom, first with goose egg. And so the upper left cell is (0, 0), and the lesser right cell is (gis:width-of dataset - i, gis:height-of dataset - one).

gis:create-raster

gis:create-raster width height envelope

Creates and reports a new, empty raster dataset with the given number of columns and rows, covering the given envelope.

gis:resample

gis:resample RasterDataset envelope width height

Reports a new dataset that consists of the given RasterDataset resampled to cover the given envelope and to contain the given number of columns and rows. If the new raster'southward cells are smaller than the existing raster's cells, they volition be resampled using the method set by set-sampling-method. If the new cells are larger than the original cells, they will exist sampled using the "NEAREST_NEIGHBOR" method.

gis:convolve

gis:convolve RasterDataset kernel-rows kernel-columns kernel key-cavalcade key-row

Reports a new raster whose data consists of the given raster convolved with the given kernel.

A convolution is a mathematical functioning that computes each output cell by multiplying elements of a kernel with the cell values surrounding a item source cell. A kernel is a matrix of values, with i detail value divers every bit the "cardinal element", the value that is centered over the source cell corresponding to the destination cell whose value is being computed.

The values of the kernel matrix are given as a list, which enumerates the elements of the matrix from left to right, top to lesser. So the elements of a 3-by-three matrix would be listed in the following order:

The key element is specified by column and row within the matrix. Columns are numbered from left to right, beginning with zero. Rows are numbered from top to bottom, also beginning with zero. And so, for example, the kernel for the horizontal Sobel operator, which looks similar this:

i 0 -ane
ii 0
(primal)
-2
1 0 -1

would be specified as follows:

          allow horizontal-slope gis:convolve dataset three 3 [1 0 -1 2 0 -2 i 0 -1] i i                  

gis:apply-raster

gis:apply-raster RasterDataset patch-variable

Copies values from the given raster dataset to the given patch variable, resampling the raster as necessary so that its cell boundaries match up with NetLogo patch boundaries. This resampling is done every bit if using resample rather than raster-sample, for the sake of efficiency. However, patches not covered past the raster are assigned values of "not a number" in the same fashion that raster-sample reports values for locations exterior the raster.

gis:drawing-colour

gis:drawing-color

Reports the color used by the GIS extension to depict vector features into the NetLogo cartoon layer. Colour can be represented either as a NetLogo color (a single number between zero and 140) or an RGB color (a list of 3 numbers). See details in the Colors department of the Programming Guide.

gis:fix-drawing-color

gis:set-drawing-color colour

Sets the color used past the GIS extension to draw vector features into the NetLogo drawing layer. Color can be represented either as a NetLogo color (a unmarried number between nada and 140) or an RGB colour (a list of 3 numbers). Come across details in the Colors department of the Programming Guide.

gis:draw

gis:draw vector-data line-thickness

Draws the given vector data to the NetLogo drawing layer, using the current GIS drawing color, with the given line thickness. The data may consist either of an entire VectorDataset, or a single VectorFeature. This primitive draws merely the boundary of polygon data, and for bespeak data, it fills a circle with a radius equal to the line thickness.

gis:fill

gis:fill vector-data line-thickness

Fills the given vector data in the NetLogo cartoon layer using the current GIS drawing colour, using the given line thickness around the edges. The data may consist either of an entire VectorDataset, or a single VectorFeature. For indicate data, it fills a circle with a radius equal to the line thickness.

gis:pigment

gis:pigment RasterDataset transparency

Paints the given raster data to the NetLogo cartoon layer. The highest value in the dataset is painted white, the everyman is painted in blackness, and the other values are painted in shades of gray scaled linearly between white and black.

The transparency input determines how transparent the new epitome in the drawing will be. Valid inputs range from 0 (completely opaque) to 255 (completely transparent).

gis:import-wms-drawing

gis:import-wms-drawing server-url spatial-reference layers transparency

Imports an image into the NetLogo cartoon layer using the Web Mapping Service protocol, as divers past the Open Geospatial Consortium.

The spatial reference and layers inputs should be given as strings. The spatial reference input corresponds to the SRS parameter to the GetMap asking as defined in section 7.two.3.5 of version 1.1.1 of the WMS standard. The layers input corresponds to the LAYERS parameter to the equally divers in vii.2.3.3 of version 1.1.1 of the WMS standard.

You can discover the list of valid spatial reference codes and layer names by examining the response to a GetCapabilities request to the WMS server. Consult the relevant standard for instructions on how to issue a GetCapabilities request to the server and how to interpret the results.

The transparency input determines how transparent the new image in the drawing will be. Valid inputs range from 0 (completely opaque) to 255 (completely transparent).

Source: https://ccl.northwestern.edu/netlogo/docs/gis.html

Posted by: martinjusbancief.blogspot.com

0 Response to "How To Upload Gis Layers To Netlogo"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel