#34607: function st_geomfromwkb(bytea) does not exist - geodjango tutorial
-------------------------------------+-------------------------------------
Reporter: bjoh-01 | Owner: nobody
Type: | Status: new
Uncategorized |
Component: GIS | Version: 4.2
Severity: Normal | Keywords: geodjango, postgis
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I'm encountering some issues when trying to follow the world app geodjango
tutorial step by step as documented:
[https://docs.djangoproject.com/en/4.2/ref/contrib/gis/tutorial/]
I had trouble with this error when trying to complete the layermapping
step:
[https://docs.djangoproject.com/en/4.2/ref/contrib/gis/tutorial/#layermapping]
So I skipped that and encountered it again when trying the spatial
lookups: [https://docs.djangoproject.com/en/4.2/ref/contrib/gis/tutorial
/#spatial-lookups]
ogrinspect worked so I assume I have geos and gdal libraries configured
correctly. My database is confirmed to have POSTGIS 3.0.
[https://docs.djangoproject.com/en/4.2/ref/contrib/gis/tutorial/#spatial-
lookups]
Traceback:
{{{
(InteractiveConsole)
>>> pnt_wkt = "POINT(-95.3385 29.7245)"
>>> from world.models import WorldBorder
>>> WorldBorder.objects.filter(mpoly__contains=pnt_wkt)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/query.py", line 1436, in filter
return self._filter_or_exclude(False, args, kwargs)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/query.py", line 1454, in _filter_or_exclude
clone._filter_or_exclude_inplace(negate, args, kwargs)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/query.py", line 1461, in
_filter_or_exclude_inplace
self._query.add_q(Q(*args, **kwargs))
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/sql/query.py", line 1502, in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/sql/query.py", line 1533, in _add_q
child_clause, needed_inner = self.build_filter(
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/sql/query.py", line 1383, in build_filter
lookups, parts, reffed_expression = self.solve_lookup_type(arg,
summarize)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/sql/query.py", line 1193, in solve_lookup_type
_, field, _, lookup_parts = self.names_to_path(lookup_splitted,
self.get_meta())
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/sql/query.py", line 1681, in names_to_path
raise FieldError(
django.core.exceptions.FieldError: Cannot resolve keyword 'mpoly' into
field. Choices are: area, fips, geom, id, iso2, iso3, lat, lon, name,
pop2005, region, subregion, un
>>> WorldBorder.objects.filter(geom__contains=pnt_wkt)
Traceback (most recent call last):
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedFunction: function st_geomfromewkb(bytea) does
not exist
LINE 1: ...er" WHERE ST_Contains("world_worldborder"."geom", ST_GeomFro...
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/query.py", line 374, in __repr__
data = list(self[: REPR_OUTPUT_SIZE + 1])
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/query.py", line 380, in __len__
self._fetch_all()
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/query.py", line 1881, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/query.py", line 91, in __iter__
results = compiler.execute_sql(
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/models/sql/compiler.py", line 1560, in execute_sql
cursor.execute(sql, params)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/utils.py", line 102, in execute
return super().execute(sql, params)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: function st_geomfromewkb(bytea) does not
exist
LINE 1: ...er" WHERE ST_Contains("world_worldborder"."geom", ST_GeomFro...
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34607>
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 on the web visit
https://groups.google.com/d/msgid/django-updates/010701886d2f033a-2d406c02-6fdb-41cd-bcbf-db094634417c-000000%40eu-central-1.amazonses.com.