Coder Social home page Coder Social logo

geoserver_migrations's People

Stargazers

 avatar

Watchers

 avatar  avatar

geoserver_migrations's Issues

Support different environments?

At the moment we have a rails project which we can deploy for different clients, and obviously the geoserver environment also is not identical. The rails project we solve using configuration files, how do we solve this for the geoserver-migrations?

Ideas:

  • in a migration file declare a "platform" where the migration should be run. No explicit platform means it should always be run?
  • when doing rails g geoserver_migrations:migrate --platform=platform_name it will run all default + the specific migrations for that platform, and will assume all current migrations for other platforms as "run"

E.g. something like

class AddTrees < GeoserverMigrations::Migration

  platform "your-platform-name" 

  def run
    heli_trees_sld = <<-SLD.strip_heredoc
      <?xml version="1.0" encoding="UTF-8"?><sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0">
        <sld:NamedLayer>
             ... snipped for legibility
        </sld:NamedLayer>
      </sld:StyledLayerDescriptor>
    SLD

    create_layer :heli_trees do
      sld heli_trees_sld
      feature_name :topo_features
    end

  end

end

Additionally I can imagine adding the plural and singular form both, so something like

platform "your-platform" 

or

platforms "your-platform1", "your-platform2" 

(not sure if we should have square-brackets there or not?)

When a migration fails, attempt to rollback changes

The DSL does collect a list of actions to generate, so when something fails halfway through, we should be able to pretty easily undo those changes.

E.g. delete styles and layers already created (in reverse order), ignoring errors of course because one of the last operations caused an error (e.g. the SLD is not correct or valid?).

Allow more complicated SLD building?

I have now very simple SLD helpers which allow to build a SLD with a single polygon/icon/line and a filter. Something like the code in spec/fixtures/migrate_examples/migrate_with_icon/06_sld_helpers_tester.rb

class SldHelpersTester < GeoserverMigrations::Migration

  def run

    add_resource "deer.png"

    create_layer :deers do
      feature_name :deers
      icon_style_with_label "Deers", "deer.png"
    end

    create_layer :alt_deers do
      feature_name :deers
      icon_style_with_label "ALT DEERS", "deer_with_hart.png", display_label: "Lieve hertjes", filter: {"active" => "true"}, max_scale_denominator: 15000
    end

    create_layer :moose do
      feature_name :moose
      polygon_style "MOOSE", display_label: "ELANDEN", max_scale_denominator: 15000
    end

    create_layer :alt_moose do
      feature_name :moose
      polygon_style "ALT MOOSE", display_label: "DOORZICHTIGE ELANDEN", max_scale_denominator: 15000, fill_opacity: "0.4"
    end

    create_layer :mice do
      feature_name :mice
      line_style "MICE", display_label: "MUIZEKES", max_scale_denominator: 21000, stroke_colour: "#80ff00", stroke_width: 8
    end

    create_layer :toads do
      feature_name :toads
      polygon_style "Toads", display_label: "Padden", max_scale_denominator: 25000, no_fill: true, stroke_colour: "#00ff00", stroke_width: 4, stroke_dasharray: "10.0 10.0"
    end

    
    create_layer :blackbirds do
      feature_name :blackbirds
      line_style "Blackbirds", display_label: "Raven", stroke_colour: "#00ff00", stroke_width: 3, filter: {"label" => "BLACK", "active" => "TRUE"}
    end

  end

end

This works fine if the SLD's remain as simple, but how do we handle a more difficult example, where we have to colour e.g. a line, based on an attribute?

E.g. something like

       line_style "Blackbirds", rules: [
               {display_label: "Zwarte Raven", stroke_colour: "#00ff00", stroke_width: 3, filter: {"label" => "BLACK", "active" => "TRUE"}},
               {display_label: "Grijze Raven", stroke_colour: "#ffff00", stroke_width: 3, filter: {"label" => "GREY", "active" => "TRUE"}},
               {display_label: "Rode Raven", stroke_colour: "#00ffff", stroke_width: 4, filter: {"label" => "RED", "active" => "TRUE"}},
        ]

So we can add different rules? Or should we still switch to a more dsl-y approach

    sld "blackbirds" do 
       rule "Zwarte Raven" do 
         line_style "Blackbirds", display_label: "Zwarte Raven", stroke_colour: "#00ff00", stroke_width: 3, filter: {"label" => "BLACK", "active" => "TRUE"}
       end 
       rule "RODE Raven" do 
         line_style "Blackbirds", display_label: "Rode Raven", stroke_colour: "#00ff00", stroke_width: 3, filter: {"label" => "RED", "active" => "TRUE"}
       end 
    end 

I can imagine rules could also be name-less? Not sure why they would have a name and a display_label ?

Of course, much of this would simply go away if we support css-styles?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.