-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';

This is the query I am using for routing in pgrouting ?

My Query Is it possible to create routing in MSSQL?

If so what are all the functions available in SQL Spatial?

Steve
  • 2,988
  • 2
  • 30
  • 47
Vikram
  • 151
  • 1
  • 1
  • 4

1 Answers1

0

In general all the PostGIS methods that implements the SQL-MM specification (you can see them for examle here - they have the appropriate comment) have their analogs in SQL Server because geometry data type compliant with SQL-MM (ISO standard)

All routing/spatial funcions from your code exist in SQL Server.

Andrey Morozov
  • 7,839
  • 5
  • 53
  • 75