Code

Changes between Initial Version and Version 2 of Ticket #17884


Ignore:
Timestamp:
03/12/12 14:15:32 (2 years ago)
Author:
kmtracey
Comment:

Fixed formatting, please use WikiFormatting and preview before submitting.

I don't see evidence that this is something that is a regression in Django code and therefore should be a release blocker?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #17884

    • Property Patch needs improvement unset
    • Property Needs tests unset
    • Property Needs documentation unset
  • Ticket #17884 – Description

    initial v2  
    22i've worked a lot to make this work, and i just can't figure it out right now, so i'm opening a ticket. This is related to #16778 and my point of view right now is that it's a problem about how the EWKB Binary object gets created.  
    33My problem is that, i've CommentAddress objects with PointField (srid=4326) and an Address with a PointField (srid=4326 too), i do a simple distance lookup request :  
    4  
     4{{{ 
     5#!python 
    56CommentAddress.objects.distance(Address.objects.get(pk=1111).geopoint) 
     7}}} 
    68 
    79And it fails with :  
     10{{{ 
    811  File ".../django/db/backends/postgresql_psycopg2/base.py", line 53, in execute 
    912    return self.cursor.execute(query, args) 
    1013DatabaseError: geometry_distance_spheroid: Operation on two GEOMETRIES with different SRIDs 
    11  
     14}}} 
    1215But both are the proper srids, the problem is that the query that gets created is : 
    1316 
    14  
     17{{{ 
    1518 select St_Distance_Sphere(geopoint, ST_GeomFromEWKB('\x01010000001f7932dea0670240486469f173704840'::bytea)) from frontend_commentaddress; 
    16  
     19}}} 
    1720But when i do myself the ST_AsEWKB on the same precise object i get a very different EWKB and the query - works : 
    18  
     21{{{ 
    1922select St_Distance_Sphere(geopoint, ST_GeomFromEWKB('\001\001\000\000 \346\020\000\000\037y1\336\240g\002@Hdi\361spH@'::bytea)) from frontend_commentaddress; 
    20  
     23}}} 
    2124I tried to use self._adapter.adapted (which looks really better with a H@ at the end) instead of self._adapter.getquoted() into the postgis adapter but it doesn't work as it's unicode translated into bytes... Anyway i'm missing something there and can't get it working. 
    2225 
     
    2528 
    2629Here are my versions and what i tried :  
     30 
    2731Python 2.7.1  
     32 
    2833Django 1.4 trunk (as of today) 
     34 
    2935"POSTGIS="1.5.3" GEOS="3.3.2-CAPI-1.7.2" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.3" USE_STATS (procs from 1.5 r5976 need upgrade)" 
     36 
    3037"PostgreSQL 9.1.3 on x86_64-apple-darwin10.8.0, compiled by i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664), 64-bit" 
     38 
    3139both installed with homebrew. (on mac os lion)