Changes between Initial Version and Version 2 of Ticket #17884
- Timestamp:
- Mar 12, 2012, 4:15:32 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #17884 – Description
initial v2 2 2 i'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. 3 3 My 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 5 6 CommentAddress.objects.distance(Address.objects.get(pk=1111).geopoint) 7 }}} 6 8 7 9 And it fails with : 10 {{{ 8 11 File ".../django/db/backends/postgresql_psycopg2/base.py", line 53, in execute 9 12 return self.cursor.execute(query, args) 10 13 DatabaseError: geometry_distance_spheroid: Operation on two GEOMETRIES with different SRIDs 11 14 }}} 12 15 But both are the proper srids, the problem is that the query that gets created is : 13 16 14 17 {{{ 15 18 select St_Distance_Sphere(geopoint, ST_GeomFromEWKB('\x01010000001f7932dea0670240486469f173704840'::bytea)) from frontend_commentaddress; 16 19 }}} 17 20 But when i do myself the ST_AsEWKB on the same precise object i get a very different EWKB and the query - works : 18 21 {{{ 19 22 select 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 }}} 21 24 I 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. 22 25 … … 25 28 26 29 Here are my versions and what i tried : 30 27 31 Python 2.7.1 32 28 33 Django 1.4 trunk (as of today) 34 29 35 "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 30 37 "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 31 39 both installed with homebrew. (on mac os lion)