[postgis-users] Spatial index and coordinate transform ?
autisi at yahoo.com
Tue Aug 11 01:57:59 PDT 2009
I have a data set in wgs 84 (lon & lat) that has a spatial index, I intend to run a nearest neighbour querywith a search radius specified in meter. So in my query i transformed the data to UTM. The following query worked successfully
select gid, road_name, town, AsText(the_geom) as geo, ST_Distance(ST_Transform(the_geom, 26331), ST_Transform(setsrid(makepoint(3.3315343, 6.5593127), 4326), 26331)) as dist from lagos84where expand(ST_Transform(setsrid(makepoint(3.3315343, 6.5593127), 4326), 26331), 5) && ST_Transform(the_geom, 26331)order by distlimit all;
When I transformed the data to UTM and I ran a similar query (without the ST_Transform function) it ran faster obviously because of the absence ofthe ST_Transform operation. Based on my requirements, I might have no option but to leave my data in wgs 84 (lon & lat). My question is this:
1. As a result of the coordinate transformation, did the query above still use the spatial index ? Since the spatial index was built with the data in wgs 84 (lon & lat)
2. is the d spatial index dependent on coordinate system ?
3. what happens during a coordinate transformation ( ST_Transform( ) ) ? is the spatial index rebuilt ?
I know spatial indexes are built based on mbb's so i am just curious.
I would also appreciate it if one has better query to meet this requirement.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the postgis-users