예제 #1
0
 /// <summary>
 /// Imports node (geography POINT) in Sql Server as a varbinary(max)
 /// </summary>
 private void ImportGeoNode()
 {
     if (_nodesOsm.Count > 0)
     {
         DataTable nodesGeo = this.GetTableGeo();
         int       countRow = 0;
         foreach (KeyValuePair <Int64, Node> keyValuePair in _nodesOsm)
         {
             countRow++;
             if (keyValuePair.Value.GeoType == null)
             {
                 continue;
             }
             DataRow dataRow = nodesGeo.NewRow();
             dataRow["idGeo"]   = keyValuePair.Key;
             dataRow["bin"]     = GeoProcessing.GeoProcessingNode(keyValuePair.Value);
             dataRow["typeGeo"] = (Int16)GeoTypeOGC.Point;
             nodesGeo.Rows.Add(dataRow);
             if (countRow == COUNT_ROW)
             {
                 this.ImportDataTableInDb(ref nodesGeo, GetTableGeo);
                 countRow = 0;
             }
         }
         if (nodesGeo.Rows.Count > 0)
         {
             this.ImportDataTableInDb(ref nodesGeo, GetTableGeo);
         }
     }
 }
예제 #2
0
        private void AddGeoNodeToTable(Node node)
        {
            DataRow dataRow = _geos.NewRow();

            dataRow["idGeo"]   = node.Id;
            dataRow["bin"]     = GeoProcessing.GeoProcessingNode(node);
            dataRow["typeGeo"] = (byte)GeoTypeOGC.Point;
            this.AddRowsToGeoTable(dataRow);
        }
예제 #3
0
 private void ImportGeoWays()
 {
     if (_waysOsm.Count > 0)
     {
         DataTable waysOsm  = this.GetTableGeo();
         int       countRow = 0;
         foreach (KeyValuePair <Int64, Way> keyValuePair in _waysOsm)
         {
             countRow++;
             if (keyValuePair.Value.GeoType == null)
             {
                 continue;
             }
             GeoTypeOGC geoTypeOgc = keyValuePair.Value.GeoType.GeoTypeOGC;
             byte[]     way        = GeoProcessing.GeoProcessingWay(keyValuePair.Value, geoTypeOgc);
             if (way == null)
             {
                 continue;
             }
             DataRow dataRow = waysOsm.NewRow();
             dataRow["idGeo"]   = keyValuePair.Key;
             dataRow["bin"]     = way;
             dataRow["typeGeo"] = (Int16)geoTypeOgc;
             waysOsm.Rows.Add(dataRow);
             if (countRow == COUNT_ROW)
             {
                 this.ImportDataTableInDb(ref waysOsm, new GetTable(GetTableGeo));
                 countRow = 0;
             }
         }
         if (waysOsm.Rows.Count > 0)
         {
             this.ImportDataTableInDb(ref waysOsm, new GetTable(GetTableGeo));
         }
     }
 }