<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi Silvia,</p>
    <p><br>
      |    Is there a way to know which functions are implemented for
      each feature type in gvSIG scripting? <br>
    </p>
    <p>If i understand correctly your question.. Quick answer, all.
      Since 2.3, we are not working with a different library for
      scripting. We improved the way to work directly with the JAVA API,
      plus new functions (like.. createShape(schema)), methods (like..
      getValues() over a feature to return a python dict) and new
      classes (like.. FormPanel to create scripts with graphical
      interface), all to make it easy and quick to work from scripting.
      Not sure if is a good way to say it (just to explain this better),
      but we could say right now is the java api who hasn't have all the
      funcions implemented.</p>
    <p>As you can see in the script, type(layer) and type(features) are
      java objects.</p>
    <p>Running script.<br>
      layer type:  &lt;type
      'org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect'&gt;<br>
      layer features:  &lt;type
      'org.gvsig.fmap.dal.feature.impl.featureset.DefaultFeatureSet'&gt;<br>
      Script terminated.</p>
    <p>So, you should be able to check the javadocs, and use all the
      functions that are in there:</p>
    <p><a class="moz-txt-link-freetext" href="http://downloads.gvsig.org/download/gvsig-desktop-testing/dists/2.3.0/javadocs/html/">http://downloads.gvsig.org/download/gvsig-desktop-testing/dists/2.3.0/javadocs/html/</a><br>
    </p>
    <p><a class="moz-txt-link-freetext" href="http://downloads.gvsig.org/download/gvsig-desktop-testing/dists/2.3.0/javadocs/html/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.html">http://downloads.gvsig.org/download/gvsig-desktop-testing/dists/2.3.0/javadocs/html/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.html</a></p>
    <p><a class="moz-txt-link-freetext" href="http://downloads.gvsig.org/download/gvsig-desktop-testing/dists/2.3.0/javadocs/html/org/gvsig/fmap/dal/feature/impl/featureset/DefaultFeatureSet.html">http://downloads.gvsig.org/download/gvsig-desktop-testing/dists/2.3.0/javadocs/html/org/gvsig/fmap/dal/feature/impl/featureset/DefaultFeatureSet.html</a></p>
    <p><br>
    </p>
    <p>Plus all from scripting (we are updating this javadoc, soon will
      be more complete):</p>
    <p><a class="moz-txt-link-freetext" href="http://downloads.gvsig.org/download/gvsig-desktop-testing/dists/2.3.0/docs/javadocs/html/">http://downloads.gvsig.org/download/gvsig-desktop-testing/dists/2.3.0/docs/javadocs/html/</a><br>
    </p>
    <p><br>
    </p>
    <p>Deleting features should be something similar to this (delete all
      features with a filter "ID &lt; 10"):</p>
    # encoding: utf-8<br>
    <br>
    from gvsig import *<br>
    <br>
    def main(*args):<br>
        """ Delete features inside a layer"""<br>
    <br>
        layer = currentLayer()<br>
        features = layer.features("ID &lt; 10") #DefaultFeatureSet<br>
        <br>
    <br>
        print "layer type: ", type(layer)<br>
        print "layer features: ", type(features)<br>
        <br>
        layer.edit()<br>
        <br>
        for i in features:<br>
            ivalues = i.getValues()<br>
            print ivalues<br>
            features.delete(i)#delete over the featureset<br>
    <br>
        layer.commit()
    <p><br>
    </p>
    Best regards,<br>
    Óscar<br>
    <br>
    <br>
    <div class="moz-cite-prefix">El 14/10/16 a las 10:53, Silvia
      Franceschi escribió:<br>
    </div>
    <blockquote
