-
Notifications
You must be signed in to change notification settings - Fork 0
Detailed instructions
This page contains detailed instructions. In case you are having problems or questions with the short getting started instruction from the README file, you may find better explanations here.
For getting this API key you need to be registered on the Openroute service site.
- Follow the link https://openrouteservice.org/dev/#/signup
- On the opened site, fill all required fields and press the submit button or sign up with your GitHub account.
- After registration you may be asked to confirm your email address, so please check your email provided during the registration.
- After that you should be able to log in to your account https://openrouteservice.org/dev/#/login
- In the opened view after logging in, you can create your token(= API key) here:

- After creating your token(= API key), you can see it on your dashboard above

Read more about the Openrote service API limits and pricing here https://openrouteservice.org/plans/
For getting this API key you need to be registered on the Collect API site.
- Follow the link https://collectapi.com/auth.
- Provide your email address in the opened form and then check the email you provided.
- You should get a message and by following the instructions you will pass into your account. It is possible that your browser will not open the site, if you are pressing button in the email, try copy paste the link under the button:

- After logging in follow the link https://collectapi.com/api/gasPrice/gas-prices-api
- Choose the Pricing tab:

- Choose the plan you wish (from 08.06.2022 no free subscription) by pressing subscribe button
- After paying (if was needed) your API key may be found from the description tab:

The .env file contains settings for the application such as database information and APIs keys. Below is an explanation about each field in this file.
- DATABASE name of the database should be set to mapapp. Attention, if you wish to change this name, remember to change it also in the DBCreationScript.sql file(root folder)
- DATABASE_DIALECT dialect of your database, for example mariadb. This field is needed for the Sequalize ORM setting, read more about supported dialects here: https://sequelize.org/docs/v6/getting-started/#connecting-to-a-database. Possible values for this field are: mariadb, mysql, sqlite, postgres, mssql
- DATABASE_HOST host of the database, for example localhost
- DATABASE_PORT port of the database, for example 8081
- DATABASE_USER username of your database, for example username
- DATABASE_PASSWORD password to the username, for example password
- ORS_API_KEY Openroute service API key (=token), you should get your own from the site https://openrouteservice.org/plans/
- FUEL_API_KEY Gas Prices API key, you should get your own from the site https://collectapi.com/api/gasPrice/gas-prices-api
In the application for the routing calculation you have an option to avoid city centers. These city center areas are completely customisable. It is recommended to add city centers before the first start of the server(before calling setUp()-method). For adding city center area to the application(to the database) follow the steps:
- Go to the online GeoJSON editor site https://geojson.io/#map=2/20.0/0.0
- Zoom the city center you wish to add, for example Turku:

- From the toolbar on the right press the Polygon button

- Then draw the polygon you want to be the city center:

- On the right you can see the generated GeoJSON object code, copy all the geometry field content:

- After that go to the SettingsUtil.js file (server/util folder) and create a new object called YourCity + Center to the end of the file, for example TurkuCenter. Paste your copied Polygon object and add the field areaName, with YourCity + Center value:

- After that, go to the addCityCenters()-method and put this object to the array:

- After that go to the file index.js (server folder) and call the setUp()-method, which should be commented(or just type: await settingsUtil.setUp(); to the app.listen function):

- And finally start the server by typing node server/index.js to the terminal. If this is not the first call of setUp()-method, you will see some errors in the terminal, ignore them. Comment setUp()-method call back.
- After that you can check does center area saved by creating new route via center of the city and selecting avoid city center option or by going to the database and checking it there, for example by query: select * from area where areaName = “TurkuCenter”; You can add so many city centers as you wish.