Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

A ranking algorithm I'm developing for a Django webapp requires performing spatial operations (within, intersections, sym_difference, etc.) using a query against large number of geometry objects.

Presently, the algorithm is very time-consuming, and the profiler reveals that the bottleneck is django.contrib.gis.geos.prototypes.threadsafe.__call__, which are called by virtually every methods in GEOSGeometry. From what I understand, threadsafe.py is a wrapper to the underlying GEOS's threadsafe API.

In this case the threadsafe-checking presents huge overhead to the computation time. Also my computation is strictly single threaded. From these reasons, I wonder is it possible to bypass or avoid the thread-safety checking performing by Django's GEOS API?

share|improve this question
    
try contacting the people in ticket #10923 –  Mike T Jul 12 '11 at 21:32
add comment

1 Answer 1

If you have one target geometry with a batch of many test geometries, try using a prepared geometry. See this page for a good description of a prepared geometry.

share|improve this answer
    
+1 "Prepared geometry" is a crucial concept for efficient GIS analysis; it's nice to see it getting implemented somewhere! –  whuber Jul 12 '11 at 13:32
    
I use PreparedGeometry for spatial predicate methods in my algorithm as well. The performance bottleneck, however, are mainly from topological methods (e.g. intersection, sym_difference), in which PreparedGeometry does not support. The algorithm needs these topological methods to find area of intersection, for instance. –  ejel Jul 12 '11 at 16:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.