Skip to content
Trey Stafford edited this page Jul 30, 2014 · 31 revisions

This page details how crossovers are identified and retrieved using with the OPS system.

views.py

createPath()

The createPath() view is used to insert new flight-lines into the database. As part of this process, self and non self-intersecting crossovers are found.

Non Self-Intersecting Crossovers

After createPath() has inserted the current segment and its point paths, non self-intersecting crossovers for the segment are found. To do this, a series of two queries are utilized to find the points of intersection and the nearest two point paths of the intersecting segments.

The first query finds and returns the points of intersection, the nearest point path on the current segment, and the angle formed by the point of intersection and the point path:

 WITH pts AS (SELECT row_number() over (ORDER BY gps_time) AS rn, id,geom FROM {app}_point_paths WHERE segment_id = {seg} ORDER BY gps_time), line AS (SELECT ST_MakeLine(ST_GeomFromText('POINTZ('||ST_X(pts.geom)||' '||ST_Y(pts.geom)||' '||pts.rn||')',4326)) AS ln FROM pts), i_pts AS (SELECT (ST_Dump(ST_Intersection(ST_Transform(line.ln,{proj}),ST_Transform(o.geom,{proj})))).geom AS i_pt FROM line, {app}_segments AS o WHERE o.id != {seg}) SELECT ST_Transform(ST_Force_2D(i_pt),4326) AS i, pts1.id, CASE WHEN ST_Equals(i_pt,pts1.geom) THEN degrees(ST_Azimuth(i_pt,ST_Transform(pts2.geom,{proj}))) ELSE degrees(ST_Azimuth(i_pt,ST_Transform(pts1.geom,{proj}))) END FROM i_pts, pts AS pts1, pts AS pts2 WHERE pts1.rn = ST_Z(i_pt)::int AND pts2.rn = (SELECT rn FROM pts WHERE rn != ST_Z(i_pts.i_pt)::int ORDER BY ABS(ST_Z(i_pts.i_pt)::int - rn) ASC LIMIT 1) ORDER BY i;

getCrossovers()

The getCrossovers() view is used to retrieve crossover data from the database.

getCrossoversReport()

The getCrossoversReport() view is used to generate a report with crossover information as a csv file that can be downloaded from the server.

Geoserver

arctic/antarctic_app_crossover_errors Layers

There are 8 layers in Geoserver that have SQL views defined for crossover errors: (arctic,antarctic)_(rds,kuband,snow,accum)_crossover_errors.

arctic/antarctic_crossover_errors Styled Layer Descriptors (SLD)

There are two .sld files that define the crossover_errors layers' style (one for each workspace: arctic and antarctic).

More

  • More to come!