cite="mid:CABCykqKLa1UA5QoCQsg2sY4n3RO6qGFO0dTi0pUYkYeFR3NrxA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi <span style="font-size:12.8px">Óscar,</span>
        <div><span style="font-size:12.8px">the scripts work fine, many
            thanks again!</span></div>
        <div><span style="font-size:12.8px">May I just ask you one more
            question?</span></div>
        <div><span style="font-size:12.8px">Is there the possibility to
            remove a feature from a list of features? like
            featureslist.remove() or something like that?</span></div>
        <div><span style="font-size:12.8px">I tried with remove and
            delete but it seems that these do not exist, any idea?</span></div>
        <div><span style="font-size:12.8px"><br>
          </span></div>
        <div><span style="font-size:12.8px">Is there a way to know which
            functions are implemented for each feature type in gvSIG
            scripting?</span></div>
        <div><span style="font-size:12.8px"><br>
          </span></div>
        <div><span style="font-size:12.8px">Thanks</span></div>
        <div><span style="font-size:12.8px"><br>
          </span></div>
        <div><span style="font-size:12.8px">Silvia</span></div>
        <div><span style="font-size:12.8px"><br>
          </span></div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Thu, Oct 13, 2016 at 6:25 PM, Silvia
          Franceschi <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:silvia.franceschi@gmail.com" target="_blank">silvia.franceschi@gmail.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div>
                <div>
                  <div>
                    <div>Thank you Óscar,<br>
                    </div>
                    to tell you the truth I started to use currentLayer
                    but, since I need to work with two layers I didn't
                    know how to do and tried to load data from files.<br>
                  </div>
                  <div>And in any case the final script should work with
                    a list of shapefiles in a folder, so, I will for
                    sure move to the file based data source at some
                    point.<br>
                    <br>
                  </div>
                  I was following the documentation you linked, it is
                  very useful to start to get familiar with the
                  scripting environment, thanks!<br>
                  <br>
                  I will try the scripts you sent to me and let you know
                  if I will solve my problems.<br>
                  <br>
                </div>
                Thank you very much for the quick answer!<span
                  class="HOEnZb"><font color="#888888"><br>
                    <br>
                  </font></span></div>
              <span class="HOEnZb"><font color="#888888">Silvia</font></span>
              <div>
                <div class="h5"><br>
                  <div>
                    <div><br>
                      <br>
                      <div class="gmail_extra"><br>
                        <div class="gmail_quote">On Thu, Oct 13, 2016 at
                          6:00 PM, Óscar Martínez <span dir="ltr">&lt;<a
                              moz-do-not-send="true"
                              href="mailto:omartinez@gvsig.com"
                              target="_blank">omartinez@gvsig.com</a>&gt;</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">
                              <p>Hi!</p>
                              <p>If i understood correctly, you don't
                                need to use the getSchema function. I'm
                                going to give you my solution with two
                                test layers, give it a try and tell us
                                if that works for you or what exactly
                                more do you need. If you don't
                                understand some part of the script i can
                                explain it better. Some help is inside
                                the script, step by step.</p>
                              <p>I recommend to you to start learning
                                scripting using the functions
                                currentLayer() (current layer selection
                                in the table of contents) or
                                currentView().getLayer("layern<wbr>ame")
                                instead of using loadShapeFile
                                everytime. It's easier if you just have
                                a loaded layer in your view and access
                                to each one each layer with currentLayer
                                o getLayer.<br>
                              </p>
                              <p>If someone on the list want to know
                                more about this part of scripting, here
                                are some links from the spanish docs
                                (hope soon in english) related to this
                                post:</p>
                              <p>Access to features:
                                <a moz-do-not-send="true"
                                  class="m_5057304446255973355m_-7164213254184264297moz-txt-link-freetext"
href="http://downloads.gvsig.org/download/web/html/es/scripting_devel_guide/2.3/acceso_a_objetos.html#entidad"
                                  target="_blank">http://downloads.gvsig.org/dow<wbr>nload/web/html/es/scripting_<wbr>devel_guide/2.3/acceso_a_<wbr>objetos.html#entidad</a><br>
                              </p>
                              <p>Spatial operations:
                                <a moz-do-not-send="true"
                                  class="m_5057304446255973355m_-7164213254184264297moz-txt-link-freetext"
href="http://downloads.gvsig.org/download/web/html/es/scripting_devel_guide/2.3/modulo_geom.html#operaciones-espaciales"
                                  target="_blank">http://downloads.gvsig.org/dow<wbr>nload/web/html/es/scripting_<wbr>devel_guide/2.3/modulo_geom.<wbr>html#operaciones-espaciales</a></p>
                              <p>Current functions:
                                <a moz-do-not-send="true"
                                  class="m_5057304446255973355m_-7164213254184264297moz-txt-link-freetext"
