#36001: error GDAL_ERROR 1: b'PROJ: proj_create_from_database: crs not found' 
with
custom CRS in spatial_ref_sys
-------------------------------------+-------------------------------------
     Reporter:  Alex                 |                    Owner:  (none)
         Type:  Bug                  |                   Status:  closed
    Component:  GIS                  |                  Version:  4.2
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  gdal, proj4,         |             Triage Stage:
  postgis                            |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Alex):

 >You could always reopen this ticket if you find the problem comes from
 Django.
 Yes, it's Django bug

 i've patch file srs.py from line 72
 
[https://github.com/django/django/blob/6f38697f90a14f1450a71c1e40aea0f5df7dca86/django/contrib/gis/gdal/srs.py#L72]
 like that
 {{{#!python
         elif isinstance(srs_input, str):
             try:
                 # If SRID is a string, e.g., '4326', then make acceptable
                 # as user input.
                 logger.info(f"DJANGO HACK: just view srs_input:
 {srs_input}")
                 if srs_input == '300001' or srs_input == 'USER:300001' or
 srs_input == 300001:
                     logger.info(f"DJANGO HACK: 300001")
                     srs_input = "USER:300001"
                 else:
                     srid = int(srs_input)
                     srs_input = "EPSG:%d" % srid
             except ValueError:
                 pass
         elif isinstance(srs_input, int):
             # EPSG integer code was input.
             logger.info(f"DJANGO HACK: just view srs_input: {srs_input}")
             if srs_input == 300001:
                 srs_type = "user"
             else:
                 srs_type = "epsg"
 }}}

 and as result - errors gone

 {{{
 INFO 2024-12-12 15:45:49,385 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 4326
 INFO 2024-12-12 15:45:49,386 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 300001
 INFO 2024-12-12 15:45:49,386 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 300001
 INFO 2024-12-12 15:45:49,389 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 4326
 INFO 2024-12-12 15:45:49,389 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 4326
 INFO 2024-12-12 15:45:49,389 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 300001
 INFO 2024-12-12 15:45:49,390 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 300001
 INFO 2024-12-12 15:45:49,393 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 4326
 INFO 2024-12-12 15:45:49,393 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 4326
 INFO 2024-12-12 15:45:49,393 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 300001
 INFO 2024-12-12 15:45:49,394 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 300001
 INFO 2024-12-12 15:46:25,476 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 4326
 INFO 2024-12-12 15:46:25,476 srs 2558856 139853388865600 DJANGO HACK: just
 view srs_input: 3857
 }}}


 == conclusion
 Django not allow to work with non EPSG Coordinate systems, at all (ESRI,
 OGC, USER and other domains - good luck)
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36001#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070193baf5b4d4-0f9ddcd2-2a94-430b-9346-730ae0cda213-000000%40eu-central-1.amazonses.com.

Reply via email to