Tom.....I have a portion of code from something else I did that you can
modify and it will do what you want without having to tag each field
individually. You will need to modify it a bit.
1. To
minimize the changes you need to make first add 10 fields to the parks
layer named dist1, dist2....etc (type real)
2.
Then change view1 to "parks" and view2 to "residences" or whatever they are
actually named....
3.
Paste into immediate execution and run it and that should do the
trick
//***********************************************************
view1 = "New Layer"
view2 = "Apartments"
view2 = "Apartments"
setview(view1)
rh = getfirstrecord(view1+"|",{{"ID","Ascending"}})
rh = getfirstrecord(view1+"|",{{"ID","Ascending"}})
for i = 1 to GetRecordCount(view1,)
do
rhid = rh2id(rh)
o_pt = GetPoint(rhid)
setview(view2)
rh2 = getfirstrecord(view2+"|",{{"ID","Ascending"}})
for j = 1 to GetRecordCount(view2,) do
rhid2 = rh2id(rh2)
d_pt = GetPoint(rhid2)
fld = "dist" + i2s(j)
setview(view1)
view1.(fld) = GetDistance(o_pt,d_pt)
setview(view2)
rh2 = GetNextRecord(view2+"|",,{{"ID","Ascending"}})
end
setview(view1)
rh = GetNextRecord(view1+"|",,{{"ID","Ascending"}})
end
o_pt = GetPoint(rhid)
setview(view2)
rh2 = getfirstrecord(view2+"|",{{"ID","Ascending"}})
for j = 1 to GetRecordCount(view2,) do
rhid2 = rh2id(rh2)
d_pt = GetPoint(rhid2)
fld = "dist" + i2s(j)
setview(view1)
view1.(fld) = GetDistance(o_pt,d_pt)
setview(view2)
rh2 = GetNextRecord(view2+"|",,{{"ID","Ascending"}})
end
setview(view1)
rh = GetNextRecord(view1+"|",,{{"ID","Ascending"}})
end
//************************************************************
If you
don't want to add the fields individually or are going to be using this more
then you may want to look at ModifyTable() in the help...this shows you how to
add fields automatically.
Good
luck..email me if you have any questions!
David Twehues
Vogt
Williams & Bowen LLC
(614)
225-9500
http://www.vwbresearch.com
-----Original Message-----I have two point layers (10 parks; 200 personal
From: Tom Shoals [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 12, 2005 12:41 AM
To: [email protected]
Subject: [Maptitude] measuring distance
residences). I am trying to find an easy way to
measure the distance from each residence to each park.
Is there an easy way to do this in Maptitude? Would a
script or macro perform this function automatically?
If so, does anyone have an example of such a script
they could share?
Thanks for the help.
Tom
__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com
Yahoo! Groups Sponsor
ADVERTISEMENT
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 the Yahoo! Terms of Service.
