[Gvsig_english] load layer by code

Claudio cla.schifani at gmail.com
Wed Jan 12 10:08:44 CET 2011


Hi and thanks,
yes, it's a simple extension like a button that load this shape file without a gui. The reference tutorial is the  extLoadPostgis in the official repository.
So, in gvSIG, I create a new View and click on the "load layer", but nothing happens...while eclipse return an exception error.

any suggest...?

thanks and regards,
claudio

Il giorno 12/gen/2011, alle ore 07.51, Jorge Piera Llodrá ha scritto:

> Hi.
> 
> I suppose that you are loading this layer from a extension that is installed in a gvSIG that is able to load the shape using the user interface. Is it right?
> 
> Regards,
> Jorge
> 
> On 01/11/2011 10:20 PM, Claudio wrote:
>> 
>> Dear list,
>> I tried to load a simple layer (shape file) by code [1], but it doesn't work...
>> someone can help me?
>> this is my extension code for the execute method:
>> 
>> ......
>> public void execute(String actionCommand) {
>>  // TODO Auto-generated method stub 
>> try { 
>> View v = (View) PluginServices.getMDIManager().getActiveWindow();
>> MapControl mapCtrl = v.getMapControl();
>> String layerName = actionCommand;
>> VectorialFileDriver driver = (VectorialFileDriver) LayerFactory.getDM().getDriver("gvSIG shp driver"); 
>> FLayer prova = LayerFactory.createLayer(layerName, driver, new File ("/Users/claudio/prova.shp"), CRSFactory.getCRS("EPSG:3003"));
>> prova.setVisible(true);
>> mapCtrl.getMapContext().getLayers().addLayer(prova);
>> }
>> catch (DriverLoadException e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }  
>>  }
>> 
>> and this is the eclipse console error message:
>> 
>> ERROR [AWT-EventQueue-1] (BaseException.java:53) - com.hardcode.driverManager.DriverLoadException: formatString is null.
>> null
>>  at com.hardcode.driverManager.DriverManager.getDriver(DriverManager.java:170)
>> ........
>> 
>> 
>> Thanks a lot for every reply,
>> Claudio
>> 
>> [1] http://www.gvsig.org/web/docdev/manual-para-desarrolladores-gvsig/librerias-internas/ejemplos-de-uso-de-fmap/anadir-una-capa-por-codigo
>> 
>> 
>> _______________________________________________
>> Gvsig_internacional mailing list
>> Gvsig_internacional at listserv.gva.es
>> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>>   
> 
> 
> -- 
> Jorge Piera Llodrá
> gvSIG Development Team
> PRODEVELOP
> Plaza Don Juan de Villarrasa, 14 - 5
> 46001 Valencia
> Tel: +34 963510612
> Fax: +34 963510908
> e-mail: jpiera at prodevelop.es
> http://www.prodevelop.es
> http://www.gvsig.org
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at listserv.gva.es
> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.gva.es/pipermail/gvsig_internacional/attachments/20110112/31db5d94/attachment.htm 


More information about the Gvsig_internacional mailing list