href="http://downloads.gvsig.org/download/web/html/es/scripting_devel_guide/2.3/acceso_a_objetos.html"
                                  target="_blank">http://downloads.gvsig.org/dow<wbr>nload/web/html/es/scripting_<wbr>devel_guide/2.3/acceso_a_<wbr>objetos.html</a></p>
                              <p><br>
                              </p>
                              <p>Any trouble here we are!</p>
                              <p><br>
                              </p>
                              <p>Best regards,</p>
                              <p>Óscar<br>
                              </p>
                              <p><br>
                              </p>
                              <p><br>
                              </p>
                              <p>Script (layers of this test are in
                                EPSG:25830) (feature AREA1 is a
                                multipolygon):</p>
                              <p># encoding: utf-8<br>
                                <br>
                                import gvsig<br>
                                <br>
                                def main(*args):<br>
                                    # You need to have one view with to
                                layers opened on it<br>
                                    # The name of the layers will be the
                                name that appear<br>
                                    # in the table of contents of the
                                view<br>
                                    <br>
                                    # To access to the layers that are
                                already loaded in gvSIG<br>
                                    # gvsig.currentView() give us access
                                to the opened view<br>
                                    # gvsig.currentView().getLayer(n<wbr>ame)
                                give us access a specified layer<br>
                                    points =
                                gvsig.currentView().getLayer("<wbr>points")<br>
                                    area =
                                gvsig.currentView().getLayer("<wbr>area")<br>
                                <br>
                                    # Access to the features<br>
                                    features_points = points.features()<br>
                                    features_area = area.features()<br>
                                <br>
                                    # if you want access to a selection
                                of features, not all<br>
                                    # you will have to change
                                `features()` with `getSelection()`<br>
                                    #features_points =
                                points.getSelection()<br>
                                    #features_area = area.getSelection()<br>
                                <br>
                                    for farea in features_area:<br>
                                        print "\nChecking : ",
                                farea.get("localId")<br>
                                        geom_farea = farea.geometry()<br>
                                        <br>
                                        #for each area, check all points
                                without intersection<br>
                                        for fpoint in features_points:<br>
                                            geom_fpoint =
                                fpoint.geometry()<br>
                                            <br>
                                            if not
                                geom_farea.intersects(geom_fpo<wbr>int):<br>
                                                print "\tArea: ",
                                farea.get("localId"), " intersects with
                                :", fpoint.get("ID")<br>
                                                # work with the feature<br>
                                <br>
                              </p>
                              Console output:<br>
                              <br>
                              Running script testing_silvia_intersec.<br>
                              <br>
                              Checking :  AREA1<br>
                                  Area:  AREA1  intersects with : 101<br>
                                  Area:  AREA1  intersects with : 102<br>
                                  Area:  AREA1  intersects with : 103<br>
                                  Area:  AREA1  intersects with : 107<br>
                              <br>
                              Checking :  AREA2<br>
                                  Area:  AREA2  intersects with : 103<br>
                                  Area:  AREA2  intersects with : 104<br>
                                  Area:  AREA2  intersects with : 105<br>
                                  Area:  AREA2  intersects with : 106<br>
                                  Area:  AREA2  intersects with : 107<br>
                                  Area:  AREA2  intersects with : 108<br>
                              Script testing_silvia_intersec terminated.<br>
                              <br>
                              <br>
                              <br>
                              <div
                                class="m_5057304446255973355m_-7164213254184264297moz-cite-prefix">El
                                13/10/16 a las 15:05, Silvia Franceschi
                                escribió:<br>
                              </div>
                              <blockquote type="cite">
                                <div>
                                  <div class="m_5057304446255973355h5">
                                    <div dir="ltr">Hi all,
                                      <div>I am trying to write my first
                                        script in gvSIG and Python, I
                                        need to read a point shapefile
                                        and filter some elements that
                                        are outside a defined area.</div>
                                      <div>To do this I have to read two
                                        input layers, one with the
                                        points and one with the area and
                                        then work on each single
                                        features of the point layer.</div>
                                      <div>I started with the selection
                                        of the input layers using a
                                        filechooser dialog
                                        (commonsdialog.filechooser) and
                                        then I need to obtain the schema
                                        of these layers, but it seems
                                        that the object filechooser do
                                        not have the .getSchema()
                                        function.</div>
                                      <div>Do you have any idea on how
                                        to obtain the schema from a
                                        vector layer selected using the
                                        filechooser?</div>
                                      <div><br>
                                      </div>
                                      <div>Thanks in advance for any
                                        help!</div>
                                      <div><br>
                                      </div>
                                      <div>Silvia</div>
                                      <div> <br clear="all">
                                        <div><br>
                                        </div>
                                        -- <br>
                                        <div
                                          class="m_5057304446255973355m_-7164213254184264297gmail_signature">
                                          <div dir="ltr">
                                            <div>
                                              <div dir="ltr">
                                                <div>
                                                  <div dir="ltr">
                                                    <div
                                                      style="font-size:small">ing.
                                                      Silvia Franceschi<br>
                                                      Via Latemar, 22</div>
                                                    <div
                                                      style="font-size:small">38030
                                                      Castello di Fiemme
                                                      (TN)<br>
                                                      <br>
                                                      tel: <a
                                                        moz-do-not-send="true"
