kopia lustrzana https://github.com/hholzgra/ocitysmap
Integrate street index api + tests
rodzic
26bde42e7a
commit
ebb9e6ca01
|
|
@ -341,9 +341,8 @@ class OCitySMap:
|
|||
renderer.canvas.get_actual_bounding_box(),
|
||||
self._i18n, renderer.grid, polygon)
|
||||
|
||||
street_index_renderer = index.render.StreetIndexRenderer(self._i18n,
|
||||
# TODO: index.get_streets(), index.get_amenities())
|
||||
[], [])
|
||||
street_index_renderer = index.StreetIndexRenderer(self._i18n,
|
||||
street_index.categories)
|
||||
|
||||
try:
|
||||
for output_format in output_formats:
|
||||
|
|
@ -403,14 +402,15 @@ class OCitySMap:
|
|||
if __name__ == '__main__':
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
o = OCitySMap(['/home/sam/src/python/maposmatic/ocitysmap/ocitysmap.conf.mine'])
|
||||
o = OCitySMap([os.path.join(os.path.dirname(__file__), '..',
|
||||
'ocitysmap.conf.mine')])
|
||||
|
||||
c = RenderingConfiguration()
|
||||
c.title = 'Chevreuse, Yvelines, Île-de-France, France, Europe, Monde'
|
||||
c.osmid = -943886 # -7444 (Paris)
|
||||
c.language = 'fr_FR.UTF-8'
|
||||
c.paper_width_mm = 297
|
||||
c.paper_height_mm = 420
|
||||
c.stylesheet = o.get_stylesheet_by_name('Default')
|
||||
c.language = 'fr_FR.UTF-8'
|
||||
|
||||
o.render(c, 'plain', ['pdf'], '/tmp/mymap')
|
||||
|
|
|
|||
|
|
@ -40,7 +40,16 @@ if __name__ == '__main__':
|
|||
|
||||
random.seed(42)
|
||||
|
||||
bbox = coords.BoundingBox(48.8162, 2.3417, 48.8063, 2.3699)
|
||||
lang = "fr_FR.UTF-8"
|
||||
#lang = "ar_MA.UTF-8"
|
||||
#lang = "zh_CN.utf8"
|
||||
i18n = i18n.install_translation(lang,
|
||||
os.path.join(os.path.dirname(__file__),
|
||||
"..", "..", "locale"))
|
||||
|
||||
bbox = coords.BoundingBox(48.8162, 2.3417, 48.8063, 2.3699) # France
|
||||
#bbox = coords.BoundingBox(34.0322, -6.8648, 34.0073, -6.8133) # Moroco
|
||||
#bbox = bbox = coords.BoundingBox(22.5786, 114.0308, 22.5231, 114.1338) # CN
|
||||
|
||||
# Build the list of index items
|
||||
db = psycopg2.connect(user='maposmatic',
|
||||
|
|
@ -48,10 +57,6 @@ if __name__ == '__main__':
|
|||
host='localhost',
|
||||
database='maposmatic')
|
||||
|
||||
i18n = i18n.install_translation("fr_FR.UTF-8",
|
||||
os.path.join(os.path.dirname(__file__),
|
||||
"..", "..", "locale"))
|
||||
|
||||
street_index = StreetIndex(db, None, None, i18n, None, bbox.as_wkt())
|
||||
print street_index.categories
|
||||
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue