Thanks to Kit Baum, a new version of geoinpoly is now available on SSC.
geoinpoly is a new command on SSC that was recently announced here. geoinpoly finds, for geographic locations in memory, polygons from a shapefile that spatially overlay the points. This is a point-in-polygon operation, also known as a spatial join in GIS (geographic information system) terminology.
geoinpoly incorporates the same divide and conquer strategy used in geonear (from SSC) to significantly reduce the number of polygon segments that need to be counted. However, I wasn't completely happy with the sluggish performance of geoinpoly when a small number of points were matched to a very detailed shapefile containing lots of polygons (see this recent example using U.S. Census tracts) so I decided to completely rewrite it in Mata. I'm happy to report a 10-15x increase in performance! It can now match 1,000,000 random points to the Michigan Census Tract shapefile in the example above (made up of over 500+K line segments) in 12 seconds on my computer.
There are no other changes and the new version replicates exactly the results produced by the original version (the exact same algorithm is used).
To update to the new version, type in Stata's command window
or use
If you are a first time user, you can install it using
geoinpoly is a new command on SSC that was recently announced here. geoinpoly finds, for geographic locations in memory, polygons from a shapefile that spatially overlay the points. This is a point-in-polygon operation, also known as a spatial join in GIS (geographic information system) terminology.
geoinpoly incorporates the same divide and conquer strategy used in geonear (from SSC) to significantly reduce the number of polygon segments that need to be counted. However, I wasn't completely happy with the sluggish performance of geoinpoly when a small number of points were matched to a very detailed shapefile containing lots of polygons (see this recent example using U.S. Census tracts) so I decided to completely rewrite it in Mata. I'm happy to report a 10-15x increase in performance! It can now match 1,000,000 random points to the Michigan Census Tract shapefile in the example above (made up of over 500+K line segments) in 12 seconds on my computer.
There are no other changes and the new version replicates exactly the results produced by the original version (the exact same algorithm is used).
To update to the new version, type in Stata's command window
Code:
adoupdate geoinpoly, update
Code:
ssc install geoinpoly, replace
Code:
ssc install geoinpoly
Comment