I work in GIS with VBA. I have 2 Points layer.One of them is City points and another is hydro station points.I want write code in vba for selecting one point from station layer and finding closest city to this selected point.On the other hand I should find nearest point to a selected point. Please help me.
Asked
Active
Viewed 2,086 times
6
-
3How are the points stored? If they are simply pairs of (X, Y), just sort using the Pythagorean theorem and take the one with the shortest distance. – Adam Matan Aug 29 '10 at 10:02
3 Answers
1
Id advise searching the archvied ESRI forums as this will have been asked before.
eg1 eg2 = You should be able to pinch some code from the snippets found there to at least get you started.
jakc
- 9,858
- 8
- 49
- 97
-
-
Cool. Can you mark this as resolved please. You also failed to mark a previous Question I answered for you http://gis.stackexchange.com/questions/1340/i-want-create-a-crystal-report-in-gis-with-writing-code/1344#1344
- Can you mark that one as resolved as well please.
-
-
this would be a better answer if it included one such example snippet or conversation. We can't rely on links to external sites to remain intact, and if/when it does change this answer will become wrong. – matt wilkie Aug 30 '10 at 19:04
1
Assuming you have an ArcInfo license, have you tried calling the Near tool within your script? It sounds a lot like what you're after.
om_henners
- 15,642
- 2
- 46
- 86