This is the class that reads a single MIF file, providing
a MIF file name or a reader to the constructor. You can then iterate
to obtain the IlvMapFeatures
of the file,
but you can also obtain information about the MIF file you are reading,
such as:
Note that the coordinate system returned by the reader
can be null
even if the MapInfo specifications
consider the geometries to be in the Geographic coordinate system
if none is specified in the MIF file.
IlvMIFReader reader =
new IlvMIFReader("example.mif");
IlvAttributeInfoProperty info = reader.getAttributeInfo();
if(info != null) {
System.out.println("Attributes info : ");
for(int i = 0; i < info.getAttributesCount(); i++) {
System.out.println("Name " + info.getAttributeName(i));
System.out.println("Class " + info.getAttributeClass(i));
}
}
IlvCoordinateSystem cs = reader.getCoordinateSystem();
if(cs != null)
System.out.println("The coordinate system is " + cs.getName());
else
System.out.println("Assuming a geographic coordinate system");
String encoding = reader.getCharset();
System.out.println("Char set is " + encoding);