Localize an error in a MID or MIF file

Article ID: 2254
Last updated: 29 May, 2018
Article ID: 2254
Last updated: 29 May, 2018
Revision: 3
Views: 629
Posted: 25 Feb, 2011
by Dean J.
Updated: 29 May, 2018
by Gargani A.

Question

How to localize an error in a MID or MIF file?

Answer

Here is a very simple tester that prints out errors and their line numbers in your MID and MIF files. Since the MID file contains a line per feature, knowing the exact line might help to locate the source of the trouble :

import java.io.*;
import ilog.views.maps.*;
import ilog.views.maps.format.midmif.*;
public class MidMifTester
{
static public void main(String[] args) throws IOException
{
// Applies only for versions: 8.7, 8.8
ilog.views.util.IlvProductUtil.DeploymentLicenseRequired
(ilog.views.util.IlvProductUtil.IBM_ILOG_JViews_Maps_Deployment);
IlvMIDMIFReader reader = new IlvMIDMIFReader("city_points.mif", "city_points.mid");
int row = 1;
IlvMapFeature f = reader.getNextFeature();
while (f != null) {
try {
row++;
f = reader.getNextFeature(); if(row % 20000 == 0) {
System.out.println(row);
} catch(Exception e) {
System.out.println("Error: " + e + " at row: " + row);
}
}
}
}

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2254
Last updated: 29 May, 2018
Revision: 3
Views: 629
Posted: 25 Feb, 2011 by Dean J.
Updated: 29 May, 2018 by Gargani A.

Others in this category