postgis 拓扑网路实现沿路测距
通过shp导入postgis后的拓扑路网,实现沿路测距,通过wfs请求完成前端的服务实现
1、增加数据字段
-- Function: public.pgr_fromatob_4(character varying, double precision, double precision, double precision, double precision)
-- DROP FUNCTION public.pgr_fromatob_4(character varying, double precision, double precision, double precision, double precision);
CREATE OR REPLACE FUNCTION public.pgr_fromatob_4(
tbl character varying,
startx double precision,
starty double precision,
endx double precision,
endy double precision)
RETURNS geometry AS
$BODY$
declare
v_startLine geometry;--离起点最近的线
v_endLine geometry;--离终点最近的线
v_startTarget integer;--距离起点最近线的终点
v_startSource integer;
v_endSource integer;--距离终点最近线的起点
v_endTarget integer;
v_statpoint geometry;--在v_startLine上距离起点最近的点
v_endpoint geometry;--在v_endLine上距离终点最近的点
v_res geometry;--最短路径分析结果
v_res_a geometry;