public static void updatePassableToT()
        {
            var pg = new PostGIS();
            string strSQL = "update ch10.realtimeroad set passable=1";

            pg.SQLExcute(strSQL);
        }
 public static void updatePassable(int source ,int target,int passable)
 {
     PostGIS pg = new PostGIS();
     string strSQL = string.Format(@" update ch10.realtimeroad set passable={2}
        WHERE realtimeroad.source={0} and realtimeroad.target={1}", source, target, passable);
     pg.SQLExcute(strSQL);
 }
 public static void updateLength()
 {
     var pg = new PostGIS();
     string strSQL = "update ch10.realtimeroad set length1=random()*40";
     pg.SQLExcute(strSQL);
 }
        public static List<string> GetRealRoads(string layer,string leve)
        {
            var pg = new PostGIS();
            string sql = "  set search_path = public, ch10;" +
                "select sroadid,st_astext(the_geom) as geom,accessleve from fourleveroads";

            var records = pg.QueryRealRoads(layer, sql);
            return records;
        }
 public static List<string> GetClosetRoad(double lg, double lt, double ditMini)
 {
     var records = new List<string>();
     var pg = new PostGIS();
     string strSQL = string.Format(@"select source ,target,st_astext(pointgeom) as pointgeom from ch10.realroad
        WHERE
         ST_DWithin(the_geom ,GeometryFromText('point({0} {1})',4326), {2})
        order by ST_Distance(the_geom,GeometryFromText('point({0} {1})',4326))  limit 1", lt, lg, ditMini);
     records = pg.QueryAdd("mini", strSQL);
     return records;
 }
        public static List<string> GetAllTableFeatures(string layer,int begin,int last)
        {
            var pg = new PostGIS();
            string sql = "  set search_path = public, ch10;"+

                "SELECT  NAME,source,target,st_astext(pointgeom) as pointgeom, st_astext(the_geom) as geom FROM shortest_path('select st_astext(the_geom),gid as id,source::int4,target::int4,length::double precision as cost "

                + "from realtimeroad  where passable <>0 '," + begin + "," + last + ",false,false) as sp ,realtimeroad as tc "

                +"where sp.edge_id=tc.gid; ";

            var records = pg.Query(layer, sql);
            return records;
        }