| Version 2 (modified by , 30 hours ago) ( diff ) |
|---|
Advanced Concepts
Во оваа фаза од проектот, стандардниот релационен модел е надограден со просторни функционалности преку екстензијата PostGIS. Дополнително, за следење на возилата е имплементирана Lambda архитектура (Hot/Cold складирање) со 4D просторно-временски траектории (LineStringZM).
- Иницијализација на PostGIS и конверзија во полигони (Geofencing)
Првиот чекор вклучува овозможување на PostGIS екстензијата и мигрирање на постоечките координати во geometry објекти. Дополнителна промена е отфрлањето на обичните радиуси за зоните на компаниите. Наместо тоа, користејќи ја функцијата ST_Buffer, кружните области се конвертирани во прецизни полигони со што се овозможува вистинско дигитално надградување. Креирани се и GiST (Generalized Search Tree) индекси кои се потребни за брзо пребарување на просторни податоци.
create extension if not exists postgis schema public;
alter table driver add column location geometry(Point, 4326);
update driver
set location = st_setsrid(st_makepoint(longitude, latitude), 4326);
alter table request add column start_location geometry(Point, 4326);
alter table request add column end_location geometry(Point, 4326);
update request
set start_location = st_setsrid(st_makepoint(start_longitude, start_latitude), 4326);
update request
set end_location = st_setsrid(st_makepoint(end_longitude, end_latitude), 4326);
alter table waypoints add column location geometry(Point, 4326);
update waypoints
set location = st_setsrid(st_makepoint(longitude, latitude), 4326);
alter table location add column location geometry(Point, 4326);
update location
set location = st_setsrid(st_makepoint(longitude, latitude), 4326);
alter table report add column location geometry(Point, 4326);
update report
set location = st_setsrid(st_makepoint(longitude, latitude), 4326);
alter table area add column coverage_polygon geometry(Polygon, 4326);
update area
set coverage_polygon = ST_Buffer(
ST_SetSRID(ST_MakePoint(longitude, latitude), 4326)::geography,
radius
)::geometry;
create index idx_area_coverage_polygon on area using gist (coverage_polygon);
Attachments (1)
- 1.png (10.1 KB ) - added by 22 hours ago.
Download all attachments as: .zip
