-3
CREATE INDEX source_idx ON road_network("source");

CREATE INDEX target_idx ON road_network("target");

ALTER TABLE road_network  ADD COLUMN length double precision;

UPDATE road_network  SET length = length(the_geom);

ALTER TABLE road_network  ADD COLUMN reverse_cost double precision;

UPDATE road_network  SET reverse_cost = length;

ALTER TABLE road_network  ADD COLUMN x1 double precision;

ALTER TABLE road_network  ADD COLUMN y1 double precision;

ALTER TABLE road_network  ADD COLUMN x2 double precision;

ALTER TABLE road_network  ADD COLUMN y2 double precision;

UPDATE road_network  SET x1 = x(ST_PointN(the_geom, 1));

UPDATE road_network  SET y1 = y(ST_PointN(the_geom, 1));

UPDATE road_network  SET x2 = x(ST_PointN(the_geom, ST_NumPoints(the_geom)));

UPDATE road_network  SET y2 = y(ST_PointN(the_geom, ST_NumPoints(the_geom)));

alter table road_network add column cost double precision default 0;

update road_network set cost=0.1 where type='NH';

update road_network set cost=0.2 where type='SH';

update road_network set cost=0.3 where type='major';

update road_network set cost=0.4 where type='minor';

update road_network set cost=1.2 where type='colony';

这是我在 pgrouting 中用于路由的查询?

我的查询 是否可以在 MSSQL 中创建路由?

如果是这样,SQL Spatial 中可用的所有功能是什么?

4

1 回答 1

0

一般来说,所有实现SQL-MM规范的 PostGIS 方法(您可以在此处查看它们的示例- 它们有相应的注释)在 SQL Server 中都有其类似物,因为几何数据类型符合SQL -MM(ISO 标准)

您的代码中的所有路由/空间功能都存在于 SQL Server 中。

于 2014-02-07T10:58:39.520 回答