Reputation: 1876
I have a huge shapefile of 36.000 non-overlapping polygones (city boundaries). I want to easily determine the polygone into which a given lat/long falls. What would the best way given that it must be extremely computationaly efficient ?
I was thinking of creating a lookup table (tilex,tiley,polygone_id) where tilex and tiley are tile identifiers at zoom levels 21 or 22. Yes, the lack of precision of using tile numbers and a planar projection is acceptable in my application.
I would rather not use postgres's GIS extension and am fine with a program that will run for 2 days to generate all the INSERT statements.
Upvotes: 1
Views: 348
Reputation: 3526
Insert statements into what? Are you using a different spatial database or some other database? If you are willing to use python, C, or Java you could use shapely, GEOS, or JTS to write some custom code to do what you want rather simply.
In python use this lib to open the shapefile http://indiemaps.com/blog/2008/03/easy-shapefile-loading-in-python/
then shapely http://gispython.org/shapely/docs/1.0/manual.html#contains to test containment
For Java use Geotools which also includes JTS.
Upvotes: 1