An open API service indexing awesome lists of open source software.

https://github.com/gabrielczar/mapmatching

App for Trajectories Map Matching
https://github.com/gabrielczar/mapmatching

graphhopper java-8 jitpack map-matching postgis

Last synced: 4 months ago
JSON representation

App for Trajectories Map Matching

Awesome Lists containing this project

README

          

# Map Matching
[![](https://jitpack.io/v/GabrielCzar/MapMatching.svg)](https://jitpack.io/#GabrielCzar/MapMatching)

#### ADICIONANDO A DEPENDÊNCIA:
To make a library available, a Jitpack platform will be used, which shares a more original version of the repository.

- Add the repository in ```pom.xml```:

```xml


jitpack.io
https://jitpack.io

```

- Add the dependency in ```pom.xml```:

```xml

com.github.gabrielczar
MapMatching
1.3.0

```


Using Docker Container Postgres



- Create local to save postgres data

```docker volume create pg_data```

- Create instance posgres with postgis extension
```shell
docker run --name=trajectory-data-postgis -d -e POSTGRES_USER=postgres -e POSTGRES_PASS=postgres -e POSTGRES_DBNAME=trajectory-data -e ALLOW_IP_RANGE=0.0.0.0/0 -p 5432:5432 -v pg_data:/var/lib/postgresql --restart=always kartoza/postgis:9.6-2.4
```


Extra Queries

#### Create table

- Create table to save output
```sql
CREATE TABLE matched_points (
id serial primary key,
natural_id integer,
datetime timestamp,
longitude double precision,
latitude double precision,
edge_id bigint,
offset double precision,
geometry point
);
```

- Create table with content
```sql
CREATE TABLE dataset (
id serial primary key,
natural_id integer,
datetime timestamp,
longitude double precision,
latitude double precision
);
```

#### Aditional columns

- Add column for geometry
```sql
ALTER TABLE dataset ADD COLUMN geom GEOMETRY;
```

- Add aditional column for serial id in dataset
```sql
ALTER TABLE dataset ADD COLUMN ID SERIAL PRIMARY KEY;
```

#### Aditional update values

- Create geometrys for each dataset location
```sql
update dataset
set geom = ST_SetSRID(ST_MakePoint(t.long, t.lat), 4326)
from (
select id, longitude as long,
latitude as lat from dataset) as t
WHERE t.id = dataset.id;
```

#### Aditional queries

- Search by date interval
```sql
SELECT * FROM dataset WHERE date_time::date >= date '2008-02-02' AND date_time::date < date '2008-02-03';
```