<div dir="ltr">Ok Brent, y'all got more code to test: <a href="https://github.com/geomoose/geomoose/issues/121">https://github.com/geomoose/geomoose/issues/121</a></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 23, 2016 at 6:50 PM, Dan Little <span dir="ltr"><<a href="mailto:theduckylittle@gmail.com" target="_blank">theduckylittle@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">At some point, you'll need to get brave and do a pull request. For now, I'll put merging this code on my to-do list. </p><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On Mar 23, 2016 6:02 PM, "Brent Fraser" <<a href="mailto:bfraser@geoanalytic.com" target="_blank">bfraser@geoanalytic.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Dan,<br>
    <br>
      Not an extension (hmm, that never occurred to me), just a few
    minor code additions.  The mapbook would look like (actually I don't
    test for the type):<br>
    <br>
    <tt><filter type="CQL"><![CDATA[image_id = 0 and
      reviewstatus_id<>24]]></filter></tt><br>
    <br>
    and the new Geomoose API call would be used like:<br>
    <tt>            var filter = "reviewstatus_id<>24 and
      image_id="+id;<br>
                  GeoMOOSE.updateLayerFilter("Icebergs_WFS",filter);</tt><br>
    <br>
    and the code additions :<br>
    <br>
    geomoose.js, line 228<br>
    <tt>    // BWF (Add feature filtering): updateLayerFilter (CQL)</tt><tt><br>
    </tt><tt>    updateLayerFilter : function(layerName, CQL_text) {</tt><tt><br>
    </tt><tt>       
      Application.getMapSource(layerName).updateFilter(CQL_text);</tt><tt><br>
    </tt><tt>    },</tt><br>
    <br>
    Vector.js, line 266<br>
    <tt>        // BWF (Add feature filtering): CQL filter to restrict
      features sent from server</tt><tt><br>
    </tt><tt>        var filter_tag =
      mapbook_entry.getElementsByTagName('filter');</tt><tt><br>
    </tt><tt>        if (filter_tag) {</tt><tt><br>
    </tt><tt>            var filter_text =
      OpenLayers.Util.getXmlNodeValue(filter_tag[0]);</tt><tt><br>
    </tt><tt>            var filter = new OpenLayers.Filter.Logical();</tt><tt><br>
    </tt><tt>            var format_CQL = new OpenLayers.Format.CQL();</tt><tt><br>
    </tt><tt>            try {</tt><tt><br>
    </tt><tt>                filter = format_CQL.read(filter_text);</tt><tt><br>
    </tt><tt>            } catch (err) {</tt><tt><br>
    </tt><tt>//                GeoMOOSE.error('OpenLayers CQL parser is
      unable to parse:'+filter_text);</tt><tt><br>
    </tt><tt>            }</tt><tt><br>
    </tt><tt>            if (filter) {</tt><tt><br>
    </tt><tt>                this.filter = filter;</tt><tt><br>
    </tt><tt>            }</tt><tt><br>
    </tt><tt>        }</tt><br>
    <br>
    WFS.js, line 47:<br>
    <tt>            filter: this.filter,    // BWF (Add feature
      filtering)</tt><br>
    <br>
    WFS.js, line 88:<br>
    <tt>    /*  BWF: (Add feature filtering) CQL filter</tt><tt><br>
    </tt><tt>    */</tt><tt><br>
    </tt><tt>    updateFilter: function(filter_text){</tt><tt><br>
    </tt><tt>        var filter = new OpenLayers.Filter.Logical();</tt><tt><br>
    </tt><tt>        var format_CQL = new OpenLayers.Format.CQL();</tt><tt><br>
    </tt><tt>        try {</tt><tt><br>
    </tt><tt>            filter = format_CQL.read(filter_text);</tt><tt><br>
    </tt><tt>        } catch (err) {</tt><tt><br>
    </tt><tt>//            GeoMOOSE.error('OpenLayers CQL parser is
      unable to parse:'+filter_text);</tt><tt><br>
    </tt><tt>        }</tt><tt><br>
    </tt><tt>        if (filter) {</tt><tt><br>
    </tt><tt>            this.filter = filter;</tt><tt><br>
    </tt><tt>            this._ol_layer.filter = this.filter;</tt><tt><br>
    </tt><tt>            this._ol_layer.redraw({force: true});</tt><tt><br>
    </tt><tt>            this._ol_layer.refresh({force: true});</tt><tt><br>
    </tt><tt>        }</tt><tt><br>
    </tt><tt>    },</tt><br>
    <br>
    <br>
    <pre cols="72">Best Regards,
