[Gvsig_english] gvSIG gdbms shape driver
erwan bocher
erwan.bocher at gmail.com
Tue Oct 10 16:30:39 CEST 2006
Hi,
Thanks for the answer.I don't understand why I should used layer object. I
need a simple way to modify attributes values and fields in a shapefile
without gvSIG. I thought to do it with GDBMS.
Sorry for log file.
R1.
On 10/10/06, Vicente Caballero Navarro <vicente.caballero at iver.es> wrote:
>
> Hello Erwan,
>
> We need to see the ".log" with the trace of the error to be able to help
> you in the future. Nevertheless, with the code that you have sent a
> "NullPointerException" exists as a minimum in the object "field", that is
> null.
>
> You should create the "LayerDefinition" and to add him to the the fields
> that consider, to initialize the "Writer" and finally to stop the edition.
>
> I include you a piece of code by if helps you:
>
> ILayerDefinition lyrDef = EditionUtilities.createLayerDefinition(layer);
>
> //Here, modify the LayerDefinition
>
> writer.initialize(lyrDef);
> vea.stopEdition(writer, EditionEvent.GRAPHIC);
>
> I expect to have clarified something.
>
> Regards.
>
> Vicente Caballero Navarro
> Grupo desarrollo gvSIG.
> www.gvsig.gva.es
> www.iver.es
>
> ----- Original Message -----
> *From:* erwan bocher <erwan.bocher at gmail.com>
> *To:* Users and Developers mailing list<gvsig_internacional at runas.cap.gva.es>
> *Sent:* Tuesday, October 10, 2006 9:53 AM
> *Subject:* [Gvsig_english] gvSIG gdbms shape driver
>
> Hello,
>
>
> I try to use GDBMS to read and write values and fields in a shapefile. I
> used the code below. I have an error about
> com.iver.cit.gvsig.fmap.drivers.shp.IndexedShpDriver.
>
> //Ici on va chercher le ou les drivers necessaires driver
> LayerFactory.setDriversPath("C:/Temp/driver");
>
> Driver driver = LayerFactory.getDM().getDriver("gvSIG shp
> driver");
>
> if (driver!=null){ //Si le driver est trouvé alors on continue
>
> System.out.println(driver.getName()); //On affiche son petit
> nom.
>
> LayerFactory.getDataSourceFactory().addFileDataSource("gvSIG
> shp driver", "macouche",
> "C:/Temp/countries.shp");
>
> // SelectableDataSource permet de travailler sur la table
>
> SelectableDataSource sds = new SelectableDataSource(
> LayerFactory.getDataSourceFactory().createRandomDataSource("macouche",
> DataSourceFactory.MANUAL_OPENING));
> EditableAdapter ea = new EditableAdapter();
> ea.setOriginalDataSource(sds);
>
> ea.startEdition(0);
> IWriter writer = ea.getWriter();
>
> FieldDescription field = null;
>
> field.setFieldName("myfield");
>
> ea.addField(field);
>
> ea.stopEdition(writer, 0);
>
> Thanks
>
> R1.
>
>
>
> ------------------------------
>
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at runas.cap.gva.es
> http://runas.cap.gva.es/mailman/listinfo/gvsig_internacional
>
>
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at runas.cap.gva.es
> http://runas.cap.gva.es/mailman/listinfo/gvsig_internacional
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://runas.cap.gva.es/pipermail/gvsig_internacional/attachments/20061010/ed1a2fae/attachment.htm
More information about the Gvsig_internacional
mailing list