Home
Learn NetLogo
What is NetLogo? Tutorial #0 Sample Model Tutorial #1 Models Tutorial #2 Commands Tutorial #3 Procedures
Documentation
NetLogo Dictionary Interface Guide Interface Tab Guide Info Tab Guide Code Tab Guide Programming Guide Transition Guide Preferences Guide Version History
Advanced Tools
Extension Manager Shapes Editor BehaviorSpace System Dynamics HubNet HubNet Authoring Logging Controlling Mathematica Link NetLogo 3D Cluster Computing (HPC)
Extensions
Extensions Guide Arduino Array Bitmap CSV GIS GoGo LevelSpace Matrix Networks Palette Profiler Python Resource Rnd Sound Simple R Table Time Vid View2.5D
FAQ
Home
Learn NetLogo
What is NetLogo? Tutorial #0 Sample Model Tutorial #1 Models Tutorial #2 Commands Tutorial #3 Procedures
Documentation
NetLogo Dictionary Interface Guide Interface Tab Guide Info Tab Guide Code Tab Guide Programming Guide Transition Guide Preferences Guide Version History
Advanced Tools
Extension Manager Shapes Editor BehaviorSpace System Dynamics HubNet HubNet Authoring Logging Controlling Mathematica Link NetLogo 3D Cluster Computing (HPC)
Extensions
Extensions Guide Arduino Array Bitmap CSV GIS GoGo LevelSpace Matrix Networks Palette Profiler Python Resource Rnd Sound Simple R Table Time Vid View2.5D
FAQ
primitive: gis:have-relationship?
GIS Extension Dictionary
  • No items found

gis:have-relationship?

gis:have-relationship? x y

Reports true if the spatial representations of the two objects have the given spatial relationship, and false otherwise. The spatial 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 two objects’ interior space, boundary space, or exterior space. The elements must have one of six possible values:

  • “T”, meaning the spaces must intersect in some way
  • “F”, meaning the spaces must not intersect in any way
  • “0”, meaning the dimension of the spaces’ intersection must be zero (i.e., it must be a point or non-empty set 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 be two (i.e., it must be a polygon or set of polygons whose area is greater than zero).
  • ”*”, meaning that the two spaces may have any relationship.

For example, this matrix:

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

would return true if and only if some part of object x’s interior lies inside 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; one in which polygons are not 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:

1 2 3
4 5 6
7 8 9

So to use the example matrix above, you would write:

gis:have-relationship? x y "T*****FF*"

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

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’s spatial representation is defined 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 union of the representations of all of the agents it contains.
  • A list containing of any of the items listed here, including another list. The spatial representation of such a list is the union of the spatial representations of its contents.

Take me to the full GIS Extension Dictionary.

GIS Extension Dictionary: find-range

Documentation for the find-range primitive.

GIS Extension Dictionary: height-of

Documentation for the height-of primitive.


NetLogo is a programmable modeling environment for simulating natural and social phenomena. It was authored by Uri Wilensky in 1999 and has been in continuous development ever since at the Center for Connected Learning and Computer-Based Modeling.

Related Links
  • NetLogo Home
  • CCL Home
  • NetLogo Web
  • NetTango Web
  • NetLogo 3D
  • BehaviorSearch
  • Contact Us

Copyright © 1999-2025 Uri Wilensky and the Center for Connected Learning and Computer-Based Modeling at Northwestern University . All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License , or (at your option) any later version.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at netlogo-commercial-admin@ccl.northwestern.edu .

For more information, visit the NetLogo website .