Example #1
0
        private void ParseFeatureTypes(WFS_CapabilitiesType readWFSCaps, WFSCapabilities wfsCapabilities)
        {
            wfsCapabilities.FeatureTypes = new List <WfsFeatureType>();

            foreach (FeatureTypeType readFeatureType in readWFSCaps.FeatureTypeList.FeatureType)
            {
                WfsFeatureType featureType = new WfsFeatureType();
                featureType.Abstract = readFeatureType.Abstract;

                featureType.Keywords = new List <string>();
                foreach (KeywordsType keywordsType in readFeatureType.Keywords)
                {
                    featureType.Keywords.AddRange(keywordsType.Keyword);
                }
                if (readFeatureType.MetadataURL.IsNotEmpty())
                {
                    featureType.MetadataURL = readFeatureType.MetadataURL[0].Value;
                }

                featureType.Name  = new WfsTypeName(readFeatureType.Name);
                featureType.Title = readFeatureType.Title;
                for (int i = 0; i < readFeatureType.ItemsElementName.Length; i++)
                {
                    var itemsChoiceType = readFeatureType.ItemsElementName[i];
                    if (itemsChoiceType == ItemsChoiceType14.DefaultSRS)
                    {
                        featureType.SRS = readFeatureType.Items[i].ToString();
                    }
                }

                featureType.BoundingBox = new WfsBoundingBox();
                if (readFeatureType.WGS84BoundingBox.IsNotEmpty())
                {
                    var readBBox = readFeatureType.WGS84BoundingBox[0];
                    featureType.BoundingBox.CRS         = readBBox.crs;
                    featureType.BoundingBox.LowerCorner = readBBox.LowerCorner;
                    featureType.BoundingBox.UpperCorner = readBBox.UpperCorner;
                    featureType.BoundingBox.Dimensions  = readBBox.dimensions;
                }
                wfsCapabilities.FeatureTypes.Add(featureType);
            }
        }
        private void ParseFeatureTypes(WFS_CapabilitiesType readWFSCaps, WFSCapabilities wfsCapabilities)
        {
            wfsCapabilities.FeatureTypes = new List <WfsFeatureType>();

            foreach (FeatureTypeType readFeatureType in readWFSCaps.FeatureTypeList.FeatureType)
            {
                WfsFeatureType featureType = new WfsFeatureType();
                featureType.Abstract = readFeatureType.Abstract;

                featureType.Keywords = new List <string>();
                // osäker på om listan ska splittas med ',' eller hur den är uppbyggd.
                string[] keywords = readFeatureType.Keywords.Split(',');
                for (int i = 0; i < keywords.Length; i++)
                {
                    keywords[i] = keywords[i].Trim();
                }
                featureType.Keywords = new List <string>(keywords);

                if (readFeatureType.MetadataURL.IsNotEmpty())
                {
                    featureType.MetadataURL = readFeatureType.MetadataURL[0].Value;
                }

                featureType.Name  = new WfsTypeName(readFeatureType.Name);
                featureType.Title = readFeatureType.Title;
                featureType.SRS   = readFeatureType.SRS;

                featureType.BoundingBox = new WfsBoundingBox();
                if (readFeatureType.LatLongBoundingBox.IsNotEmpty())
                {
                    var readBBox = readFeatureType.LatLongBoundingBox[0];
                    featureType.BoundingBox.LowerCorner = readBBox.minx + " " + readBBox.miny;
                    featureType.BoundingBox.UpperCorner = readBBox.maxx + " " + readBBox.maxy;
                }
                wfsCapabilities.FeatureTypes.Add(featureType);
            }
        }
Example #3
0
 /// <summary>
 /// Makes a WFS DescribeFeatureType Request and returns a WFSDescribeFeature.
 /// </summary>
 /// <param name="url">The WFS server URL.</param>
 /// <param name="featureType">The feature layer to get information about.</param>
 /// <returns></returns>
 public static WFSDescribeFeatureType GetWFSDescribeFeatureType(string url, WfsFeatureType featureType)
 {
     return(GetWFSDescribeFeatureType(url, string.Format("{0}:{1}", featureType.Name.Namespace, featureType.Name)));
 }