Thanks it helps !

Just about System.exit(0|1) : I want my method to return the created File.

When I add* return newFile;* at the end of my method : the System.exit(1)
is before and so my method does not return the newFile (as you explained
"because you are calling system.exit so the program terminates before it
gets there.").

So I delete the System.exit(0) : it works well. But I guess this solution
is not ideal ...

Have a good day,

Augustin


2015-08-19 15:12 GMT+02:00 Mark Prins <mc.pr...@gmail.com>:

>
>
> 2015-08-18 13:19 GMT+02:00 Augustin Doury <augustindo...@gmail.com>:
>
>> Hi all,
>>
>> I try to learn how to create a shapefile with Geotools following
>> Csv2Shape tutorial [1].
>>
>> Most of the code (below) is exactly the same as the tutorial code. I
>> used the csv file as suggested in the tutorial [2].
>> I just :
>> 1) changed the line
>>   "SimpleFeatureCollection collection =
>> FeatureCollections.newCollection();"
>>     by
>>   "SimpleFeatureCollection collection = new
>> DefaultFeatureCollection(null,null);"
>>     because FeatureCollections seems deprecated.
>> 2) add a dependency to the pom.xml
>>    <dependency>
>>                 <groupId>org.geotools</groupId>
>>                 <artifactId>gt-epsg-hsql</artifactId>
>>                 <version>${geotools.version}</version>
>>           </dependency>
>>
>> *Problem* : the created shapefile does not seem to have geometries :
>>    - when I print the shapefile in QGIS or using the QuickStart
>> application, it's empty.
>>
>
>
> this is because the geometry field for a shapefile has to be called "the
> _geom" (you're using "location")
>
> see the updated/fixed version in:
> http://docs.geotools.org/latest/userguide/tutorial/feature/csv2shp.html#create-a-featuretype
>
>
>>
>> + I don't understand why the last line of the Main
>>     System.out.println("This sentence doesn't print ...");
>> does not print ...
>>
>>
> because you are calling system.exit so the program terminates before it
> gets there.
>
>
>> Hope somebody here can help me again, thank you !
>>
>> HTH, Mark
>
>
> --
> Disclaimer;
> This message is just a reflection of what I thought at the time of
> sending. The message may contain information that is not intended for you
> or that you don't understand.
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to