-
Notifications
You must be signed in to change notification settings - Fork 16
Introduce new node types
This is a guide to understand the process of introducing new node types to the wheelmap project, for this we need:
- node_types categories & tags
- translations
- icons
-
Product manager (Sozialhelden) will provide a list of:
- openstreetmap categories
- openstreetmap tags
- mapicons
that need to be introduced into the wheelmap project.
- Search and find tags that are used by openstreetmap: http://tagfinder.herokuapp.com/
- Search for appropriate marker icons & generate custom colors here: https://mapicons.mapsmarker.com/category/markers/
- Add the new icons to the folder
app/assets/images/icons
# a sprite will be generated automatically by compass which will then be precompiled during the deployment process
- Generate icons zip with the rake task:
bundle exec rake assets:create_zip
_# this will create the file in thepublic/
folder that is referenced by all other devices, e.g. mobile clients
Find more infos here
- Add the new keys & values to the resource file
categories.yml
(EN) # this file is needed to start the transifex translation process - Add the new keys and values to
fixtures/node_types.yml
for tests
Note: Please consider to translate the german files before hand, if possible and if there aren't many words to translate in german, this way you could prevent displaying messages that are shown to the user similar to:
translation missing: de.community_support_form.new.form.submit_button
- After
OK
from product manager fetch the new translations from transifex with:tx pull
- Generate i18n js files with
bundle exec rake i18n:js:export
after importing the new translations
- Add new node types categories to the seed.rb file.
Attention: Make sure to empty your local database to prevent duplicates before seeding data from db/seed.rb
file into the database.
- push to github to check in node_types, translations and icons
If your database is not empty, don't seed from the seed.rb
file, add the new categories manually to the database instead by running following example in the rails console:
public_transfer = Category.find_by_identifier('public_transfer')
NodeType.create([
{category: public_transfer, identifier: :bicycle_rental, osm_key: 'amenity', osm_value: 'bicycle_rental', icon: 'cycling.png'},
{category: public_transfer, identifier: :parking, osm_key: 'amenity', osm_value: 'parking', icon: 'parking.png'}
])
Example to check via sql queries in the database if the new node types have been created, limit and order them:
SELECT osm_id, created_at FROM pois WHERE node_type_id IN (SELECT id FROM node_types WHERE DATE(created_at) = '2016-11-29') ORDER BY created_at DESC LIMIT 100;
Currently the planet importer (worker) syncs only the latest changes that have been made on osm after the new node types have been introduced to wheelmap (maybe also a few changes before the introduction). This means you have to import the osm node edits manually to the wheelmap database.
-
Download the planet files from:
-
Filter the node types from the planet file and write to a separate file (example):
$ osmosis --read-pbf-fast file=planet.pbf workers=<no_of_cpu> \ --tag-filter reject-relations \ --tag-filter reject-ways \ --tag-filter accept-nodes sport=arena,swim amenity=* leisure=* \ --write-xml file=filtered.osm.xml.bz2
-
Log into the server, go to current release and get the new file (filtered.osm.xml.bz2) onto the server with
scp
-
Import the file with a rake task (example):
$ bzcat filtered.osm.xml.bz2 | RAILS_ENV=staging bundle exec rake osm:import