Example #1
0
        public void ColorMapStyle()
        {
            ColorMap colorMap = new ColorMap()
            {
                Name      = "checking",
                Intervals = new List <Interval>()
                {
                    new Interval()
                    {
                        Color = "#FF0000",
                        Left  = -100,
                        Right = 0
                    },
                    new Interval()
                    {
                        Color = "#00FF00",
                        Left  = 0,
                        Right = 100
                    }
                }
            };


            StylesBuilder builder = new StylesBuilder("colormap51", "colormap51");

            foreach (var rule in colorMap.GetRules())
            {
                builder.AddRule(rule);
            }

            ModulesFactory modulesFactory = new ModulesFactory();


            GeoserverClient geoserverClient = new GeoserverClient("http://localhost:8080", "admin", "geoserver");


            var result = geoserverClient.Post(modulesFactory.CreateStylesModule(builder));

            Assert.IsTrue(result);
        }
Example #2
0
        public void GeoserverServiceTest()
        {
            StylesBuilder builder = new StylesBuilder("teststyle22", "teststyle22");

            builder.AddRule(new Rule
            {
                Abstract            = "abstract",
                MaxScaleDenominator = 10,
                MinScaleDenominator = 10,
                Name   = "another",
                Title  = "another",
                Filter = new Filter
                {
                    FilterItems = new List <Filter.FilterItem>()
                    {
                        new Filter.FilterItem
                        {
                            PropertyName = "Height",
                            Type         = Filter.FilterItemType.PropertyIsGreaterThanOrEqualTo,
                            Literal      = "0"
                        }
                    }
                }
                ,
                PointSymbolizers = new List <PointSymbolizer>
                {
                    new PointSymbolizer
                    {
                        Graphic = new Graphic
                        {
                            MarkObject = new Graphic.Mark()
                            {
                                WellKnownNameProperty = Shape.Circle,
                                Fill = new Fill
                                {
                                    CssParameterArray = new List <CssParameter>()
                                    {
                                        new CssParameter
                                        {
                                            Name  = "fill",
                                            Value = "#FF0000"
                                        },
                                        new CssParameter
                                        {
                                            Name  = "fill-opacity",
                                            Value = "1"
                                        }
                                    },
                                }
                            }
                        }
                    }
                }
            });

            ModulesFactory modulesFactory = new ModulesFactory();

            GeoserverClient geoserverClient = new GeoserverClient("http://localhost:8080", "admin", "geoserver");

            var result = geoserverClient.PostAsync(modulesFactory.CreateStylesModule(builder)).Result;

            Assert.IsTrue(result);
        }