Exemple #1
0
 private void ProcessOsmData()
 {
     osmData.FillWaysNode();
     osmData.RemoveNodesWithoutTags();
     osmData.RemoveRelationsWithoutMembers();
     osmData.RemoveWaysWithoutNodes();
 }
        public void StartCutting()
        {
            Log = string.Empty;

            if (string.IsNullOrWhiteSpace(InputFileName))
            {
                Log += $"Input file can't be empty { Environment.NewLine}";
                return;
            }
            if (string.IsNullOrWhiteSpace(OutputFileName))
            {
                Log += $"Output file name can't be empty { Environment.NewLine}";
                return;
            }

            Log += $"Loading osm data form input file{ Environment.NewLine}";
            OsmData osmData = null;

            try
            {
                osmData = OsmParser.Parse(InputFileName, _minLon, _minLat, _maxLon, _maxLat);
            }
            catch (FileNotFoundException e)
            {
                Log += $"input file not found { Environment.NewLine}";
                return;
            }

            osmData.FillWaysNode();
            osmData.RemoveRelationsWithoutMembers();
            osmData.RemoveWaysWithoutNodes();

            Log += $"Writing osm data to output file{Environment.NewLine}{AppDomain.CurrentDomain.BaseDirectory}{OSMtoSharp.FileManagers.Constants.Constants.FileFolder}{Path.DirectorySeparatorChar}{OutputFileName}{ Environment.NewLine}";
            if (OsmXmlWriter.WriteOsmDataToXml(osmData, OutputFileName, _minLon, _minLat, _maxLon, _maxLat))
            {
                Log += $"Done! { Environment.NewLine}";
            }
        }