Brent Fraser</pre>
    <div>On 3/23/2016 4:04 PM, Dan Little wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Brent, 
        <div><br>
        </div>
        <div>I'd love to see the extension once it's done and look at
          including it in the 2.9 code.  My GeoMoose coding always comes
          in bursts and I'm bursting today...</div>
        <div><br>
        </div>
        <div>-Duck</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Mon, Mar 21, 2016 at 12:23 PM, Brent
          Fraser <span dir="ltr"><<a href="mailto:bfraser@geoanalytic.com" target="_blank">bfraser@geoanalytic.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"> Jim,<br>
              <br>
                I've changed my mind.  I've implemented CQL filters to
              allow me to easily do things like:<br>
              <br>
              <tt>        <filter type="CQL"><br>
                            <![CDATA[</tt><tt><tt>reviewstatus_id<>24
                  and reviewstatus_id<>18 and </tt>image_id =
                0]]><br>
                        </filter></tt><br>
              <br>
              This requires only a minimal amount of code additions to
              Geomoose as OpenLayers has a parser to convert CQL to its
              filter object.<br>
              <br>
              And using the new API function would be like:<br>
              <br>
              <tt>      var filter = "reviewstatus_id<>24 and
                reviewstatus_id<>18 and image_id="+id;</tt><tt><br>
              </tt><tt>     
                GeoMOOSE.updateLayerFilter("Icebergs_WFS",filter);</tt><br>
              <br>
              I'll file an issue, and after some more testing, I'll do a
              pull request.<br>
              <pre cols="72">Best Regards,
