コード例 #1
0
        /// <summary>
        /// Returns true if the given tags collection contains tags that could represents an area. waterway=river or waterway=stream could be potential false positives,
        /// but can't be confirmed without the actual geometry or the area=* tag set to true or false.
        /// </summary>
        public bool IsPotentiallyArea(TagsCollectionBase tags)
        {
            if (tags == null || tags.Count == 0)
            {
                return(false); // no tags, assume no area.
            }
            if (tags.IsTrue("area"))
            {
                return(true);
            }
            else if (tags.IsFalse("area"))
            {
                return(false);
            }

            bool isArea = false;

            if (tags.ContainsAnyKey(areaTags))
            {
                isArea = true;
            }

            if (tags.TryGetValue("type", out var typeValue))
            {
                switch (typeValue)
                {
                // there is a type in this relation.
                case "multipolygon":
                // this relation is a boundary.
                case "boundary":     // this relation is a multipolygon.
                    isArea = true;
                    break;
                }
            }
            return(isArea);
        }