pgRouting 测试手记

pgrouting 测试手记

一、测试环境
postgresql 9.2
postgis 2.0.3
pgrouting pg92-binaries-2.0.0devw32
特别注意:pgrouting的函数每一个版本的名称都是不同的,如shortest_path在其它版本中的命名不同,查找方式是在share的语句中搜索关键字path,此时就可以看到当关命名说明。
二、测试步骤
1、使用mapinfo pro整理有向数据
有向数据表中必须包含字段\
source
target
cost--设置几何长度
x1,x2,y1,y2

reverse--设置1000000
2、导入到数据库中

3、实验
SELECT * FROM shortest_path('SELECT objid as id, source::integer, target::integer, cost::double precision as cost

FROM mainroad_polyline', 11, 18, false, false);

4、加反向
select a.seq, b.name, ST_AsText(b.geom) as geom,round(a.cost*1000) as cost, '1' as directionid from (SELECT * FROM pgr_astar('SELECT
gid as id, source::integer, target::integer, cost::double precision as cost,x1, y1, x2, y2,reversecos as reverse_cost FROM path_polyline',28,
33, false, false))as a,(select * from path_polyline) as b where a.id2=b.gid

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值