Brent Fraser</pre>
              <div>
                <div>
                  <div>On 3/17/2016 9:45 AM, Brent Fraser wrote:<br>
                  </div>
                  <blockquote type="cite"> Jim,<br>
                    <br>
                      Yes, this is my thinking as well.  The additional
                    mapbook syntax is a bit of a question mark, but I
                    guess that would depend on how much of the
                    OpenLayers filter syntax we would want to support.<br>
                    <br>
                      For my purposes I've added to my wfs mapsource:<br>
                                <tt><filter type="equal_to"
                      property="image_id" value="204"/></tt><br>
                    <br>
                    but this will likely be too trivial for general
                    cases since OpenLayers allows queries like:<br>
                    <br>
                    <tt>                filter: new
                      OpenLayers.Filter.Logical({</tt><tt><br>
                    </tt><tt>                    type:
                      OpenLayers.Filter.Logical.OR,</tt><tt><br>
                    </tt><tt>                    filters: [</tt><tt><br>
                    </tt><tt>                        new
                      OpenLayers.Filter.Comparison({</tt><tt><br>
                    </tt><tt>                            type:
                      OpenLayers.Filter.Comparison.EQUAL_TO,</tt><tt><br>
                    </tt><tt>                            property:
                      "TYPE",</tt><tt><br>
                    </tt><tt>                            value:
                      "highway"</tt><tt><br>
                    </tt><tt>                        }),</tt><tt><br>
                    </tt><tt>                        new
                      OpenLayers.Filter.Comparison({</tt><tt><br>
                    </tt><tt>                            type:
                      OpenLayers.Filter.Comparison.EQUAL_TO,</tt><tt><br>
                    </tt><tt>                            property:
                      "TYPE",</tt><tt><br>
                    </tt><tt>                            value: "road"</tt><tt><br>
                    </tt><tt>                        })</tt><tt><br>
                    </tt><tt>                    ]</tt><tt><br>
                    </tt><tt>                })</tt><br>
                    <br>
                    Not impossible but might take a little bit of
                    design.<br>
                    <br>
                    Another possibility would be be to use CQL and let
                    the user specify the CQL text then have OpenLayers
                    parse it.  I've run across references to this in my
                    Googling, but I don't know much about it.<br>
                    <br>
                    As for the Geomoose code, I'm hacking together some
                    code to do:<br>
                    <br>
                    from my extension code:<br>
                    <tt>    params['image_id'] = id;</tt><tt><br>
                    </tt><tt>   
                      GeoMOOSE.updateLayerFilter("Icebergs_WFS",params);</tt><br>
                    <br>
                    where geomoose.js has<br>
                    <tt>    updateLayerFilter : function(layerName,
                      paramObject) {</tt><tt><br>
                    </tt><tt>       
                      Application.getMapSource(layerName).updateFilter(paramObject);</tt><br>
                    <br>
                    Now I have to do the rest of the coding...<br>
                    <pre cols="72">Best Regards,
Brent Fraser</pre>
                    <div>On 3/17/2016 9:03 AM, James Klassen wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <div dir="ltr">
                        <div>
                          <div>
                            <div>I'm not sure this will work with the
                              WFS layer, but this sounds like something
                              that GeoMOOSE.updateLayerParameters()
                              would accomplish for WMS.<br>
                              <br>
                              Currently (and subject to change between
                              versions), you can get at the underlying
                              OpenLayers layer object with:<br>
                            </div>
                          </div>
Application.getMapSource('mapbook/path')._ol_layer<br>
                          <br>
                        </div>
                        <div>This is something you could call from a
                          script return from a service or from a custom
                          tab.<br>
                        </div>
                        <div><br>
                          Having to dig in the internals in an
                          unsupported way is what usually prompts me to
                          suggest additions to GeoMOOSE.*  Generally, I
                          just do what I need to get done and after it
                          shakes out for a bit figure out how it could
                          be done more generically.<br>
                          <br>
                        </div>
                        <div>Jim<br>
                        </div>
                      </div>
                      <div class="gmail_extra"><br>
                        <div class="gmail_quote">On Tue, Mar 15, 2016 at
                          9:58 PM, Brent Fraser <span dir="ltr"><<a href="mailto:bfraser@geoanalytic.com" target="_blank"></a><a href="mailto:bfraser@geoanalytic.com" target="_blank">bfraser@geoanalytic.com</a>></span>
                          wrote:<br>
                          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                            <div bgcolor="#FFFFFF" text="#000000"> Hey
                              Eli,<br>
                              <br>
                                The filtering is for visual purposes:
                              since images from different dates may be
                              in the same location I want to see only
                              those polygons related to the image being
                              shown.<br>
                              <br>
                                My particular use-case is such that
                              there will never be very many polygons
                              served via WFS at once. but I do have some
                              performance concerns in general. 
                              Fortunately Geomoose/OpenLayers sends a
                              bounding box filter based on the display
                              window so that will tend to minimize the
                              problem.  <br>
                              <br>
                                I've hard-coded an OpenLayers attribute
                              filter in WFS.js for testing purposes:<br>
                              <br>
                              <tt>        this._ol_layer = new
                                OpenLayers.Layer.Vector(this.title, {</tt><tt><br>
                              </tt><tt>            strategies:
                                strategies,</tt><tt><br>
                              </tt><tt>            projection:
                                this.srsName,</tt><tt><br>
                              </tt><tt>            styleMap :
                                this.style_map,</tt><tt><br>
                              </tt><tt>            visibility: false,</tt><tt><br>
                              </tt><b><tt>            filter: new
                                  OpenLayers.Filter.Comparison({        
                                  //BWF</tt></b><b><tt><br>
                                </tt></b><b><tt>                type:
                                  OpenLayers.Filter.Comparison.EQUAL_TO,</tt></b><b><tt><br>
                                </tt></b><b><tt>               
                                  property: "image_id",</tt></b><b><tt><br>
                                </tt></b><b><tt>                value:
                                  "204"</tt></b><b><tt><br>
                                </tt></b><b><tt>            }),</tt></b><b><tt><br>
                                </tt></b><tt><b>            proto</b>col:
                                new OpenLayers.Protocol.WFS({</tt><tt><br>
                              </tt><tt>                version: '1.1.0',</tt><tt><br>
                              </tt><tt>                srsName:
                                this.srsName,</tt><tt><br>
                              </tt><tt>                url: this.url,</tt><tt><br>
                              </tt><tt>                featureNS:
                                this.featureNS,</tt><tt><br>
                              </tt><tt>                featurePrefix:
                                this.featurePrefix,</tt><tt><br>
                              </tt><tt>                featureType:
                                this.featureType,</tt><tt><br>
                              </tt><tt>                geometryName:
                                this.featureGeometryName,</tt><tt><br>
                              </tt><tt>                schema:
                                this.featureSchema</tt><tt><br>
                              </tt><tt>            })</tt><tt><br>
                              </tt><tt>        });</tt><br>
                              <br>
                              and it works fine (the above code causes
                              only those polygons digitized from image
                              204 to be shown).  Now I need to hack in
                              some code to change the filter value when
                              the user selects a different image.  While
                              it will be ok for my project, it would be
                              nice to come up with a more general
                              approach.  Maybe I'll get some inspiration
                              while hacking...<br>
                              <br>
                              <pre cols="72">Best Regards,
Brent Fraser</pre>
                              <div>
                                <div>
                                  <div>On 3/15/2016 5:57 PM, Eli Adam
                                    wrote:<br>
                                  </div>
                                  <blockquote type="cite">
                                    <pre>Hi Brent,


On Tue, Mar 15, 2016 at 7:38 AM, Brent Fraser <a href="mailto:bfraser@geoanalytic.com" target="_blank"><bfraser@geoanalytic.com></a> wrote:
</pre>
                                    <blockquote type="cite">
                                      <pre>Hi All,

  Now that I've configured my Geomoose demo to do WFS-T, I need to think
about how to use it in my old Geomoose v2.4  Ice Digitizing application.
</pre>
                                    </blockquote>
                                    <pre>Cool, good to hear that it is working.

</pre>
                                    <blockquote type="cite">
                                      <pre>  That application grouped digitized polygons by "image_id" (representing
the Landsat image used as a backdrop).  There are hundreds of images and
thousands of polygons in the system and when the user selected an image,
Geomoose passed the image_id to mapserver to do a substitution in the
mapfile SQL so only those polygons related to that image were displayed (and
available for edits etc).  That worked great.
</pre>
                                    </blockquote>
                                    <pre>Is filtering for visual purposes so that you can see what is going on?
 Or is filtering for performance and browser limits?  Did you try
solution 0 which is to do no filtering and see if it works?


</pre>
                                    <blockquote type="cite">
                                      <pre>How do I do the same thing with Geomoose v2.8 for my app?  Some possible
"solutions" (I like #3):

1.  Convert the old 2.4 vector editing system to a user extension and use it
instead of WFS-T
        - a lot of work, uses deprecated code, and no benefit to the
Geomoose community
or

2. Create a layer per image_id in the TingyOWS config.xml file and have
Geomoose switch layer name when the user selects the image.
    - as images get added to the system the config.xml file must be updated
(could be automated, but clunky)
    - each layer would point to a table in the database which would make the
database ugly
(hundreds of tables).  I might be able to use views instead of tables to
make it slightly less ugly, but TinyOWS might not do inserts into a view.
Dunno about that.
    - could be some limitations on the number of layers in the config.xml
file (or performance issues?).

or

3.  Add functionality to Geomoose to accept attribute filters in the mapbook
and pass the filters to the OpenLayers definition.
    - adds complexity to the mapbook syntax (so more documentation, testing,
maint., etc).
    - the logic may be similar to the  mapbook's search/query mechanism of
specifying input types of layer,template,fieldname,comparitor,value so maybe
some of the code could be used.
</pre>
                                    </blockquote>
                                    <pre>This sounds like an option worth exploring and may have other general
applicaitons.

</pre>
                                    <blockquote type="cite">
                                      <pre>or

4.  Other?
</pre>
                                    </blockquote>
                                    <pre>My ideas are sort of light on this one, hopefully others have further ideas.

Best regards, Eli

</pre>
                                    <blockquote type="cite">
                                      <pre>Thanks for any input!

--
Best Regards,
Brent Fraser


_______________________________________________
Geomoose-users mailing list
<a href="mailto:Geomoose-users@lists.osgeo.org" target="_blank">Geomoose-users@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/geomoose-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/geomoose-users</a>
</pre>
                                    </blockquote>
                                  </blockquote>
                                  <br>
                                </div>
                              </div>
                            </div>
                            <br>
_______________________________________________<br>
                            Geomoose-users mailing list<br>
                            <a href="mailto:Geomoose-users@lists.osgeo.org" target="_blank">Geomoose-users@lists.osgeo.org</a><br>
                            <a href="http://lists.osgeo.org/mailman/listinfo/geomoose-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/geomoose-users</a><br>
                          </blockquote>
                        </div>
                        <br>
                      </div>
                    </blockquote>
                    <br>
                    <br>
                    <fieldset></fieldset>
                    <br>
                    <pre>_______________________________________________
Geomoose-users mailing list
<a href="mailto:Geomoose-users@lists.osgeo.org" target="_blank">Geomoose-users@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/geomoose-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/geomoose-users</a></pre>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            Geomoose-users mailing list<br>
            <a href="mailto:Geomoose-users@lists.osgeo.org" target="_blank">Geomoose-users@lists.osgeo.org</a><br>
            <a href="http://lists.osgeo.org/mailman/listinfo/geomoose-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/geomoose-users</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div>
</div></div></blockquote></div><br></div>