<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body 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("layername") 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 class="moz-txt-link-freetext" href="http://downloads.gvsig.org/download/web/html/es/scripting_devel_guide/2.3/acceso_a_objetos.html#entidad">http://downloads.gvsig.org/download/web/html/es/scripting_devel_guide/2.3/acceso_a_objetos.html#entidad</a><br>
</p>
<p>Spatial operations:
<a class="moz-txt-link-freetext" href="http://downloads.gvsig.org/download/web/html/es/scripting_devel_guide/2.3/modulo_geom.html#operaciones-espaciales">http://downloads.gvsig.org/download/web/html/es/scripting_devel_guide/2.3/modulo_geom.html#operaciones-espaciales</a></p>
<p>Current functions:
<a class="moz-txt-link-freetext" href="http://downloads.gvsig.org/download/web/html/es/scripting_devel_guide/2.3/acceso_a_objetos.html">http://downloads.gvsig.org/download/web/html/es/scripting_devel_guide/2.3/acceso_a_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(name) give us access a
specified layer<br>
points = gvsig.currentView().getLayer("points")<br>
area = gvsig.currentView().getLayer("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_fpoint):<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="moz-cite-prefix">El 13/10/16 a las 15:05, Silvia
Franceschi escribió:<br>
</div>
<blockquote
cite="mid:CABCykqKiNzFMSquJ=PW_U7Breq=QHtp6arPvNEzAt+p04HA2QA@mail.gmail.com"
type="cite">
<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="gmail_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: 0039 -3384501332</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<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>
<br>
</body>
</html>