Community Portal

Resolve database error when doing within lookup for specific cities

Created on Tuesday 18 May 2021, 04:51

Back to task list
  • ID
  • Project
    Metabolism of Cities Data Hub
  • Status
  • Priority
  • Type
    Programming work
  • Tags
    Data Hub Priority Plan 2021 General data hub improvements
  • Assigned to
    No one yet
  • Subscribers
    Paul Hoekman

You are not logged in

Log In Register

Please join us and let's build things, together!


There are some cities where this query creates an odd error:

country = ReferenceSpace.objects.filter(source_id=328661, geometry__contains=self.geometry)

I think it is this query, but it could also be the actual recording in the database of the result. Not totally sure yet, but it happens with three shapefiles. See this task. Good debugging steps:

  • First uncomment the exception (by ID at the top)
  • Then get one of the spaces: a = ReferenceSpace.objects.get(pk=15984)
  • Then try to get the country: a.get_country
  • You should now get the error attached

I would first try to pinpoint at what step this occurs - perhaps try to replicate the query in adminer. Then try and see if the three affected shapefiles share any characteristics. Take it from there...

Discussion and updates

New task was created