diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..61221d7 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +GeoToolsTest \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..c9cce7b --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..b26911b --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_guava_guava_17_0.xml b/.idea/libraries/Maven__com_google_guava_guava_17_0.xml new file mode 100644 index 0000000..2a9069c --- /dev/null +++ b/.idea/libraries/Maven__com_google_guava_guava_17_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_googlecode_efficient_java_matrix_library_core_0_26.xml b/.idea/libraries/Maven__com_googlecode_efficient_java_matrix_library_core_0_26.xml new file mode 100644 index 0000000..c077ae8 --- /dev/null +++ b/.idea/libraries/Maven__com_googlecode_efficient_java_matrix_library_core_0_26.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_miglayout_miglayout_swing_3_7.xml b/.idea/libraries/Maven__com_miglayout_miglayout_swing_3_7.xml new file mode 100644 index 0000000..64bb065 --- /dev/null +++ b/.idea/libraries/Maven__com_miglayout_miglayout_swing_3_7.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_vividsolutions_jts_1_13.xml b/.idea/libraries/Maven__com_vividsolutions_jts_1_13.xml new file mode 100644 index 0000000..b7e360b --- /dev/null +++ b/.idea/libraries/Maven__com_vividsolutions_jts_1_13.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__commons_pool_commons_pool_1_5_4.xml b/.idea/libraries/Maven__commons_pool_commons_pool_1_5_4.xml new file mode 100644 index 0000000..ab20721 --- /dev/null +++ b/.idea/libraries/Maven__commons_pool_commons_pool_1_5_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_imageio_ext_imageio_ext_geocore_1_1_12.xml b/.idea/libraries/Maven__it_geosolutions_imageio_ext_imageio_ext_geocore_1_1_12.xml new file mode 100644 index 0000000..512cdad --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_imageio_ext_imageio_ext_geocore_1_1_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_imageio_ext_imageio_ext_streams_1_1_12.xml b/.idea/libraries/Maven__it_geosolutions_imageio_ext_imageio_ext_streams_1_1_12.xml new file mode 100644 index 0000000..bd9f3af --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_imageio_ext_imageio_ext_streams_1_1_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_imageio_ext_imageio_ext_tiff_1_1_12.xml b/.idea/libraries/Maven__it_geosolutions_imageio_ext_imageio_ext_tiff_1_1_12.xml new file mode 100644 index 0000000..d283eaa --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_imageio_ext_imageio_ext_tiff_1_1_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_imageio_ext_imageio_ext_utilities_1_1_12.xml b/.idea/libraries/Maven__it_geosolutions_imageio_ext_imageio_ext_utilities_1_1_12.xml new file mode 100644 index 0000000..147d5e2 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_imageio_ext_imageio_ext_utilities_1_1_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_affine_jt_affine_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_affine_jt_affine_1_0_6.xml new file mode 100644 index 0000000..7203294 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_affine_jt_affine_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_algebra_jt_algebra_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_algebra_jt_algebra_1_0_6.xml new file mode 100644 index 0000000..76e23ba --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_algebra_jt_algebra_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_bandcombine_jt_bandcombine_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_bandcombine_jt_bandcombine_1_0_6.xml new file mode 100644 index 0000000..cb8a760 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_bandcombine_jt_bandcombine_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_bandmerge_jt_bandmerge_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_bandmerge_jt_bandmerge_1_0_6.xml new file mode 100644 index 0000000..3caad69 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_bandmerge_jt_bandmerge_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_bandselect_jt_bandselect_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_bandselect_jt_bandselect_1_0_6.xml new file mode 100644 index 0000000..d2b27fd --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_bandselect_jt_bandselect_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_binarize_jt_binarize_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_binarize_jt_binarize_1_0_6.xml new file mode 100644 index 0000000..0cc88b4 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_binarize_jt_binarize_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_border_jt_border_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_border_jt_border_1_0_6.xml new file mode 100644 index 0000000..c7b0e03 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_border_jt_border_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_buffer_jt_buffer_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_buffer_jt_buffer_1_0_6.xml new file mode 100644 index 0000000..0696a21 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_buffer_jt_buffer_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_classifier_jt_classifier_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_classifier_jt_classifier_1_0_6.xml new file mode 100644 index 0000000..23c4eb5 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_classifier_jt_classifier_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_colorconvert_jt_colorconvert_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_colorconvert_jt_colorconvert_1_0_6.xml new file mode 100644 index 0000000..c427136 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_colorconvert_jt_colorconvert_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_colorindexer_jt_colorindexer_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_colorindexer_jt_colorindexer_1_0_6.xml new file mode 100644 index 0000000..2ff6aeb --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_colorindexer_jt_colorindexer_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_crop_jt_crop_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_crop_jt_crop_1_0_6.xml new file mode 100644 index 0000000..fd81c65 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_crop_jt_crop_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_errordiffusion_jt_errordiffusion_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_errordiffusion_jt_errordiffusion_1_0_6.xml new file mode 100644 index 0000000..e62d587 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_errordiffusion_jt_errordiffusion_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_format_jt_format_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_format_jt_format_1_0_6.xml new file mode 100644 index 0000000..479eb4b --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_format_jt_format_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_imagefunction_jt_imagefunction_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_imagefunction_jt_imagefunction_1_0_6.xml new file mode 100644 index 0000000..e9568e5 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_imagefunction_jt_imagefunction_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_iterators_jt_iterators_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_iterators_jt_iterators_1_0_6.xml new file mode 100644 index 0000000..d91ed10 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_iterators_jt_iterators_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_lookup_jt_lookup_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_lookup_jt_lookup_1_0_6.xml new file mode 100644 index 0000000..aa8048f --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_lookup_jt_lookup_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_mosaic_jt_mosaic_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_mosaic_jt_mosaic_1_0_6.xml new file mode 100644 index 0000000..bc28727 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_mosaic_jt_mosaic_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_nullop_jt_nullop_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_nullop_jt_nullop_1_0_6.xml new file mode 100644 index 0000000..85ccf20 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_nullop_jt_nullop_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_orderdither_jt_orderdither_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_orderdither_jt_orderdither_1_0_6.xml new file mode 100644 index 0000000..d70be56 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_orderdither_jt_orderdither_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_piecewise_jt_piecewise_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_piecewise_jt_piecewise_1_0_6.xml new file mode 100644 index 0000000..35f67ae --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_piecewise_jt_piecewise_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_rescale_jt_rescale_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_rescale_jt_rescale_1_0_6.xml new file mode 100644 index 0000000..45e4b8a --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_rescale_jt_rescale_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_rlookup_jt_rlookup_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_rlookup_jt_rlookup_1_0_6.xml new file mode 100644 index 0000000..2dae641 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_rlookup_jt_rlookup_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_scale_jt_scale_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_scale_jt_scale_1_0_6.xml new file mode 100644 index 0000000..71f10c9 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_scale_jt_scale_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_stats_jt_stats_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_stats_jt_stats_1_0_6.xml new file mode 100644 index 0000000..f7b89f4 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_stats_jt_stats_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_translate_jt_translate_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_translate_jt_translate_1_0_6.xml new file mode 100644 index 0000000..ead92ba --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_translate_jt_translate_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_utilities_jt_utilities_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_utilities_jt_utilities_1_0_6.xml new file mode 100644 index 0000000..5bb91f1 --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_utilities_jt_utilities_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_vectorbin_jt_vectorbin_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_vectorbin_jt_vectorbin_1_0_6.xml new file mode 100644 index 0000000..199db1b --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_vectorbin_jt_vectorbin_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_warp_jt_warp_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_warp_jt_warp_1_0_6.xml new file mode 100644 index 0000000..238af4a --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_warp_jt_warp_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_geosolutions_jaiext_zonal_jt_zonal_1_0_6.xml b/.idea/libraries/Maven__it_geosolutions_jaiext_zonal_jt_zonal_1_0_6.xml new file mode 100644 index 0000000..c08a7df --- /dev/null +++ b/.idea/libraries/Maven__it_geosolutions_jaiext_zonal_jt_zonal_1_0_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__javax_media_jai_codec_1_1_3.xml b/.idea/libraries/Maven__javax_media_jai_codec_1_1_3.xml new file mode 100644 index 0000000..4341c63 --- /dev/null +++ b/.idea/libraries/Maven__javax_media_jai_codec_1_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__javax_media_jai_core_1_1_3.xml b/.idea/libraries/Maven__javax_media_jai_core_1_1_3.xml new file mode 100644 index 0000000..d8609e8 --- /dev/null +++ b/.idea/libraries/Maven__javax_media_jai_core_1_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__javax_media_jai_imageio_1_1.xml b/.idea/libraries/Maven__javax_media_jai_imageio_1_1.xml new file mode 100644 index 0000000..931d9cb --- /dev/null +++ b/.idea/libraries/Maven__javax_media_jai_imageio_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__jgridshift_jgridshift_1_0.xml b/.idea/libraries/Maven__jgridshift_jgridshift_1_0.xml new file mode 100644 index 0000000..b7ad97c --- /dev/null +++ b/.idea/libraries/Maven__jgridshift_jgridshift_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__junit_junit_4_11.xml b/.idea/libraries/Maven__junit_junit_4_11.xml new file mode 100644 index 0000000..f33320d --- /dev/null +++ b/.idea/libraries/Maven__junit_junit_4_11.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_java_dev_jsr_275_jsr_275_1_0_beta_2.xml b/.idea/libraries/Maven__net_java_dev_jsr_275_jsr_275_1_0_beta_2.xml new file mode 100644 index 0000000..bf5f49b --- /dev/null +++ b/.idea/libraries/Maven__net_java_dev_jsr_275_jsr_275_1_0_beta_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_sf_geographiclib_GeographicLib_Java_1_44.xml b/.idea/libraries/Maven__net_sf_geographiclib_GeographicLib_Java_1_44.xml new file mode 100644 index 0000000..7318284 --- /dev/null +++ b/.idea/libraries/Maven__net_sf_geographiclib_GeographicLib_Java_1_44.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_geotools_gt_api_14_0.xml b/.idea/libraries/Maven__org_geotools_gt_api_14_0.xml new file mode 100644 index 0000000..a398591 --- /dev/null +++ b/.idea/libraries/Maven__org_geotools_gt_api_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_geotools_gt_coverage_14_0.xml b/.idea/libraries/Maven__org_geotools_gt_coverage_14_0.xml new file mode 100644 index 0000000..d5d55af --- /dev/null +++ b/.idea/libraries/Maven__org_geotools_gt_coverage_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_geotools_gt_cql_14_0.xml b/.idea/libraries/Maven__org_geotools_gt_cql_14_0.xml new file mode 100644 index 0000000..10be1e6 --- /dev/null +++ b/.idea/libraries/Maven__org_geotools_gt_cql_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_geotools_gt_data_14_0.xml b/.idea/libraries/Maven__org_geotools_gt_data_14_0.xml new file mode 100644 index 0000000..c7dae59 --- /dev/null +++ b/.idea/libraries/Maven__org_geotools_gt_data_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_geotools_gt_epsg_hsql_14_0.xml b/.idea/libraries/Maven__org_geotools_gt_epsg_hsql_14_0.xml new file mode 100644 index 0000000..06d6648 --- /dev/null +++ b/.idea/libraries/Maven__org_geotools_gt_epsg_hsql_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_geotools_gt_main_14_0.xml b/.idea/libraries/Maven__org_geotools_gt_main_14_0.xml new file mode 100644 index 0000000..5f489f9 --- /dev/null +++ b/.idea/libraries/Maven__org_geotools_gt_main_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_geotools_gt_metadata_14_0.xml b/.idea/libraries/Maven__org_geotools_gt_metadata_14_0.xml new file mode 100644 index 0000000..16815cd --- /dev/null +++ b/.idea/libraries/Maven__org_geotools_gt_metadata_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_geotools_gt_opengis_14_0.xml b/.idea/libraries/Maven__org_geotools_gt_opengis_14_0.xml new file mode 100644 index 0000000..85cc948 --- /dev/null +++ b/.idea/libraries/Maven__org_geotools_gt_opengis_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_geotools_gt_referencing_14_0.xml b/.idea/libraries/Maven__org_geotools_gt_referencing_14_0.xml new file mode 100644 index 0000000..64c6c11 --- /dev/null +++ b/.idea/libraries/Maven__org_geotools_gt_referencing_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_geotools_gt_render_14_0.xml b/.idea/libraries/Maven__org_geotools_gt_render_14_0.xml new file mode 100644 index 0000000..92740fc --- /dev/null +++ b/.idea/libraries/Maven__org_geotools_gt_render_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_geotools_gt_shapefile_14_0.xml b/.idea/libraries/Maven__org_geotools_gt_shapefile_14_0.xml new file mode 100644 index 0000000..ce384da --- /dev/null +++ b/.idea/libraries/Maven__org_geotools_gt_shapefile_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_geotools_gt_swing_14_0.xml b/.idea/libraries/Maven__org_geotools_gt_swing_14_0.xml new file mode 100644 index 0000000..0f1a60e --- /dev/null +++ b/.idea/libraries/Maven__org_geotools_gt_swing_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..f58bbc1 --- /dev/null +++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_hsqldb_hsqldb_2_3_0.xml b/.idea/libraries/Maven__org_hsqldb_hsqldb_2_3_0.xml new file mode 100644 index 0000000..8536aa8 --- /dev/null +++ b/.idea/libraries/Maven__org_hsqldb_hsqldb_2_3_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_jaitools_jt_utils_1_4_0.xml b/.idea/libraries/Maven__org_jaitools_jt_utils_1_4_0.xml new file mode 100644 index 0000000..51b9f55 --- /dev/null +++ b/.idea/libraries/Maven__org_jaitools_jt_utils_1_4_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_jaitools_jt_zonalstats_1_4_0.xml b/.idea/libraries/Maven__org_jaitools_jt_zonalstats_1_4_0.xml new file mode 100644 index 0000000..b7da14a --- /dev/null +++ b/.idea/libraries/Maven__org_jaitools_jt_zonalstats_1_4_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_jdom_jdom_1_1_3.xml b/.idea/libraries/Maven__org_jdom_jdom_1_1_3.xml new file mode 100644 index 0000000..f7f5b46 --- /dev/null +++ b/.idea/libraries/Maven__org_jdom_jdom_1_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d36329c --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,30 @@ + + + + + + + /usr/bin/bower + $PROJECT_DIR$/../Portfolio/bower.json + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7663bec --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..5e200df --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,772 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1444732955755 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GeoToolsTutorial.iml b/GeoToolsTutorial.iml new file mode 100644 index 0000000..1ddecc3 --- /dev/null +++ b/GeoToolsTutorial.iml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..1bcd178 --- /dev/null +++ b/pom.xml @@ -0,0 +1,60 @@ + + 4.0.0 + org.geotools + tutorial + 0.0.1-SNAPSHOT + jar + tutorial + http://maven.apache.org + + + UTF-8 + 14.0 + + + + + junit + junit + 4.11 + test + + + org.geotools + gt-shapefile + ${geotools.version} + + + org.geotools + gt-swing + ${geotools.version} + + + org.geotools + gt-shapefile + ${geotools.version} + + + org.geotools + gt-epsg-hsql + ${geotools.version} + + + + + + + maven2-repository.dev.java.net + Java.net repository + http://download.java.net/maven/2 + + + osgeo + Open Source Geospatial Foundation Repository + http://download.osgeo.org/webdav/geotools/ + + + \ No newline at end of file diff --git a/res/crs/bc_border.dbf b/res/crs/bc_border.dbf new file mode 100644 index 0000000..7af8a43 Binary files /dev/null and b/res/crs/bc_border.dbf differ diff --git a/res/crs/bc_border.fix b/res/crs/bc_border.fix new file mode 100644 index 0000000..592eb06 Binary files /dev/null and b/res/crs/bc_border.fix differ diff --git a/res/crs/bc_border.prj b/res/crs/bc_border.prj new file mode 100644 index 0000000..749edd9 --- /dev/null +++ b/res/crs/bc_border.prj @@ -0,0 +1 @@ +GEOGCS["GCS_North_American_1983",DATUM["North_American_Datum_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] diff --git a/res/crs/bc_border.qix b/res/crs/bc_border.qix new file mode 100644 index 0000000..631b6b6 Binary files /dev/null and b/res/crs/bc_border.qix differ diff --git a/res/crs/bc_border.shp b/res/crs/bc_border.shp new file mode 100644 index 0000000..9fa6ced Binary files /dev/null and b/res/crs/bc_border.shp differ diff --git a/res/crs/bc_border.shx b/res/crs/bc_border.shx new file mode 100644 index 0000000..9996621 Binary files /dev/null and b/res/crs/bc_border.shx differ diff --git a/res/feature/locations.csv b/res/feature/locations.csv new file mode 100644 index 0000000..1207824 --- /dev/null +++ b/res/feature/locations.csv @@ -0,0 +1,14 @@ +LAT, LON, CITY, NUMBER +46.066667, 11.116667, Trento, 140 +44.9441, -93.0852, St Paul, 125 +13.752222, 100.493889, Bangkok, 150 +45.420833, -75.69, Ottawa, 200 +44.9801, -93.251867, Minneapolis, 350 +46.519833, 6.6335, Lausanne, 560 +48.428611, -123.365556, Victoria, 721 +-33.925278, 18.423889, Cape Town, 550 +-33.859972, 151.211111, Sydney, 436 +41.383333, 2.183333, Barcelona, 914 +39.739167, -104.984722, Denver, 869 +52.95, -1.133333, Nottingham, 800 +45.52, -122.681944, Portland, 840 \ No newline at end of file diff --git a/res/quickstart/ne_50m_admin_0_countries.dbf b/res/quickstart/ne_50m_admin_0_countries.dbf new file mode 100644 index 0000000..856c7e5 Binary files /dev/null and b/res/quickstart/ne_50m_admin_0_countries.dbf differ diff --git a/res/quickstart/ne_50m_admin_0_countries.prj b/res/quickstart/ne_50m_admin_0_countries.prj new file mode 100644 index 0000000..f45cbad --- /dev/null +++ b/res/quickstart/ne_50m_admin_0_countries.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] \ No newline at end of file diff --git a/res/quickstart/ne_50m_admin_0_countries.qix b/res/quickstart/ne_50m_admin_0_countries.qix new file mode 100644 index 0000000..16536c1 Binary files /dev/null and b/res/quickstart/ne_50m_admin_0_countries.qix differ diff --git a/res/quickstart/ne_50m_admin_0_countries.shp b/res/quickstart/ne_50m_admin_0_countries.shp new file mode 100644 index 0000000..7ba7e7c Binary files /dev/null and b/res/quickstart/ne_50m_admin_0_countries.shp differ diff --git a/res/quickstart/ne_50m_admin_0_countries.shx b/res/quickstart/ne_50m_admin_0_countries.shx new file mode 100644 index 0000000..12d45c2 Binary files /dev/null and b/res/quickstart/ne_50m_admin_0_countries.shx differ diff --git a/src/main/java/org/geotools/tutorial/crs/CRSLab.java b/src/main/java/org/geotools/tutorial/crs/CRSLab.java new file mode 100644 index 0000000..71c6877 --- /dev/null +++ b/src/main/java/org/geotools/tutorial/crs/CRSLab.java @@ -0,0 +1,55 @@ +package org.geotools.tutorial.crs; + +import org.geotools.data.FileDataStore; +import org.geotools.data.FileDataStoreFinder; +import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.map.FeatureLayer; +import org.geotools.map.Layer; +import org.geotools.map.MapContent; +import org.geotools.styling.SLD; +import org.geotools.styling.Style; +import org.geotools.swing.JMapFrame; + +import javax.swing.*; +import java.io.File; + +/** + * This is a visual example of changing the coordinate reference system of a feature layer. + */ +public class CRSLab { + + static File sourceFile; + static SimpleFeatureSource featureSource; + static MapContent map; + + public static void main(String[] args) throws Exception { + displayShapefile(); + } + + private static void displayShapefile() throws Exception { + sourceFile = new File("res/crs/bc_border.shp"); + FileDataStore store = FileDataStoreFinder.getDataStore(sourceFile); + featureSource = store.getFeatureSource(); + + // Create a map context and add our shapefile to it + map = new MapContent(); + Style style = SLD.createSimpleStyle(featureSource.getSchema()); + Layer layer = new FeatureLayer(featureSource, style); + map.layers().add(layer); + + // Create a JMapFrame with custom toolbar buttons + JMapFrame mapFrame = new JMapFrame(map); + mapFrame.enableToolBar(true); + mapFrame.enableStatusBar(true); + + JToolBar toolbar = mapFrame.getToolBar(); + toolbar.addSeparator(); +// toolbar.add(new JButton(new ValidateGeometryAction())); + toolbar.add(new JButton(new ValidateGeometryAction2())); + toolbar.add(new JButton(new ExportShapefileAction())); + + // Display the map frame. When it is closed the application will exit + mapFrame.setSize(800, 600); + mapFrame.setVisible(true); + } +} \ No newline at end of file diff --git a/src/main/java/org/geotools/tutorial/crs/ExportShapefileAction.java b/src/main/java/org/geotools/tutorial/crs/ExportShapefileAction.java new file mode 100644 index 0000000..d3c3952 --- /dev/null +++ b/src/main/java/org/geotools/tutorial/crs/ExportShapefileAction.java @@ -0,0 +1,99 @@ +package org.geotools.tutorial.crs; + +import com.vividsolutions.jts.geom.Geometry; +import org.geotools.data.*; +import org.geotools.data.shapefile.ShapefileDataStoreFactory; +import org.geotools.data.simple.SimpleFeatureCollection; +import org.geotools.data.simple.SimpleFeatureIterator; +import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.feature.simple.SimpleFeatureTypeBuilder; +import org.geotools.geometry.jts.JTS; +import org.geotools.map.MapContent; +import org.geotools.referencing.CRS; +import org.geotools.swing.action.SafeAction; +import org.geotools.swing.data.JFileDataStoreChooser; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.operation.MathTransform; + +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.io.File; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +class ExportShapefileAction extends SafeAction { + + ExportShapefileAction() { + super("Export..."); + putValue(Action.SHORT_DESCRIPTION, "Export using current crs"); + } + public void action(ActionEvent e) throws Throwable { + exportToShapefile(); + } + + private void exportToShapefile() throws Exception { + SimpleFeatureType schema = CRSLab.featureSource.getSchema(); + JFileDataStoreChooser chooser = new JFileDataStoreChooser("shp"); + chooser.setDialogTitle("Save reprojected shapefile"); + chooser.setSaveFile(CRSLab.sourceFile); + int returnVal = chooser.showSaveDialog(null); + if (returnVal != JFileDataStoreChooser.APPROVE_OPTION) { + return; + } + File file = chooser.getSelectedFile(); + if (file.equals(CRSLab.sourceFile)) { + JOptionPane.showMessageDialog(null, "Cannot replace " + file); + return; + } + + CoordinateReferenceSystem dataCRS = schema.getCoordinateReferenceSystem(); + CoordinateReferenceSystem worldCRS = CRSLab.map.getCoordinateReferenceSystem(); + boolean lenient = true; // allow for some error due to different datums + MathTransform transform = CRS.findMathTransform(dataCRS, worldCRS, lenient); + + SimpleFeatureCollection featureCollection = CRSLab.featureSource.getFeatures(); + + DataStoreFactorySpi factory = new ShapefileDataStoreFactory(); + Map create = new HashMap(); + create.put("url", file.toURI().toURL()); + create.put("create spatial index", Boolean.TRUE); + DataStore dataStore = factory.createNewDataStore(create); + SimpleFeatureType featureType = SimpleFeatureTypeBuilder.retype(schema, worldCRS); + dataStore.createSchema(featureType); + + //Get the name of the new Shapefile, which will be used to open the FeatureWriter + String createdName = dataStore.getTypeNames()[0]; + + Transaction transaction = new DefaultTransaction("Reproject"); + FeatureWriter writer = + dataStore.getFeatureWriterAppend(createdName, transaction); + SimpleFeatureIterator iterator = featureCollection.features(); + try { + while (iterator.hasNext()) { + // copy the contents of each feature and transform the geometry + SimpleFeature feature = iterator.next(); + SimpleFeature copy = writer.next(); + copy.setAttributes(feature.getAttributes()); + + Geometry geometry = (Geometry) feature.getDefaultGeometry(); + Geometry geometry2 = JTS.transform(geometry, transform); + + copy.setDefaultGeometry(geometry2); + writer.write(); + } + transaction.commit(); + JOptionPane.showMessageDialog(null, "Export to shapefile complete"); + } catch (Exception problem) { + problem.printStackTrace(); + transaction.rollback(); + JOptionPane.showMessageDialog(null, "Export to shapefile failed"); + } finally { + writer.close(); + iterator.close(); + transaction.close(); + } + } +} diff --git a/src/main/java/org/geotools/tutorial/crs/ValidateGeometryAction.java b/src/main/java/org/geotools/tutorial/crs/ValidateGeometryAction.java new file mode 100644 index 0000000..35c54b8 --- /dev/null +++ b/src/main/java/org/geotools/tutorial/crs/ValidateGeometryAction.java @@ -0,0 +1,54 @@ +package org.geotools.tutorial.crs; + +import com.vividsolutions.jts.geom.Geometry; +import org.geotools.data.simple.SimpleFeatureCollection; +import org.geotools.swing.action.SafeAction; +import org.opengis.feature.Feature; +import org.opengis.feature.FeatureVisitor; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.util.ProgressListener; + +import javax.swing.*; +import java.awt.event.ActionEvent; + +class ValidateGeometryAction extends SafeAction { + + ValidateGeometryAction() { + super("Validate geometry"); + putValue(Action.SHORT_DESCRIPTION, "Check each geometry"); + } + public void action(ActionEvent e) throws Throwable { + int numInvalid = validateFeatureGeometry(null); + String msg; + if (numInvalid == 0) { + msg = "All feature geometries are valid"; + } else { + msg = "Invalid geometries: " + numInvalid; + } + JOptionPane.showMessageDialog(null, msg, "Geometry results", + JOptionPane.INFORMATION_MESSAGE); + } + + private int validateFeatureGeometry(ProgressListener progress) throws Exception { + final SimpleFeatureCollection featureCollection = CRSLab.featureSource.getFeatures(); + + // Rather than use an iterator, create a FeatureVisitor to check each fature + class ValidationVisitor implements FeatureVisitor { + public int numInvalidGeometries = 0; + public void visit(Feature f) { + SimpleFeature feature = (SimpleFeature) f; + Geometry geom = (Geometry) feature.getDefaultGeometry(); + if (geom != null && !geom.isValid()) { + numInvalidGeometries++; + System.out.println("Invalid Geoemtry: " + feature.getID()); + } + } + } + + ValidationVisitor visitor = new ValidationVisitor(); + + // Pass visitor and the progress bar to feature collection + featureCollection.accepts(visitor, progress); + return visitor.numInvalidGeometries; + } +} \ No newline at end of file diff --git a/src/main/java/org/geotools/tutorial/crs/ValidateGeometryAction2.java b/src/main/java/org/geotools/tutorial/crs/ValidateGeometryAction2.java new file mode 100644 index 0000000..c191ecc --- /dev/null +++ b/src/main/java/org/geotools/tutorial/crs/ValidateGeometryAction2.java @@ -0,0 +1,74 @@ +package org.geotools.tutorial.crs; + +import com.vividsolutions.jts.geom.Geometry; +import org.geotools.data.simple.SimpleFeatureCollection; +import org.geotools.swing.JProgressWindow; +import org.geotools.swing.action.SafeAction; +import org.opengis.feature.Feature; +import org.opengis.feature.FeatureVisitor; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.util.ProgressListener; + +import javax.swing.*; +import java.awt.event.ActionEvent; + +class ValidateGeometryAction2 extends SafeAction { + + ValidateGeometryAction2() { + super("Validate geometry"); + putValue(Action.SHORT_DESCRIPTION, "Check each geometry"); + } + + public void action(ActionEvent e) throws Throwable { + // Here we use the SwingWorker helper class to run the validation routine in a + // background thread, otherwise the GUI would wait and the progress bar would not be + // displayed properly + SwingWorker worker = new SwingWorker() { + protected String doInBackground() throws Exception { + // For shapefiles with many features its nice to display a progress bar + final JProgressWindow progress = new JProgressWindow(null); + progress.setTitle("Validating feature geometry"); + + int numInvalid = validateFeatureGeometry(progress); + if (numInvalid == 0) { + return "All feature geometries are valid"; + } else { + return "Invalid geometries: " + numInvalid; + } + } + protected void done() { + try { + Object result = get(); + JOptionPane.showMessageDialog(null, result, "Geometry results", + JOptionPane.INFORMATION_MESSAGE); + } catch (Exception ignore) { + } + } + }; + // This statement runs the validation method in a background thread + worker.execute(); + } + + private int validateFeatureGeometry(ProgressListener progress) throws Exception { + final SimpleFeatureCollection featureCollection = CRSLab.featureSource.getFeatures(); + + // Rather than use an iterator, create a FeatureVisitor to check each fature + class ValidationVisitor implements FeatureVisitor { + public int numInvalidGeometries = 0; + public void visit(Feature f) { + SimpleFeature feature = (SimpleFeature) f; + Geometry geom = (Geometry) feature.getDefaultGeometry(); + if (geom != null && !geom.isValid()) { + numInvalidGeometries++; + System.out.println("Invalid Geoemtry: " + feature.getID()); + } + } + } + + ValidationVisitor visitor = new ValidationVisitor(); + + // Pass visitor and the progress bar to feature collection + featureCollection.accepts(visitor, progress); + return visitor.numInvalidGeometries; + } +} diff --git a/src/main/java/org/geotools/tutorial/feature/Csv2Shape.java b/src/main/java/org/geotools/tutorial/feature/Csv2Shape.java new file mode 100644 index 0000000..caa039e --- /dev/null +++ b/src/main/java/org/geotools/tutorial/feature/Csv2Shape.java @@ -0,0 +1,212 @@ +package org.geotools.tutorial.feature; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.Point; +import org.geotools.data.DataUtilities; +import org.geotools.data.DefaultTransaction; +import org.geotools.data.Transaction; +import org.geotools.data.collection.ListFeatureCollection; +import org.geotools.data.shapefile.ShapefileDataStore; +import org.geotools.data.shapefile.ShapefileDataStoreFactory; +import org.geotools.data.simple.SimpleFeatureCollection; +import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.data.simple.SimpleFeatureStore; +import org.geotools.feature.simple.SimpleFeatureBuilder; +import org.geotools.feature.simple.SimpleFeatureTypeBuilder; +import org.geotools.geometry.jts.JTSFactoryFinder; +import org.geotools.referencing.crs.DefaultGeographicCRS; +import org.geotools.swing.data.JFileDataStoreChooser; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * This example reads data for point locations and associated attributes from a + * comma separated text (CSV) file and exports them as a new shapefile. It illustrates how to build a feature type. + *

