mardi 21 avril 2015

Can't create column of type double when making a shapefile

// My type
val typeBuilder = new SimpleFeatureTypeBuilder()
typeBuilder.setName("line-query-seg")
typeBuilder.add("value", classOf[Double])
typeBuilder.add("seg", classOf[LineString])
val sft = typeBuilder.buildFeatureType()

// Trying to create a shapefile of this type
val dataStoreFactory = new ShapefileDataStoreFactory()
val shp = new File("/tmp/collection.shp")
val params = scala.collection.Map[String, Serializable]("url" -> shp.toURI.toURL,
  "create spatial index" -> true
)
val shpDS = dataStoreFactory.createNewDataStore(params.asJava).asInstanceOf[ShapefileDataStore]
shpDS.createSchema(sft)

The above code fails with:

java.io.IOException: Unable to write column value : double

I'm using scala version 2.10.4 and geotools version 11.2

Aucun commentaire:

Enregistrer un commentaire