import edu.umn.gis.mapscript.*; /** *

Title: Mapscript shape dump example.

*

Description: A Java based mapscript to dump information from a shapefile.

* @author Yew K Choo (ykchoo@geozervice.com) * @version 1.0 */ public class DumpShp { public static String getShapeType(int type) { switch (type) { case 1: return "point"; case 3: return "arc"; case 5: return "polygon"; case 8: return "multipoint"; default: return "unknown"; } } public static void usage() { System.err.println("Usage: DumpShp {shapefile.shp}"); System.exit(-1); } public static void main(String[] args) { if (args.length != 1) usage(); shapefileObj shapefile = new shapefileObj (args[0],-1); System.out.println ("Shapefile opened (type = " + getShapeType(shapefile.getType()) + " with " + shapefile.getNumshapes() + " shapes)."); shapeObj shape = new shapeObj(-1); for(int i=0; i