Maptitude GISDK Help

LocateNearestRecord()

Summary

Finds the map feature nearest a point location.

 

Changes

Optional options array with Target Layer option added in Version 6.0/2012.

 

Syntax

record_handle = LocateNearestRecord(coordinate location, real search_distance [, array options])

 

Argument

Contents

location

The point at which to search

search_distance

The maximum search distance from the point, in map units

 

Option

Type

Contents

Target Layer

String

The layer to search, if other than the current layer

Target Set

String

A selection set on the current or in the Target Layer that records must be in to be selected

 

Returns

A string indicating the record handle for the nearest map feature in the current layer, or null if there is no map feature within search_distance of location.

 

Notes

Example

folder = RunMacro("G30 Tutorial Folder")

plclayer = AddLayerToWorkspace("Place",folder + "NES_PLC.CDF","Place",)

SetLayer(plclayer)

Boston = Coord(-71060500, 42358400)

rh = LocateNearestRecord(Boston, 25.0)

ShowMessage("The nearest place is " + plclayer.City)

DropLayerFromWorkspace(plclayer)

 

Error Codes

Error Type

Meaning

Error

There is no current layer, or the current layer is not a point, line or area layer

Locked

The required geographic databases are not available; most likely a time-out occurred

 

See Also

Function

Summary

LocateNearestRecords()

Finds the map features nearest a point location

LocateRecord()

Locates a record based on the value of a field

SelectByCircle()

Selects map features that are located within a circle

SelectNearestFeatures()

Selects a feature in the current layer nearest to each feature in another layer or selection set

TagLayer()

Fills a field in a layer with information about the nearest feature in another layer.

 

 

©2025 Caliper Corporation www.caliper.com