Hi there,

In this post, you will find the examples made in the workshop for beginners about Programming with Scripting Module in gvSIG 2.1 at the 10th International gvSIG Conference in December at Valencia.

During the workshop, we saw a few examples of geoprocessing, starting with the calculation of a buffer area and little by little, adding functionalities according to our needs.

Here the cartography to follow the scripts.We only need a polygone layer and a point layer. You can use your own layers if you want.S

If you don´t know the Scripting Module, we explain how to load the scripts, step by step, at this video. In the code, you only should change the part as ‘initial data’, writing the path where the new lawyer will be recorded. These scripts will not modify the layers already loaded. For the correct running, we should have the View on and one layer selected.

In the first two examples, we can see first, the creation of a buffer area and secondly, adding a new field showing the distance between those points to a reference point.

Script 1: Buffer

Script 2: Buffer and new field with spatial information

Also, in the third example, we add a spatial condition. This condition is just that it creates the buffer in those points intersecting with some polygon from the selected layer. In the example, referred to ‘manzanas’, but it can be replaced for any polygon layer. We can see in the symbology how this variable evolves, thinking that the reference point from the example it would be at the left bottom side. We also see that there are points where the buffer has not been generated.

Script 3: Buffer, distance new field and complying the intersection.

Another function is, from a point layer, to create a new line layer containing (in this case, a single entity to help us) a geometry with the union of all the points with all the vertices of the line.

In the first example, passing the vertices using the order of an ID field which would be random, and in the second one, using the buffer layer created in the 3rd script and taking as an order, the distance field to create the vertices of the line geometry.

Script 4: Convert points to line

Script 5: Convert buffer layer line

Finally, an example not explained during the workshop is the generation of lines projecting to that reference point, taking into account the type of layer: points, lines or polygons.

Script 6: Projected lines

You can watch the workshop videos on the following links (Spanish/English):

Spanish: 10as Jornadas Internacionales gvSIG: Taller 5, Scripting en gvSIG 2.1:

https://www.youtube.com/watch?v=DFRUZh0CzbI

English: 10th Int. gvSIG Conference: Workshop 5, Scripting on gvSIG 2.1:

https://www.youtube.com/watch?v=fKkclGGTHKs

Any doubt, you can ask here, at gvSIG user list or if it is a more specific one, you can contact me: omartinez@gvsig.com

If you are interested in the rest of the presentations of the Conference, you can check them out at this listing.

I hope these examples were useful.

Greetings to all and thank you,

Óscar