+ * Note: to keep things simple in the code below the input file should not have additional spaces or + * tabs between fields. + */ +public class Csv2Shape { + + public static void main(String[] args) throws Exception { + File file = new File("res/feature/locations.csv"); + + /* + * We use the DataUtilities class to create a FeatureType that will describe the data in our + * shapefile. + * See also the createFeatureType method below for another, more flexible approach. + */ + final SimpleFeatureType TYPE = DataUtilities.createType("Location", + "the_geom:Point:srid=4326," + // <- the geometry attribute: Point type + "name:String," + // <- a String attribute + "number:Integer" // a number attribute + ); + System.out.println("TYPE:" + TYPE); + + /* + * A list to collect features as we create them. + */ + List features = new ArrayList(); + + /* + * GeometryFactory will be used to create the geometry attribute of each feature, + * using a Point object for the location. + */ + GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); + + SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(TYPE); + + BufferedReader reader = new BufferedReader(new FileReader(file)); + try { + /* First line of the data file is the header */ + String line = reader.readLine(); + System.out.println("Header: " + line); + + for (line = reader.readLine(); line != null; line = reader.readLine()) { + if (line.trim().length() > 0) { // skip blank lines + String tokens[] = line.split("\\,"); + + double latitude = Double.parseDouble(tokens[0]); + double longitude = Double.parseDouble(tokens[1]); + String name = tokens[2].trim(); + int number = Integer.parseInt(tokens[3].trim()); + + /* Longitude (= x coord) first ! */ + Point point = geometryFactory.createPoint(new Coordinate(longitude, latitude)); + + featureBuilder.add(point); + featureBuilder.add(name); + featureBuilder.add(number); + SimpleFeature feature = featureBuilder.buildFeature(null); + features.add(feature); + } + } + } finally { + reader.close(); + } + + /* + * Get an output file name and create the new shapefile + */ + File newFile = getNewShapeFile(file); + + ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory(); + + Map params = new HashMap(); + params.put("url", newFile.toURI().toURL()); + params.put("create spatial index", Boolean.TRUE); + + ShapefileDataStore newDataStore = (ShapefileDataStore) dataStoreFactory.createNewDataStore(params); + + /* + * TYPE is used as a template to describe the file contents + */ + newDataStore.createSchema(TYPE); + + /* + * Write the features to the shapefile + */ + Transaction transaction = new DefaultTransaction("create"); + + String typeName = newDataStore.getTypeNames()[0]; + SimpleFeatureSource featureSource = newDataStore.getFeatureSource(typeName); +// SimpleFeatureType SHAPE_TYPE = featureSource.getSchema(); + SimpleFeatureType SHAPE_TYPE = createFeatureType(); + /* + * The Shapefile format has a couple limitations: + * - "the_geom" is always first, and used for the geometry attribute name + * - "the_geom" must be of type Point, MultiPoint, MuiltiLineString, MultiPolygon + * - Attribute names are limited in length + * - Not all data types are supported (example Timestamp represented as Date) + * + * Each data store has different limitations so check the resulting SimpleFeatureType. + */ + System.out.println("SHAPE:" + SHAPE_TYPE); + + if (featureSource instanceof SimpleFeatureStore) { + SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource; + /* + * SimpleFeatureStore has a method to add features from a + * SimpleFeatureCollection object, so we use the ListFeatureCollection + * class to wrap our list of features. + */ + SimpleFeatureCollection collection = new ListFeatureCollection(TYPE, features); + featureStore.setTransaction(transaction); + try { + featureStore.addFeatures(collection); + transaction.commit(); + } catch (Exception problem) { + problem.printStackTrace(); + transaction.rollback(); + } finally { + transaction.close(); + } + System.exit(0); // success! + } else { + System.out.println(typeName + " does not support read/write access"); + System.exit(1); + } + } + + /** + * Prompt the user for the name and path to use for the output shapefile + * + * @param csvFile the input csv file used to create a default shapefile name + * @return name and path for the shapefile as a new File object + */ + private static File getNewShapeFile(File csvFile) { + String path = csvFile.getAbsolutePath(); + String newPath = path.substring(0, path.length() - 4) + ".shp"; + + JFileDataStoreChooser chooser = new JFileDataStoreChooser("shp"); + chooser.setDialogTitle("Save shapefile"); + chooser.setSelectedFile(new File(newPath)); + + int returnVal = chooser.showSaveDialog(null); + + if (returnVal != JFileDataStoreChooser.APPROVE_OPTION) { + // the user cancelled the dialog + System.exit(0); + } + + File newFile = chooser.getSelectedFile(); + if (newFile.equals(csvFile)) { + System.out.println("Error: cannot replace " + csvFile); + System.exit(0); + } + + return newFile; + } + + /** + * Here is how you can use a SimpleFeatureType builder to create the schema for your shapefile + * dynamically. + *

+ * This method is an improvement on the code used in the main method above (where we used + * DataUtilities.createFeatureType) because we can set a Coordinate Reference System for the + * FeatureType and a a maximum field length for the 'name' field dddd + */ + private static SimpleFeatureType createFeatureType() { + SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); + builder.setName("Location"); + builder.setCRS(DefaultGeographicCRS.WGS84); // <- Coordinate reference system + + // add attributes in order + builder.add("the_geom", Point.class); + builder.length(15).add("Name", String.class); // <- 15 chars width for name field + builder.add("number",Integer.class); + + // build the type + return builder.buildFeatureType(); + } +} \ No newline at end of file diff --git a/src/main/java/org/geotools/tutorial/quickstart/Quickstart.java b/src/main/java/org/geotools/tutorial/quickstart/Quickstart.java new file mode 100644 index 0000000..2e14d66 --- /dev/null +++ b/src/main/java/org/geotools/tutorial/quickstart/Quickstart.java @@ -0,0 +1,44 @@ +package org.geotools.tutorial.quickstart; + +import org.geotools.data.FileDataStore; +import org.geotools.data.FileDataStoreFinder; +import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.map.FeatureLayer; +import org.geotools.map.Layer; +import org.geotools.map.MapContent; +import org.geotools.styling.SLD; +import org.geotools.styling.Style; +import org.geotools.swing.JMapFrame; +import org.geotools.swing.data.JFileDataStoreChooser; + +import java.io.File; + + +/** + * Hello world! + */ +public class Quickstart { + public static void main(String[] args) throws Exception { +// // display a data store file chooser dialog for shapefiles +// File file = JFileDataStoreChooser.showOpenFile("shp", null); +// if (file == null) { +// return; +// } + File file = new File("res/quickstart/ne_50m_admin_0_countries.shp"); + + + FileDataStore store = FileDataStoreFinder.getDataStore(file); + SimpleFeatureSource featureSource = store.getFeatureSource(); + + // Create a map content and add our shapefile to it + MapContent map = new MapContent(); + map.setTitle("Quickstart"); + + Style style = SLD.createSimpleStyle(featureSource.getSchema()); + Layer layer = new FeatureLayer(featureSource, style); + map.addLayer(layer); + + // Now display the map + JMapFrame.showMap(map); + } +} \ No newline at end of file diff --git a/src/test/java/org/geotools/quickstart/QuickstartTest.java b/src/test/java/org/geotools/quickstart/QuickstartTest.java new file mode 100644 index 0000000..aec444e --- /dev/null +++ b/src/test/java/org/geotools/quickstart/QuickstartTest.java @@ -0,0 +1,38 @@ +package org.geotools.quickstart; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple Quickstart. + */ +public class QuickstartTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public QuickstartTest(String testName) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( QuickstartTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +}