I've noticed that the first time I ran my test it emptied the shape file, the original ogrinfo on the file produced was
Layer name: worldCities Geometry: Point Feature Count: 12686 Extent: (-178.166667, -54.800000) - (179.383333, 78.933333) Layer SRS WKT: (unknown) ID: Integer (6.0) ATTRIB: Integer (4.0) MGCC: Integer (4.0) ADMIN_CODE: Integer (4.0) UFI: Integer (9.0) POPULATION: Integer (9.0) NAME: String (250.0) after I had run my test the features were 0 and the extents 0. the point coordinate that I am adding (1,1) in the test is well within the extents of the original shape file (-178.166667, -54.800000) - (179.383333, 78.933333) Trimble, Beheen wrote: > > What is the coordinate of your new points? Are you adding (1,1,0)? Is > the unit understood by ogr? The problem usually is among extent, > projection and spatial reference! See if mapscript has any of these > types of functions. The extent shown, below, by grinfo is not promising. > > > B > > -----Original Message----- > From: UMN MapServer Users List [mailto:[EMAIL PROTECTED] On > Behalf Of mikiet > Sent: Tuesday, October 10, 2006 7:14 AM > To: [email protected] > Subject: [UMN_MAPSERVER-USERS] Adding points to a shp file > > Hi there, > > I am using java mapscript and have a requirement to add some points to > an > ESRI shape file (bear with me here, I'm a mapinfo man). I'm using an > ESRI > shape file that came with the ms101 tutorial WorldCities.shp. Its > definitly > a point shape file as when I run ogrinfo on it I get > > Layer name: worldCities > Geometry: Point > Feature Count: 0 > Extent: (0.000000, 0.000000) - (0.000000, 0.000000) > Layer SRS WKT: > (unknown) > ID: Integer (6.0) > ATTRIB: Integer (4.0) > MGCC: Integer (4.0) > ADMIN_CODE: Integer (4.0) > UFI: Integer (9.0) > POPULATION: Integer (9.0) > NAME: String (250.0) > > I have created a simple class to add a point to this file, see below, > the > code runs without error however no feature is added to the file, I'm > sure > its a simple fix but can anyone point me in the right direction please ? > > public static void test(){ > try { > System.out.println("starting run...."); > shapeObj shape = new > shapeObj(mapscript.MS_SHAPEFILE_POINT); > lineObj lo = new lineObj(); > pointObj po = new pointObj(1d,1d,0d); > lo.add(po); > shape.add(lo); > String shapeFullPath = > "C:\\ms4w\\apps\\ms101\\data\\shapefile\\WorldCities.shp"; > shapefileObj shapefile = new shapefileObj(shapeFullPath, > mapscript.MS_SHAPEFILE_POINT); > shapefile.add(shape); > System.out.println("Shape added"); > } catch (Exception e) { > e.printStackTrace(); > } > } > -- > View this message in context: > http://www.nabble.com/Adding-points-to-a-shp-file-tf2415928.html#a673434 > 3 > Sent from the Mapserver - User mailing list archive at Nabble.com. > > -- View this message in context: http://www.nabble.com/Adding-points-to-a-shp-file-tf2415928.html#a6735664 Sent from the Mapserver - User mailing list archive at Nabble.com.
