Issue with tileserver implementation

I am follwing Switch2OSM link (Manually building a tile server (Ubuntu 24.04) – Switch2OSM) for tileserver implementation & I am getting the following error:

root@forlinx:/run/media/mmcblk1p1/tileserver# su - _renderd -c “renderd -f -c /etc/renderd.conf”
** INFO: 14:49:55.349: Rendering daemon started (version 0.7.1)
** INFO: 14:49:55.350: Initialising request queue
** INFO: 14:49:55.350: Parsing config file: /etc/renderd.conf
** INFO: 14:49:55.351: config renderd: unix socketname=/run/renderd/renderd.sock
** INFO: 14:49:55.351: config renderd: num_threads=2
** INFO: 14:49:55.351: config renderd: num_slaves=0
** INFO: 14:49:55.351: config renderd: tile_dir=/run/media/mmcblk1p1/tileserver/tiles/
** INFO: 14:49:55.351: config renderd: stats_file=/run/renderd/renderd.stats
** INFO: 14:49:55.351: config renderd: pid_file=var/run/renderd/renderd.pid
** INFO: 14:49:55.351: config mapnik: plugins_dir=/usr/lib/mapnik/input
** INFO: 14:49:55.351: config mapnik: font_dir=/run/media/mmcblk1p1/tileserver/openstreetmap-carto/fonts/
** INFO: 14:49:55.351: config mapnik: font_dir_recurse=1
** INFO: 14:49:55.351: config renderd(0): Active
** INFO: 14:49:55.351: config renderd(0): unix socketname=/run/renderd/renderd.sock
** INFO: 14:49:55.351: config renderd(0): num_threads=2
** INFO: 14:49:55.351: config renderd(0): tile_dir=/run/media/mmcblk1p1/tileserver/tiles/
** INFO: 14:49:55.351: config renderd(0): stats_file=/run/renderd/renderd.stats
** INFO: 14:49:55.351: config renderd(0): pid_file=var/run/renderd/renderd.pid
** INFO: 14:49:55.351: config map 0: name(s2o) file(/run/media/mmcblk1p1/tileserver/openstreetmap-carto/mapnik.xml) uri(/tile/) output_format(png256) htcp() host(localhost)
** INFO: 14:49:55.351: Initialising unix server socket on /run/renderd/renderd.sock
** INFO: 14:49:55.352: Renderd is using mapnik version 3.1.0
** INFO: 14:49:55.489: Running in foreground mode…

** (process:14161): ERROR **: 14:49:55.882: An error occurred while loading the map layer ‘s2o’: Postgis Plugin: ERROR: syntax error at or near “0.001”
LINE 10: way_area/NULLIF(POW(0.0010.28,2),0) AS way_pixels,
^
in executeQuery Full sql was: ‘SELECT * FROM (SELECT
way, way_pixels,
COALESCE(wetland, landuse, “natural”) AS feature
FROM (SELECT
way,
(‘landuse_’ || (CASE WHEN landuse IN (‘forest’, ‘farmland’, ‘residential’, ‘commercial’, ‘retail’, ‘industrial’,
‘meadow’, ‘grass’, ‘village_green’, ‘vineyard’, ‘orchard’) THEN landuse END)) AS landuse,
(‘natural_’ || (CASE WHEN “natural” IN (‘wood’, ‘sand’, ‘scree’, ‘shingle’, ‘bare_rock’, ‘heath’, ‘grassland’, ‘scrub’) THEN “natural” END)) AS “natural”,
(‘wetland_’ || (CASE WHEN “natural” IN (‘wetland’, ‘mud’) THEN (CASE WHEN “natural” IN (‘mud’) THEN “natural” ELSE tags->‘wetland’ END) END)) AS wetland,
way_area/NULLIF(POW(0.0010.28,2),0) AS way_pixels,
way_area
FROM planet_osm_polygon
WHERE (landuse IN (‘forest’, ‘farmland’, ‘residential’, ‘commercial’, ‘retail’, ‘industrial’, ‘meadow’, ‘grass’, ‘village_green’, ‘vineyard’, ‘orchard’)
OR “natural” IN (‘wood’, ‘wetland’, ‘mud’, ‘sand’, ‘scree’, ‘shingle’, ‘bare_rock’, ‘heath’, ‘grassland’, ‘scrub’))
AND way_area > 0.010::real0::real
AND building IS NULL
) AS features
ORDER BY way_area DESC, feature
) AS landcover_low_zoom LIMIT 0’
encountered during parsing of layer ‘landcover-low-zoom’ in Layer of ‘/run/media/mmcblk1p1/tileserver/openstreetmap-carto/mapnik.xml’

