Exemplo n.º 1
0
 public void DoGlom(OSMDataset osmDataset)
 {
     osmData = osmDataset;
     BuildEndpointList();
     PerformGlom();
     PurgeRemovedWays();
     ResetBBoxes();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Combine into single dataset.   There is no check for duplicate
        /// IDs.
        /// </summary>
        /// <param name="osmDataList"></param>
        /// <returns></returns>
        public static OSMDataset CombineDatasets(List <OSMDataset> osmDataList)
        {
            var allNodes     = new Dictionary <Int64, OSMNode>();
            var allWays      = new Dictionary <Int64, OSMWay>();
            var allRelations = new Dictionary <Int64, OSMRelation>();

            foreach (var osmDataSet in osmDataList)
            {
                foreach (var node in osmDataSet.osmNodes.Values)
                {
                    if (!allNodes.TryAdd(node.ID, node))
                    {
                        throw new Exception($"Duplicate node id {node.ID} found across datasets.  Use ID parameter in OGR2OSM to assign different ranges");
                    }
                }
                foreach (var way in osmDataSet.osmWays.Values)
                {
                    if (!allWays.TryAdd(way.ID, way))
                    {
                        throw new Exception($"Duplicate way id {way.ID} found across datasets.  Use ID parameter in OGR2OSM to assign different ranges");
                    }
                }
                foreach (var relation in osmDataSet.osmRelations.Values)
                {
                    if (!allRelations.TryAdd(relation.ID, relation))
                    {
                        throw new Exception($"Duplicate relation id {relation.ID} found across datasets.  Use ID parameter in OGR2OSM to assign different ranges");
                    }
                }
            }


            var mergedOSM = new OSMDataset();

            mergedOSM.osmNodes     = allNodes;
            mergedOSM.osmWays      = allWays;
            mergedOSM.osmRelations = allRelations;

            return(mergedOSM);
        }