Serve map data for the editor.
This project uses environment variables to manage
configuration. Before running the application, make sure to create a
.env
file in the root directory based on the provided .env.example
file. You can copy the contents of .env.example
and replace the
placeholder values with your actual configuration values.
Example .env.example
file:
PORT=3000
Using NPM.
npm i
npm start
Using Yarn.
yarn install
yarn start
Install docker and docker compose and execute
docker-compose up -d
http://localhost:2999/api-docs
Using NPM.
npm test
Using Yarn.
yarn test
This applications serves the data in data/
directory in the
following endpoints:
- lines
Get all lines
GET http://localhost:2999/api/lines
- stops
Get stops for a particular line
GET localhost:2999/api/stops/Ligne_160_A
- ways
Get ways for a particular line
GET http://localhost:2999/api/ways/Ligne_160_A
- busLines
Get lines from another provider
GET http://localhost:2999/api/busLines
- lineTypes
Get different type of lines
GET http://localhost:2999/api/lineTypes
- busStops
Get bus stops from another provider
GET http://localhost:2999/api/busStops
data/antananarivo.json
was generated using the
router
/api/lines
, /api/stops/:lineName
, and /api/ways/:lineName
expose the data from it.
The data is organized in the following format:
[
{
"line_name": <line name>
"bus_stops":
[{"location": {"lat": <latitude>,
"lng": <longitude>},
"name": <bus name>,
"role": <stop role>
},
...]
"ways": [
[{"lat": <latitude>,
"lng": <longitude>},
...],
...
]
},
...
]
data/busLines.json
, data/busLines2.json
, data/lineTypes.json
and
data/busStops.json
were provided by IMV (Institut des Métiers de la
Ville). Haja Rasolofojaona contacted me and my two other teammates
(Tianasoa and Nafissa) when we were working on
BetaX and gave some data that could be used.
Institut des Métiers de la Ville (IMV) is a cooperation platform between the CUA and the Île de France region for the development of municipal capacities.
The format of the data is as following:
data/busLines.json
[
{
"color": <color>,
"itinerary":
[
places:
[
<bus stop names>,
...
]
],
"name": <line name>,
"cooperative": <cooperative name>
},
...
]
data/busLines2.json
[
"itinerary":
[
{
"type": <line type>,
"color": <color>,
places:
[
<bus stop names>,
...
],
"name": <line name>,
"cooperative": <cooperative name>
},
...
],
...
]
data/lineTypes.json
[
{
"lines":
[
<line_name>,
...
],
"type": <line type>
}
]
data/busStops.json
[
{
"lat": <latitude>,
"lng": <longitude>,
"name" <bus stop name>
},
...
]