** (process:14161): ERROR **: 14:49:55.880: An error occurred while loading the map layer ‘s2o’: Postgis Plugin: ERROR: syntax error at or near “0.001”
LINE 10: way_area/NULLIF(POW(0.0010.28,2),0) AS way_pixels,
^
in executeQuery Full sql was: ‘SELECT * FROM (SELECT
way, way_pixels,
COALESCE(wetland, landuse, “natural”) AS feature
FROM (SELECT
way,
(‘landuse_’ || (CASE WHEN landuse IN (‘forest’, ‘farmland’, ‘residential’, ‘commercial’, ‘retail’, ‘industrial’,
‘meadow’, ‘grass’, ‘village_green’, ‘vineyard’, ‘orchard’) THEN landuse END)) AS landuse,
(‘natural_’ || (CASE WHEN “natural” IN (‘wood’, ‘sand’, ‘scree’, ‘shingle’, ‘bare_rock’, ‘heath’, ‘grassland’, ‘scrub’) THEN “natural” END)) AS “natural”,
(‘wetland_’ || (CASE WHEN “natural” IN (‘wetland’, ‘mud’) THEN (CASE WHEN “natural” IN (‘mud’) THEN “natural” ELSE tags->‘wetland’ END) END)) AS wetland,
way_area/NULLIF(POW(0.0010.28,2),0) AS way_pixels,
way_area
FROM planet_osm_polygon
WHERE (landuse IN (‘forest’, ‘farmland’, ‘residential’, ‘commercial’, ‘retail’, ‘industrial’, ‘meadow’, ‘grass’, ‘village_green’, ‘vineyard’, ‘orchard’)
OR “natural” IN (‘wood’, ‘wetland’, ‘mud’, ‘sand’, ‘scree’, ‘shingle’, ‘bare_rock’, ‘heath’, ‘grassland’, ‘scrub’))
AND way_area > 0.010::real0::real
AND building IS NULL
) AS features
ORDER BY way_area DESC, feature
) AS landcover_low_zoom LIMIT 0’
encountered during parsing of layer ‘landcover-low-zoom’ in Layer of ‘/run/media/mmcblk1p1/tileserver/openstreetmap-carto/mapnik.xml’


The only difference is I am trying to implement it without systemd service that ubuntu offers. Kindly provide me a solution to overcome the above error. Thanks in advance

have you considered first following it exactly, without modifying steps?

or have you get it working with systemd?

1 Like

I’m sure I’ve answered exactly this question somewhere else already, but I can’t remember where :slight_smile:

Because sometimes things break, I’ve run through the guide again, exactly as written. As of 6th Jan 2025, it still works**.

The fact that you’re getting a Postgis error suggests to me that something below sudo -u postgres -i might have been missed. I doubt that the problem is directly related to Systemd; more likely you’ve tried to mix and match versions of things that aren’t compatible. When my renderd starts it says

renderd[17491]: ** INFO: 17:23:19.960: Rendering daemon started

it doesn’t display “(0.7.1)” like yours does, although that isn’t that old.

What are you actually trying to do and why us “systemd” something that you are trying to avoid?

** apart from the last part of the “get-fonts” script; see this issue and this PR.

Yes I have followed the guide as it is completely in an Ubuntu system & it was working… But I tried replicating it to a minimal linux buildroot based os where systemd service is not available… I got this error in that environment

The error is telling you this line makes no sense. It does indeed make no sense. What multiplied by 0.001?

Please use code mode when pasting error messages (i.e. backticks or space indents) to avoid Markdown mangling what you’ve pasted.

2 Likes

renderd parses the provided .xml file mentioned in the renderd.conf.

The provided .xml has the following lines which are sql statements:

<Parameter name="table"><![CDATA[(SELECT
    way, way_pixels,
    COALESCE(wetland, landuse, "natural") AS feature
  FROM (SELECT
      way,
      ('landuse_' || (CASE WHEN landuse IN ('forest', 'farmland', 'residential', 'commercial', 'retail', 'industrial',
                                            'meadow', 'grass', 'village_green', 'vineyard', 'orchard') THEN landuse END)) AS landuse,
      ('natural_' || (CASE WHEN "natural" IN ('wood', 'sand', 'scree', 'shingle', 'bare_rock', 'heath', 'grassland', 'scrub') THEN "natural" END)) AS "natural",
      ('wetland_' || (CASE WHEN "natural" IN ('wetland', 'mud') THEN (CASE WHEN "natural" IN ('mud') THEN "natural" ELSE tags->'wetland' END) END)) AS wetland,
      way_area/NULLIF(POW(!scale_denominator!*0.001*0.28,2),0) AS way_pixels,
      way_area
    FROM planet_osm_polygon
    WHERE (landuse IN ('forest', 'farmland', 'residential', 'commercial', 'retail', 'industrial', 'meadow', 'grass', 'village_green', 'vineyard', 'orchard')
      OR "natural" IN ('wood', 'wetland', 'mud', 'sand', 'scree', 'shingle', 'bare_rock', 'heath', 'grassland', 'scrub'))
      AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real
      AND building IS NULL
  ) AS features
  ORDER BY way_area DESC, feature
) AS landcover_low_zoom]]></Parameter>

There are some placeholders in that .xml file like scale_denominator, pixel_width etc.,
I hope these placeholder values are provided by postgis.input Mapnik plugin, which is not giving any values to that sql query, hence the line looks like below:

way_area/NULLIF(POW(0.001 0.28,2),0) AS way_pixels,

I am not sure where to check for solutions beyond this stage.
Any help would be appreciated.
And thanks for letting me know use this chat in a defined way :smile:

I have followed the below link to implement it for your reference:

Presumably you have two mapnik.xml files - one that works (in vanilla Ubuntu 24.04) and one that doesn’t (in your “minimal linux buildroot”). I’d start by looking at those - are they identical? If not, why not?

Similarly you have two databases, and can try selecting data from each that would go into landcover-low-zoom to see what the difference is.

1 Like