0

This question is an exact duplicate of:

When I am writing a shapefile according to CSV2SHP tutorial, it contains features without geometries. I use version 10-SNAPSHOT.

For example the result of ogrinfo looks like below:

D:\>ogrinfo locations1.shp locations1
INFO: Open of `locations1.shp'
      using driver `ESRI Shapefile' successful.

Layer name: locations1
Geometry: Point
Feature Count: 9
Extent: (0.000000, 0.000000) - (-1.000000, -1.000000)
Layer SRS WKT:
GEOGCS["WGS84(DD)",
    DATUM["WGS84",
        SPHEROID["WGS84",6378137.0,298.257223563]],
    PRIMEM["Greenwich",0.0],
    UNIT["degree",0.017453292519943295],
    AXIS["Geodetic longitude",EAST],
    AXIS["Geodetic latitude",NORTH]]
Name: String (15.0)
Number: Real (15.13)
OGRFeature(locations1):0
  Name (String) = Trento
  Number (Real) = 140.0000000000000

OGRFeature(locations1):1
  Name (String) = St Paul
  Number (Real) = 125.0000000000000

OGRFeature(locations1):2
  Name (String) = Bangkok
  Number (Real) = 150.0000000000000

OGRFeature(locations1):3
  Name (String) = Ottawa
  Number (Real) = 200.0000000000000

OGRFeature(locations1):4
  Name (String) = Minneapolis
  Number (Real) = 350.0000000000000

OGRFeature(locations1):5
  Name (String) = Lausanne
  Number (Real) = 560.0000000000000

OGRFeature(locations1):6
  Name (String) = Victoria
  Number (Real) = 721.0000000000000

OGRFeature(locations1):7
  Name (String) = Cape Town
  Number (Real) = 550.0000000000000

OGRFeature(locations1):8
  Name (String) = Sydney
  Number (Real) = 436.0000000000000

Where could be the problem?

marked as duplicate by PolyGeo, Simbamangu, Chris W, underdark Jul 6 '14 at 20:53

This question was marked as an exact duplicate of an existing question.

  • does it work with the 9.x version? – Ian Turton Jul 11 '13 at 13:09
2

This problem was resolved over at Version problems with Geotools CSV2SHP example (so this will be a duplicate when there is an answer). The problem is that there are two, and you're using the one for 9.x:

http://docs.geotools.org/stable/userguide/tutorial/feature/csv2shp.html
http://docs.geotools.org/stable/tutorials/feature/csv2shp.html
0

Are you perhaps trying to add a different type of geometry to the point-type used in the example? The SimpleFeatureType from the example is limited to points:

final SimpleFeatureType TYPE = DataUtilities.createType("Location",
            "location:Point:srid=4326," + // <- the geometry attribute: Point type
                    "name:String," + // <- a String attribute
                    "number:Integer" // a number attribute
    );

If you can add a code sample (preferably standalone) we can likely help you more easily.

Not the answer you're looking for? Browse other questions tagged or ask your own question.