NetLogo / NetLogo/GIS-Extension

Feature request: `gis:min-distance-of` primitive to compute minimum distance between GeoFeatures

Open
#52 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
36
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Summary

Add a gis:min-distance-of reporter that returns the minimum geometric distance between a target geometry (a VectorFeature or NetLogo agent with a GIS geometry) and any member of a collection (a VectorDataset or an agentset). Distance follows the units of the active GIS projection (e.g., meters if projected, degrees if unprojected lat/lon). Returns 0 when geometries touch or intersect.

This feature request builds on the work started in PR #46, and https://github.com/NetLogo/GIS-Extension/pull/17, https://github.com/NetLogo/GIS-Extension/pull/18 and https://github.com/NetLogo/GIS-Extension/pull/19, originally written by @josephzhao.

Proposed API
gis:min-distance-of <collection> <target>  ;; -> number

Parameters

  • <collection>: VectorDataset | agentset
  • <target>: VectorFeature | agent (turtle/link/patch) that has a GIS geometry

Return value

  • Minimum JTS geometry distance between <target> and any geometry in <collection>.
Example usage
extensions [ gis ]

to setup
  ca
  set roads-ds gis:load-dataset "roads.shp"
  ; ensure appropriate projection/transform is set for meaningful units
end

to-report dist-to-roads [car]
  report gis:min-distance-of roads-ds car
end

to-report nearest-obstacle-dist [peds]
  ; peds is an agentset of pedestrian turtles
  let d gis:min-distance-of peds one-of cars
  report d
end

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing PR #46 and linked PRs #17, #18, and #19 to understand the existing GIS distance and collection-handling work. Confirm the proposed NetLogo API, projection-dependent units, and zero distance for touching or intersecting geometries; done means the reporter handles VectorDataset and agentset collections with the documented target types.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.