href="tel:0039%20-3384501332" value="+393384501332" target="_blank">0039
                                                        -3384501332</a></div>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                    <br>
                                    <fieldset
                                      class="m_5057304446255973355m_-7164213254184264297mimeAttachmentHeader"></fieldset>
                                    <br>
                                  </div>
                                </div>
                                <pre>______________________________<wbr>_________________
Gvsig_internacional mailing list
<a moz-do-not-send="true" class="m_5057304446255973355m_-7164213254184264297moz-txt-link-abbreviated" href="mailto:Gvsig_internacional@listserv.gva.es" target="_blank">Gvsig_internacional@listserv.g<wbr>va.es</a>

To see the archives, edit your preferences or unsubscribe from this mailing list, please access this url:

<a moz-do-not-send="true" class="m_5057304446255973355m_-7164213254184264297moz-txt-link-freetext" href="https://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional" target="_blank">https://listserv.gva.es/cgi-bi<wbr>n/mailman/listinfo/gvsig_inter<wbr>nacional</a>
</pre>
    </blockquote>
    

  </div>


______________________________<wbr>_________________

Gvsig_internacional mailing list

<a moz-do-not-send="true" href="mailto:Gvsig_internacional@listserv.gva.es" target="_blank">Gvsig_internacional@listserv.g<wbr>va.es</a>



To see the archives, edit your preferences or unsubscribe from this mailing list, please access this url:



<a moz-do-not-send="true" href="https://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional" rel="noreferrer" target="_blank">https://listserv.gva.es/cgi-bi<wbr>n/mailman/listinfo/gvsig_inter<wbr>nacional</a>


</blockquote></div>


-- 
<div class="m_5057304446255973355gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="font-size:small">ing. Silvia Franceschi
Via Latemar, 22</div><div style="font-size:small">38030 Castello di Fiemme (TN)

tel: <a moz-do-not-send="true" href="tel:0039%20-3384501332" value="+393384501332" target="_blank">0039 -3384501332</a></div></div></div></div></div></div></div>
</div></div></div></div></div></div>
</blockquote></div>

<div>
</div>-- 
<div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="font-size:small">ing. Silvia Franceschi
Via Latemar, 22</div><div style="font-size:small">38030 Castello di Fiemme (TN)

tel: 0039 -3384501332</div></div></div></div></div></div></div>
</div>


<fieldset class="mimeAttachmentHeader"></fieldset>
<pre wrap="">_______________________________________________
Gvsig_internacional mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Gvsig_internacional@listserv.gva.es">Gvsig_internacional@listserv.gva.es</a>

To see the archives, edit your preferences or unsubscribe from this mailing list, please access this url:

<a class="moz-txt-link-freetext" href="https://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional">https://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional</a>
</pre>

</blockquote>
</body></html>