# [✓] Find all ZipCodes within 5 miles of a KML line?

Posted 1 year ago
1444 Views
|
5 Replies
|
4 Total Likes
|
 I drew a line using Google Earth. I saved it as "Line2.kml" (not kmz). I uploaded it to Wolfram Programming Lab.I can successfully import the line into Wolfram: kml1 = Import["Line2.kml", "Graphics"]; I can find all of the zip codes within 5 miles of a single point: zipCodeList = GeoEntities[GeoDisk[GeoPosition[{46.73333672951149,-117.009711345202,0}], Quantity[5, "Miles"]], "ZIPCode"] Is there a way to find all of the zip codes within 5 miles of all of the points? Attachments:
5 Replies
Sort By:
Posted 1 year ago
 Could use brute force by finding them for a set of points on the line that have smallish gaps between neighbors.
Posted 1 year ago
 It looks like the correct term I should have used is Path, not Line. It consists of about 240 points.I like the concept of separating out individual points, finding the ZipCodes near each point, and eliminating the duplicate ZipCodes.I do not understand the data structure of my variable "kml1". [I am much more at home with languages that require exact variable types to be declared in advance.]Is there a way to loop through all Points in variable "kml1" and execute code on each point?
Posted 1 year ago
 Perhaps this is of some help. To find nearest cities within 5ml is much easier. And then to find ZIPs for every city is also easy. data = Import["Line2.kml", "Data"] pos = First[Cases[data, _GeoPosition, Infinity]] cits = GeoNearest[Entity["City"], pos, {All, Quantity[5, "Miles"]}] EntityValue[cits, "ZIPCodes"]