MaZderMind / osm-history-renderer

an experimental, work-in-progress history renderer (including supplementary tools like an importer and an animation-tool)
BSD 2-Clause "Simplified" License
79 stars 23 forks source link

RuntimeError: Postgis Plugin: ERROR: relation "hist_view_polygon" does not exist #19

Closed jgrocha closed 8 years ago

jgrocha commented 8 years ago

Hi,

I've imported the data to Postgis and it runs fine. When I run the render, I get an error.

./osm-history-renderer/importer/osm-history-importer --dsn "host=localhost dbname=agueda user=geobox password=geobox" agueda.osh.pbf
./osm-history-renderer/renderer/render.py --db "host=localhost dbname=agueda user=geobox password=geobox" --style osm-mapnik-style/osm.xml --date 2011-10-01

I get the error:

Traceback (most recent call last):
  File "./osm-history-renderer/renderer/render.py", line 280, in <module>
    main()
  File "./osm-history-renderer/renderer/render.py", line 98, in main
    render(options)
  File "./osm-history-renderer/renderer/render.py", line 113, in render
    mapnik.load_map(m, options.style)
RuntimeError: Postgis Plugin: ERROR:  relation "hist_view_polygon" does not exist
LINE 3:        from hist_view_polygon
                    ^

in executeQuery Full sql was: 'SELECT * FROM (select way,aeroway,amenity,landuse,leisure,man_made,military,"natural",power,tourism,name,highway,
       case when religion in ('christian','jewish') then religion else 'INT-generic'::text end as religion
       from hist_view_polygon
       where landuse is not null
          or leisure is not null
          or aeroway in ('apron','aerodrome')
          or amenity in ('parking','university','college','school','hospital','kindergarten','grave_yard','prison')
          or military in ('barracks','danger_area')
          or "natural" in ('field','beach','desert','heath','mud','grassland','wood','sand','scrub')
          or power in ('station','sub_station','generator')
          or tourism in ('attraction','camp_site','caravan_site','picnic_site','zoo')
          or highway in ('services','rest_area')
       order by z_order,way_area desc
      ) as leisure LIMIT 0'
  encountered during parsing of layer 'landcover' in Layer at line 341 of 'osm-mapnik-style/osm.xml'

Bu the view do exist in the database. If I copy and paste the query to pgAdmin, it runs.

I'm using: mapnik-input-plugin-postgis 2.3.0+dev20140426.git.a4985b3-1~trusty1 postgresql-9.3 "POSTGIS="2.1.2 r12389" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" LIBJSON="UNKNOWN" RASTER"

I'm trying to find the problem.

jgrocha commented 8 years ago

I was not able to isolate the problem.

MaZderMind commented 8 years ago

What you you mean by "not able to isolate"? It sounds like an issue in your postgres setup, maybe something incredibly simple like two postgres versions running on different ports or dtwo tools working in similar named but different databases, but it might also be a bug in the way the importer creates the view, especially in regard to #6

TimMarlow commented 7 years ago

Hi Guys,

I know it is an old thread, but did you find a solution? I am having a very similar issue.

File "./generate_image.py", line 42, in <module>
    mapnik.load_map(m,mapfile)
RuntimeError: Postgis Plugin: ERROR:  relation "gis_polygon" does not exist
LINE 3:        from gis_polygon
                    ^
in executeQuery Full sql was: 'SELECT * FROM (select way,aeroway,amenity,landuse,leisure,man_made,military,"natural",power,tourism,name,highway,
       case when religion in ('christian','jewish') then religion else 'INT-generic'::text end as religion
       from gis_polygon
       where landuse is not null
          or leisure is not null
          or aeroway in ('apron','aerodrome')
          or amenity in ('parking','university','college','school','hospital','kindergarten','grave_yard','prison')
          or military in ('barracks','danger_area')
          or "natural" in ('field','beach','desert','heath','mud','grassland','wood','sand','scrub')
          or power in ('station','sub_station','generator')
          or tourism in ('attraction','camp_site','caravan_site','picnic_site','zoo')
          or highway in ('services','rest_area')
       order by z_order,way_area desc
      ) as leisure LIMIT 0'
  encountered during parsing of layer 'landcover' in Layer at line 341 of 'osm.xml'
MaZderMind commented 7 years ago

@TimMarlow haven't looked at this project for years, but gis* sounds wrong. The Script generates a postgresql-view, named something like hist, for rendering. This view is then a slice in time on which the rendering is performed. So I'd expect the style access some table named hist_, not gis_*.

On the other hand, this is a bug-tracker, not a user-question forum. You probably get a better answer on the osm-dev Mailinglist.

TimMarlow commented 7 years ago

Hi @MaZderMind

Thanks for responding, I have managed to sort this, apologies for not updating the thread.

The issue was caused by my typo when setting up mapnik-stylesheets, I entered the wrong prefix for the DB tables in /inc/datasource-settings.xml, confusing it with my DB name. Hence, when running generatetiles.py it was looking for tables that started `gisrather than the default ofplanet_osm`.

I don't seem able to close this as I guess it isn't mine to close, but consider the matter sorted.