this makes sense - thanks for your getting me started ... !
 
D


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Peter H. Van Demark
Sent: Wednesday, June 28, 2006 11:46 AM
To: [email protected]
Subject: Re: [Maptitude] Distance to the 1st and 2nd nearest road

Richard:

>One can use the tag feature to get the distance to the nearest road from a
>point, but is there a way to get the distance to the 2nd nearest road?

There are two similar GISDK functions:

- LocateNearestRecord() finds the map feature that is nearest a point
location and returns its record handle.

- LocateNearestRecords() finds the map features, within a search distance
and sorted by increasing distance, that are nearest a point location and
returns their record handles.

So, you could use the second function and:

- The new ArrayElementToString() or A2S() function to pick off the second
record handle and use it to get
- The line ID with the RecordHandleToID() or RH2ID() function, then get
- The coordinates in the line with the GetLine() function, and then get
- The distance from the point location to the line with the
GetLineDistance() function

You will need to do this with a GISDK macro, because LocateNearestRecords()
locates records in the working layer (the line layer), and you want to put
the distance into a field in the point layer. If pnt_loc is the coordinate
for the point location and search_dist is the search distance, this should
give you the distance to the second-nearest line:

arr = GetLineDistance(pnt_loc,
GetLine(RH2ID(A2S(LocateNearestRecords(pnt_loc, search_dist, ), 2))))

The first element of arr is the distance. Your hoemwork is to add the
management of looping over the points, switching the working layer to the
line layer to get the distance, and switching back to write the distance
into the point record.

Peter

----------------------------------------------------------
Peter H. Van Demark
Director of GIS Products and Training Phone: 617-527-4700
Caliper Corporation Fax: 617-527-5113
1172 Beacon Street E-mail: [EMAIL PROTECTED]com
Newton MA 02461-9926 Web site: http://www.caliper.com

__._,_.___


SPONSORED LINKS
Geographic information systems Geography game Geography


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to