Bonjour,
J'ai un projet à l'école qui nécessite l'ouverture et la lecture d'un shapefile pour récupérer les géométries qu'il contient.
Seulement, le code que j'ai implémenté ne fonctionne pas et je ne trouve pas de documentation sur l'erreur fournie.
Le problème se situe au niveau de la création du data store ..
Voici le code :
et Voila mon message d'erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 public class main { public static void main(String[] args) throws Exception{ String filepath = "SHP_test/testSHPindex.shp"; File shp = new File(filepath); Map<String, URL> map = new HashMap<String, URL>(); map.put( "url", shp.toURI().toURL() ); DataStore dataStore = DataStoreFinder.getDataStore(map); }
Exception in thread "main" java.lang.IllegalArgumentException: org.geotools.data.DataStoreFactorySpi is not an ImageIO SPI class
at java.desktop/javax.imageio.spi.ServiceRegistry.checkClassAllowed(ServiceRegistry.java:745)
at java.desktop/javax.imageio.spi.ServiceRegistry.<init>(ServiceRegistry.java:140)
at org.geotools.factory.FactoryRegistry.<init>(FactoryRegistry.java:155)
at org.geotools.factory.FactoryCreator.<init>(FactoryCreator.java:91)
at org.geotools.data.DataStoreFinder.getServiceRegistry(DataStoreFinder.java:128)
at org.geotools.data.DataStoreFinder.getAvailableDataStores(DataStoreFinder.java:115)
at org.geotools.data.DataStoreFinder.getDataStore(DataStoreFinder.java:87)
at org.ensg.projetperso.llb.maven.api.spatialindexingtest.testshapefile.main.main(main.java:30)
J'espère que quelqu'un pourra m'aider ..
Merci d'avance,
Laure
Partager