On the server in the test database there is a table table with spatial data (postgis-based). The data is stored in the standard projection of WGS-84 (srid 4326). Now I need to process them and transfer them to another projection. The table with projections is called spatial_ref_sys, it is standard for postgis, but additional projections have been added to it — a srid is assigned to them and parameters are defined.
There are a lot of records in the table table, and only some of them need to be transferred to another projection. When they are filtered, I can refer to a specific geometry and transform the coordinates with the transform command:

 geom = obj.geom.transform(self.options['srid']) 

This works only if the srid standard, because, it turns out, transform refers not to the spatial_ref_sys table, but to some GDAL files. Please tell me how you can apply specifically to the projections that are stored in spatial_ref_sys.

    1 answer 1

    As indicated in the source , the ct parameter of the transform method can be not only srid , but also directly by the proj4text parameter, which is described just in the spatial_ref_sys table. You can get proj4text by contacting SpatialRefSys directly:

     from django.contrib.gis.db.backends.postgis.models import PostGISSpatialRefSys proj4 = PostGISSpatialRefSys.objects.get(srid=self.options['srid']).proj4text geom = obj.geom.transform(proj4)