hholzgra / ocitysmap

Fork of ocitysmap repository at savannah.nongnu.org
Other
35 stars 12 forks source link

correct way to render map with UTM Grid #49

Closed jasonblewis closed 2 years ago

jasonblewis commented 2 years ago

What is the correct way to render a map with UTM Grid? I have tried setting up a utm_grid section in the config file but it fails to render.

# excerpt of .ocitysmap.conf
...
[rendering]
# List of available stylesheets, each needs to be described by an eponymous
# configuration section in this file.
available_stylesheets: stylesheet_osm1, stylesheet_osm2
available_overlays: scalebar, compass_rose, surveillance, utm_grid

# The default Mapnik stylesheet.
[stylesheet_osm1]
name: Default
description: The default OSM style
path: /home/jason/source/openstreetmap-carto/mapnik.xml

# Another stylesheet
[stylesheet_osm2]
name: AnotherOne
description: Another OSM Stylesheet
path: /home/jason/source/mapnik-stylesheets/osm.xml
# path: /path/to/another/osm.xml

# Bundled overlay effect stylesheets
[scalebar]
name: Scale_Bar_overlay
description: Scale bar
path: internal:scalebar

[compass_rose]
name: Compass_Rose_overlay
description: Compass Rose
path: internal:compass_rose

[surveillance]
name: Surveillance_Overlay
description: Surveillance Cameras
path: internal:surveillance

[utm_grid]
name: UTM_Grid
description: UTM Grid
path: internal:utm_grid

Render with:

./render.py --overlay='UTM_Grid' --paper-format='Din A4' --title="Ceci n'est pas Paris" --osmid=-411354

Results in:

DEBUG:ocitysmap:MapCanvas rendering map on 565x744px.
DEBUG:ocitysmap:Created layer shade in PolyShapeFile /tmp/ocitysmaplhybsxin/shade.shp.
DEBUG:ocitysmap:Added shape file /tmp/ocitysmaplhybsxin/shade.shp to map canvas as layer shade.
DEBUG:ocitysmap:Cleaning up /tmp/ocitysmaplhybsxin...
Traceback (most recent call last):
  File "/home/jason/source/ocitysmap/./render.py", line 305, in <module>
    sys.exit(main())
  File "/home/jason/source/ocitysmap/./render.py", line 299, in main
    mapper.render(rc, cls_renderer.name, options.output_formats,
  File "/home/jason/source/ocitysmap/ocitysmap/__init__.py", line 586, in render
    self._render_one(config, tmpdir, renderer_cls,
  File "/home/jason/source/ocitysmap/ocitysmap/__init__.py", line 613, in _render_one
    renderer = renderer_cls(self._db, config, tmpdir, dpi, file_prefix)
  File "/home/jason/source/ocitysmap/ocitysmap/layoutlib/single_page_renderer/no_index.py", line 18, in __init__
    SinglePageRenderer.__init__(self, db, rc, tmpdir, dpi, file_prefix, None)
  File "/home/jason/source/ocitysmap/ocitysmap/layoutlib/single_page_renderers.py", line 188, in __init__
    self._overlay_effects[plugin_name] = self.get_plugin(plugin_name)
  File "/home/jason/source/ocitysmap/ocitysmap/layoutlib/abstract_renderer.py", line 328, in get_plugin
    return self.plugin_source.load_plugin(plugin_name)
  File "/usr/lib/python3/dist-packages/pluginbase.py", line 301, in load_plugin
    return __import__(self.base.package + '.' + name,
  File "/usr/lib/python3/dist-packages/pluginbase.py", line 438, in plugin_import
    return self._system_import(import_name, globals, locals,
  File "/home/jason/source/ocitysmap/ocitysmap/layoutlib/render_plugins/utm_grid/__init__.py", line 24, in <module>
    import utm
  File "/usr/lib/python3/dist-packages/pluginbase.py", line 438, in plugin_import
    return self._system_import(import_name, globals, locals,
ModuleNotFoundError: No module named 'utm'

commit a2e82e2f0cc8fe99542b5e1019d2e5ae65e2857a

hholzgra commented 2 years ago

Problem is in the INSTALL instructions, they are missing

pip3 install utm

to install the actual Python utm package / library.

(fixed now)