private void SyncImages(TagsCollectionBase tags, string[] images) { var tagsToRemove = tags.Where(t => t.Key.StartsWith(FeatureAttributes.IMAGE_URL) && images.Contains(t.Value) == false).ToArray(); foreach (var tag in tagsToRemove) { tags.RemoveKeyValue(tag); } var imagesToAdd = images.Where(i => tags.Any(t => t.Value == i) == false).ToList(); foreach (var imageUrl in imagesToAdd) { if (!tags.ContainsKey(FeatureAttributes.IMAGE_URL)) { tags[FeatureAttributes.IMAGE_URL] = imageUrl; continue; } int imageIndex = 1; while (tags.ContainsKey(FeatureAttributes.IMAGE_URL + imageIndex)) { imageIndex++; } tags[FeatureAttributes.IMAGE_URL + imageIndex] = imageUrl; } }
/// <summary> /// Filters out a bunch of tags PraxisMapper will not use. /// </summary> /// <param name="rawTags"The initial tags from a CompleteGeo object></param> /// <returns>A list of ElementTags with the undesired tags removed.</returns> public static List <PlaceTags> getFilteredTags(TagsCollectionBase rawTags) { return(rawTags.Where(t => t.Key != "source" && !t.Key.StartsWith("addr:") && !t.Key.StartsWith("alt_name:") && !t.Key.StartsWith("brand") && !t.Key.StartsWith("building:") && !t.Key.StartsWith("change:") && !t.Key.StartsWith("contact:") && !t.Key.StartsWith("created_by") && !t.Key.StartsWith("demolished:") && !t.Key.StartsWith("destination:") && !t.Key.StartsWith("disused:") && !t.Key.StartsWith("email") && !t.Key.StartsWith("fax") && !t.Key.StartsWith("FIXME") && !t.Key.StartsWith("generator:") && !t.Key.StartsWith("gnis:") && !t.Key.StartsWith("hgv:") && !t.Key.StartsWith("import_uuid") && !t.Key.StartsWith("is_in") && !t.Key.StartsWith("junction:") && !t.Key.StartsWith("maxspeed") && !t.Key.StartsWith("mtb:") && !t.Key.StartsWith("nist:") && !t.Key.StartsWith("node") && !t.Key.StartsWith("not:") && !t.Key.StartsWith("old_name:") && !t.Key.StartsWith("parking:") && !t.Key.StartsWith("payment:") && !t.Key.StartsWith("phone") && !t.Key.StartsWith("name:") && !t.Key.StartsWith("recycling:") && !t.Key.StartsWith("ref:") && !t.Key.StartsWith("reg_name:") && !t.Key.StartsWith("roof:") && !t.Key.StartsWith("source:") && !t.Key.StartsWith("subject:") && !t.Key.StartsWith("telephone") && !t.Key.StartsWith("tiger:") && !t.Key.StartsWith("turn:") && !t.Key.StartsWith("was:") && !t.Key.StartsWith("website") ) .Select(t => new PlaceTags() { Key = t.Key, Value = t.Value }).ToList()); }
public static IEnumerable <string> GetNames(TagsCollectionBase tags) { return(tags.Where(t => t.Key == "ref" || t.Key.Split('_', ':').Contains("name")).Select(t => t.Value)); }