Hi,
I'm a newbie and my question is how to modify a Shapefile.
I mean e. g. add a new polygon or move one point of a polygon.
I think I can read and write shapefiles in the following way,
but what to do with the EsriGraphicList object ?
I simply want draw the Hungarian lake 'Balaton'
onto the 'dcwpo-browse' map.
Does it couse problem that I don't have any .dbf file for this .shp file ?
-----
import java.io.*;
import java.util.*;
import com.bbn.openmap.omGraphics.*;
import com.bbn.openmap.plugin.*;
import com.bbn.openmap.plugin.esri.*;
import com.bbn.openmap.dataAccess.shape.*;
import com.bbn.openmap.dataAccess.shape.input.*;
import com.bbn.openmap.dataAccess.shape.output.*;
public class Modify {
File dbf;
File shp;
File shx;
EsriGraphicList egl;
EsriPlugIn epi;
DbfTableModel dtm;
public Modify () {
// reading ...
String path = "./hungary";
dbf = new File(path + ".dbf");
shp = new File(path + ".shp");
shx = new File(path + ".shx");
epi = new EsriPlugIn("Mo.", dbf.toURL(), shp.toURL(), shx.toURL());
egl = epi.getEsriGraphicList();
dtm = epi.getModel();
///////
// what to do here ?
///////
// writing ...
String opath = "./modified";
ShpOutputStream pos = new ShpOutputStream(new FileOutputStream(opath + ".shp"));
ShxOutputStream xos = new ShxOutputStream(new FileOutputStream(opath + ".shx"));
DbfOutputStream dos = new DbfOutputStream(new FileOutputStream(opath + ".dbf"));
int[][] indexData = pos.writeGeometry(egl);
xos.writeIndex(indexData, egl.getType(), egl.getExtents());
dos.writeModel(epi.getModel());
}
public static void main (String args[]) {
Modify m = new Modify();
}
}
-----
Thanks,
Sass Bálint
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Fri Mar 26 12:39:33 2004
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT