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]
Newton MA 02461-9926            Web site: http://www.caliper.com




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/C5grlB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/Maptitude/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to