[Gvsig_english] Gvsig and GDAL
abhay menon
abhay.menon at gmail.com
Thu Jan 17 15:55:59 CET 2008
Hi List,
Thanks Miguel for the info about gvSIG own Java bind for GDAL..
I am aware of the fact that GDAL (v 1.5.0) is not currently supporting the
SWIG Java bind, that's due to the lack for a maintainer of the Java SWIG.
But just to share the info I am using the GDAL 1.4.1 version of the same and
was able to compile the GDAL Swig bind for the Java. I was able to compile
the a code to test the Java SWIG run for the same.
following the OgrTest.Java that I wrote to do a dry run on the same. Can
there be a possiblity for converting the OGR geometry to Geometry object
that GvSIG understands.
--------------------------------
OgrTest.java--------------------------------------------------------------------------------
import org.gdal.ogr.DataSource;
import org.gdal.ogr.Driver;
import org.gdal.ogr.Feature;
import org.gdal.ogr.FeatureDefn;
import org.gdal.ogr.FieldDefn;
import org.gdal.ogr.Geometry;
import org.gdal.ogr.Layer;
import org.gdal.ogr.ogr;
import org.gdal.ogr.ogrConstants;
public class OgrTest
{
public OgrTest() {
}
public void OgrRead(String str)
{
System. out .println( "OGR init..." );
ogr. RegisterAll ();
int count = ogr. GetDriverCount ();
System. out .println(count + " available Drivers" );
DataSource ds = ogr. Open (str, 0);
if (ds == null )
{
System. out .println( " Error Opening file " );
return ;
}
Layer la = ds.GetLayerByIndex(0);
Feature feat = null ;
la.ResetReading();
while ((feat = la.GetNextFeature())!= null )
{
FeatureDefn featdn = la.GetLayerDefn();
int iField = 0;
for (iField = 0; iField < featdn.GetFieldCount();iField++)
{
FieldDefn fDef = featdn.GetFieldDefn(iField);
if ( fDef.GetFieldType() == ogrConstants. OFTInteger )
System. out .println( " " +
feat.GetFieldAsInteger(iField)
+ " " );
else if ( fDef.GetFieldType() == ogrConstants. OFTReal
)
System. out .println( " " +
feat.GetFieldAsDouble(iField)
+ " " );
else if ( fDef.GetFieldType() == ogrConstants.
OFTString )
System. out .println( " " +
feat.GetFieldAsString(iField)
+ " " );
else
System. out .println( " " +
feat.GetFieldAsString(iField)
+ " " );
}
Geometry poGeometry = feat.GetGeometryRef();
if ( poGeometry != null
&& (poGeometry.GetGeometryType() == ogrConstants. wkbPoint
))
{
System.out.println(" "+ poGeometry.GetX(0)+ " , "+
poGeometry.GetY(0));
}
else
{
System. out .println( "no point geometry\n" );
}
feat.delete();
}
ds.delete();
}
public static void main(String[] args) {
OgrTest sa = new OgrTest();
sa.OgrRead( "D:/data/RECORD.tab" );
}
}
---------------------------------------------------------------------------------------------------------------------------
Regards
Abhay.
On Jan 17, 2008 8:00 PM, ju <julien.guilloux at espaces-naturels.fr> wrote:
> so that means that gv gis would never open mapinfo file ?
> many orgnaisation would like to change from mapinfo to gvsig : but if
> mapinfo file is not supported in a futur version, maybe a quick menu of
> transfert ( with tab2shp ) could be add in gv sig tool ?
> well i am not a devellopper and i don't know if tab2shp is opensource !
>
> thanks,
> Julien
> -------------------------------------------
> Miguel Montesinos a écrit :
> > Hi Abbhay,
> >
> > gvSIG has its own JNI binding to GDAL. As a matter of fact in the last
> version of GDAL, support for Java binding through SWIG was deprecated.
> >
> > And yes, the source code of JNI code it's available with the published
> source code.
> >
> > As far as I know, gvSIG is not using OGR for vector access. I'm not sure
> about certain utilities for reading shape headers, but all gvSIG vector
> drivers are written from scratch.
> >
> > Regards,
> >
> > ---------------------------------
> >
> > Miguel Montesinos
> >
> > Director Técnico
> >
> > PRODEVELOP
> >
> > C/ Conde Salvatierra, 34 - 10
> >
> > 46004 Valencia. Spain
> >
> > e-mail: mmontesinos at prodevelop.es
> >
> > http://www.prodevelop.es
> >
> > Tlf: +34 963510612
> >
> >
> >
> >
> >
> >
> > ________________________________
> >
> > From: gvsig_internacional-bounces at runas.cap.gva.es [mailto:
> gvsig_internacional-bounces at runas.cap.gva.es] On Behalf Of abhay menon
> > Sent: Wednesday, January 16, 2008 8:21 PM
> > To: Users and Developers mailing list
> > Subject: [Gvsig_english] Gvsig and GDAL
> >
> >
> > Hello List,
> >
> > Could any one in the Dev list let me know if gvSIG implements gdal
> java bind and use the of OGR mechanism to is available in the gvSIG src??
> >
> > Thanks and Regards
> >
> > Abhay.
> >
> >
> >
> > _______________________________________________
> > 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/20080117/deefe122/attachment-0001.htm
More information about the Gvsig_internacional
mailing list