geodjango admin : An error occurred when transforming the geometry to the SRID of the geometry

436 views Asked by At

When adding geometry in my database via the admin form I get this error: "An error occurred when transforming the geometry to the SRID of the geometry"

Proj4 and geos lib are installed and I'm using postgres/postgis database. My geom field is in EPSG 27563 ... I'm using default openlayers map. I have mod wsgi installed to run django through apache. Also I have python 2.7, 3.2 and 3.3 installed... I am using 3.3 but I don't know neither how to install geo librairies specificaly for python 3.3... This might create conflicts ?

If I change the SRID of the map in /usr/local/lib/python3.3/dist-packages/django/contrib/gis/admin/options.py, my geom is recorded but I don't have fonctionnal minimap so my geometric entity is somewhere in the world but not where it supposed to be...

I've tried to change the line : self.srid = kwargs.pop('srid', None) in /usr/local/lib/python3.3/dist-packages/django/contrib/gis/forms/fields.py as django's documentation said but I do not know how and if it's the right way (source).

Thanks in advance

1

There are 1 answers

0
HydrUra On BEST ANSWER

Proj4 and Geos Lib was not properly installed ! It's simplier when you just do that :

sudo apt-get install binutils libproj-dev gdal-bin 

As the official doc said before this line : "On Debian/Ubuntu, you are advised to install the following packages which will install, directly or by dependency, the required geospatial libraries:" Then you're sure everything is correctly installed

Source : lien