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
- Host: GitHub
- URL: https://github.com/gabrielczar/mapmatching
- Owner: GabrielCzar
- License: mit
- Created: 2018-01-08T08:42:49.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-09-08T00:11:30.000Z (almost 4 years ago)
- Last Synced: 2025-04-09T18:05:49.255Z (about 1 year ago)
- Topics: graphhopper, java-8, jitpack, map-matching, postgis
- Language: Java
- Homepage: https://jitpack.io/#GabrielCzar/MapMatching
- Size: 15.9 MB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Map Matching
[](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';
```