[postgis-users] distance_spheroid and index files

RIBOT, Nicolas nicolas.ribot at astrium.eads.net
Fri Feb 25 08:02:22 PST 2005


> which gives me all the cities in a 10 km radius around Berlin. 
> Unfortunately, this query takes several minutes as the 
> distance needs to 
> be calculated for every single city, i.e. 60000 times. I read in the 
> PostGIS documentation that this query can be optimised to use the 
> spatial index, but I can't quite figure out how to do it. If somebody 
> could help me out, I'd appreciate that.
> 

I think you should use the "&&" operator to force index usage.

Add a clause to your query to filter out geometries laying inside a 10 km
bounding box.
You are currently computing distance for each geometry even if this geometry
is far away from Berlin.

Try to build a bounding box by expanding the berlin geometry to create a
10km large rectangle.

Hope this helps, and pretty sure someone in the list will be able to show
you how to generate such a BBox for your query.

Nicolas
-------------- next part --------------
---------------------------------------------------------

CE COURRIER ELECTRONIQUE EST A USAGE STRICTEMENT INFORMATIF ET NE SAURAIT ENGAGER DE QUELQUE MANIERE QUE CE SOIT EADS ASTRIUM SAS, NI SES FILIALES.

SI UNE ERREUR DE TRANSMISSION OU UNE ADRESSE ERRONEE A MAL DIRIGE CE COURRIER, MERCI D'EN INFORMER L'EXPEDITEUR EN LUI FAISANT UNE REPONSE PAR COURRIER ELECTRONIQUE DES RECEPTION. SI VOUS N'ETES PAS LE DESTINATAIRE DE CE COURRIER, VOUS NE DEVEZ PAS L'UTILISER, LE CONSERVER, EN FAIRE ETAT, LE DISTRIBUER, LE COPIER, L'IMPRIMER OU EN REVELER LE CONTENU A UNE TIERCE PARTIE.



This email is for information only and will not bind EADS Astrium SAS in any contract or obligation, nor its subsidiaries.

If you have received it in error, please notify the sender by return email. If you are not the addressee of this email, you must not use, keep, disseminate, copy, print or otherwise deal with it.

---------------------------------------------------------


More information about the postgis-users mailing list