Ejemplo n.º 1
0
        public void GetWfsFeaturesUsingHttpPost_UrlWithAndWithoutBoundingBox_ResultWithBoundingBoxIsLessThanResultWithoutBoundingBox()
        {
            FeatureCollection result1           = WFSManager.GetWfsFeaturesUsingHttpPost("http://slwgeo.artdata.slu.se:8080/geoserver/SLW/wfs?service=wfs&version=1.1.0&request=GetFeature&typeName=SLW:Sverigekarta_med_lan&srsName=EPSG:900913&bbox=1356438.6966421,8158952.8379623,2616120.9226065,8931884.0678745");
            FeatureCollection result2           = WFSManager.GetWfsFeaturesUsingHttpPost("http://slwgeo.artdata.slu.se:8080/geoserver/SLW/wfs?service=wfs&version=1.1.0&request=GetFeature&typeName=SLW:Sverigekarta_med_lan&srsName=EPSG:900913", new WfsBoundingBox(1356438.6966421, 8158952.8379623, 2616120.9226065, 8931884.0678745, "EPSG:900913"));
            FeatureCollection resultWithoutBbox = WFSManager.GetWfsFeaturesUsingHttpPost("http://slwgeo.artdata.slu.se:8080/geoserver/SLW/wfs?service=wfs&version=1.1.0&request=GetFeature&typeName=SLW:Sverigekarta_med_lan&srsName=EPSG:900913");

            Assert.IsTrue(result1.Features.Count == result2.Features.Count);
            Assert.IsTrue(result1.Features.Count < resultWithoutBbox.Features.Count);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets feature collection based on selected WFS layer in SummaryStatistics.
        /// </summary>
        /// <returns>A feature collection or null.</returns>
        private FeatureCollection GetFeatureCollection()
        {
            if (!MySettings.Calculation.SummaryStatistics.WfsSummaryStatisticsLayerId.HasValue)
            {
                return(null);
            }

            int               wfsLayerId = MySettings.Calculation.SummaryStatistics.WfsSummaryStatisticsLayerId.Value;
            WfsLayerSetting   wfsLayer   = MySettings.DataProvider.MapLayers.WfsLayers.FirstOrDefault(l => l.Id == wfsLayerId);
            string            featuresUrl;
            string            srsName           = MySettings.Presentation.Map.PresentationCoordinateSystemId.EpsgCode();
            FeatureCollection featureCollection = null;

            if (wfsLayer.IsFile)
            {
                featureCollection = MySettingsManager.GetMapDataFeatureCollection(
                    UserContext,
                    wfsLayer.GeometryName,
                    MySettings.Presentation.Map.PresentationCoordinateSystemId);
            }
            else
            {
                if (string.IsNullOrEmpty(wfsLayer.Filter))
                {
                    featuresUrl =
                        string.Format("{0}?service=wfs&version=1.1.0&request=GetFeature&typeName={1}&srsName={2}",
                                      wfsLayer.ServerUrl, wfsLayer.TypeName, srsName);
                }
                else
                {
                    featuresUrl =
                        string.Format(
                            "{0}?service=wfs&version=1.1.0&request=GetFeature&typeName={1}&filter={2}&srsName={3}",
                            wfsLayer.ServerUrl, wfsLayer.TypeName, wfsLayer.Filter, srsName);
                }
                featureCollection = WFSManager.GetWfsFeaturesUsingHttpPost(featuresUrl);
            }

            return(featureCollection);
        }