Personal tools
You are here: Home Members Joaquin del Cerro gvSIG Scripting - raster Notas 3


201307132209 - Re: Some API methods [gvSIG] [GSoC 2013]

Hi Sir,

I was about to ask you the same. I went through the notes you provided
and i think i understood how the API should be.

I tried to create a script with a hope that on importing it a user can
simply use "loadRasterLayer()" to load a raster layer. But it is not
working as expected. Accessing the API script from another file is giving
an error. Just running the API implementation file is loading the layer but
is giving some errors. I tried to make it work but in vain..

However, with the new notes on how to proceed with the coding, i think
i will get overview on this part as well. Thank you for your effort. I will
go through the notes and will notify you about the progress.

Thank You,
Sandeep Kumar,
MS by Research,
Lab for Spatial Informatics,
IIIT-Hyderabad.

201307141348 - Re: Some API methods [gvSIG] [GSoC 2013]

El 13/07/13 22:09, sandeep kumar escribió:
> > Hi Sir,
> >
> > I was about to ask you the same. I went through the notes you provided
> > and i think i understood how the API should be.
> >
> > I tried to create a script with a hope that on importing it a user can
> > simply use "loadRasterLayer()" to load a raster layer. But it is not
> > working as expected. Accessing the API script from another file is giving
> > an error. Just running the API implementation file is loading the layer but
> > is giving some errors. I tried to make it work but in vain..
> >
Hello,
scripts that a user creates in gvSIG with the composer are just a module.
Is unable to generate a script to import it from another.

You can create modules from outside gvSIG which can then be imported
by gvSIG scripts (as gvsig.py). These should be in the PYTHONPATH.
To the PYTHONPATH are added the next folders:

- $HOME/gvSIG/plugins/org.gvsig.scripting.app.extension/lib

A user can add here their own modules.

- $APPINSTALL/gvSIG/extensions/org.gvsig.scripting.app.extension/scripting/lib

Here is where are the module "gvsig.py" and "geom.py", and where we leave
the raster module when finished.


- $APPINSTALL/gvSIG/extensions/*/scripting/lib

Only if inside the plugin folder there is a folder "scripting/lib"
This allows any input plugin modules for use in scripting.

The problem with this is that when you import a jython module this is
compiled to java byte-code and loads it into the JVM as a ".class" of
java.
Once loaded if you modify the source code does not re-load it again,
so that for each modification is necessary to re-run gvSIG.

In jython exists the python reload funcion, but does not work well.
Many times it is not able to recharge the module, especially if anyone has
any reference to something defined in it, which is very easy to happen.

Until we find a way to round this problem of
recharge of imported modules do not add support that
these can be created and used from the composer.

Regards
Joaquin

<spanish> :)
Hola,
los scripts que un usuario crea en gvSIG con el composer son solo de un modulo.
No se puede generar un script para importarlo desde otro.

Se pueden crear modulos desde fuera de gvSIG que si pueden ser importados
por los scripts de gvSIG (como gvsig.py). Estos deben estar en el PYTHONPATH.
Al PYTHONPATH se añden las figuientes carpetas:

- $HOME/gvSIG/plugins/org.gvsig.scripting.app.extension/lib

Un usuario puede añdir ahi sus propios modulos.

- $APPINSTALL/gvSIG/extensiones/org.gvsig.scripting.app.extension/scripting/lib

Aqui es donde reside el modulo gvsig.py, geom.py y donde acabara estando
el modulo para raster que creemos.


- $APPINSTALL/gvSIG/extensiones/*/scripting/lib

Solo si dentro de la carpeta del plugin existe la carpeta "scripting/lib"
Esto permite que cualquier plugin aporte modulos para su uso en scripting.

El problema que esto plantea es que jython cuando importa un modulo, lo
copila a byte-code java y lo carga en la JVM. Una vez cargado aunque se
modifique el codigo fuente no vuelve a cargarlo de nuevo, con lo que
para cada modificacion es preciso volver a ejecutar gvSIG.

En jython existe la funcion reload de python pero no funciona bien, y
muchas veces no es capaz de recarargar el modulo, sobre todo si alguien
tiene alguna referencia a algo definido en el, cosa que es muy facil que
ocurra.

Hasta que no encontremos una forma de rodear el problema de
la recarga de modulos al hacer import no daremos soporte para que
estos se puedan crear y usar desde el composer.

Saludos
Joaquin
</spanish>

> > However, with the new notes on how to proceed with the coding, i think
> > i will get overview on this part as well. Thank you for your effort. I will
> > go through the notes and will notify you about the progress.
> >
> > Thank You,
> > Sandeep Kumar,
> > MS by Research,
> > Lab for Spatial Informatics,
> > IIIT-Hyderabad.
> >
> >


Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: