/area/src/main/java/com/saltaku/area/App.java

https://github.com/sztanko/saltaku_mapserver · Java · 78 lines · 28 code · 11 blank · 39 comment · 0 complexity · d086b45e61fd977835bd47ea34d2c6ac MD5 · raw file

  1. package com.saltaku.area;
  2. import java.io.IOException;
  3. import java.net.MalformedURLException;
  4. import java.net.URL;
  5. import org.geotools.feature.SchemaException;
  6. import org.opengis.geometry.MismatchedDimensionException;
  7. import org.opengis.referencing.FactoryException;
  8. import org.opengis.referencing.operation.TransformException;
  9. import com.google.inject.Guice;
  10. import com.google.inject.Injector;
  11. import com.saltaku.area.importer.Importer;
  12. import com.saltaku.area.importer.exceptions.ImportException;
  13. import com.saltaku.area.importer.propertymapper.impl.AttributePropertyMapper;
  14. import com.saltaku.area.importer.store.geometry.impl.ShpGeometryWriter;
  15. /**
  16. * Hello world!
  17. *
  18. */
  19. public class App
  20. {
  21. public static void main( String[] args ) throws ImportException, MalformedURLException
  22. {
  23. Injector injector = Guice.createInjector(new AreaModule());
  24. /*
  25. * Now that we've got the injector, we can build objects.
  26. */
  27. Importer i= injector.getInstance(Importer.class);
  28. /*i.exec(new URL("file:///home/dimi/workspace/core/resources/datasets/shapefiles/xkorvzhn/data_raw.shp"),"file:///tmp/test/test.shp",
  29. new AttributePropertyMapper("LSOA04CD", "LSOA04NM", "LSOA04NM"), new ShpGeometryWriter());*/
  30. /* i.exec(new URL("file:///home/dimi/workspace/core/resources/datasets/shapefiles/xkorvzhn/data_raw.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/lsoa2/data.shp",
  31. new AttributePropertyMapper("LSOA04CD", "LSOA04NM", "LSOA04NM"), new ShpGeometryWriter());
  32. */
  33. //i.exec(new URL("file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/tr/data.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/lsoa2/data.shp",
  34. // new AttributePropertyMapper("LSOA04CD", "LSOA04NM", "LSOA04NM"), new ShpGeometryWriter());
  35. /*i.exec(new URL("file:///home/dimi/workspace/area/data/shapefiles/mystery/nuts/NUTS_RG_03M_2006.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/lsoa3/data.shp",
  36. new AttributePropertyMapper("NUTS_ID", "NUTS_ID", "NUTS_ID"), new ShpGeometryWriter());*/
  37. /*i.exec(new URL("file:///home/dimi/workspace/area/data/shapefiles/mystery/urau/URAU_CITY_RG_03M.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/urau/data.shp",
  38. new AttributePropertyMapper("URAU_CITY_", "URAU_CITY_", "URAU_CITY_"), new ShpGeometryWriter());*/
  39. /*i.exec(new URL("file:///home/dimi/workspace/area/data/shapefiles/tiger/tl_2010_36_zcta510.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/ny/data.shp",
  40. new AttributePropertyMapper("Zcta5ce10", "Zcta5ce10", "Zcta5ce10"), new ShpGeometryWriter());*/
  41. /* i.exec(new URL("file:///home/dimi/workspace/area/data/shapefiles/ny-blockgroup/tl_2010_36_bg10.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/ny_blockgroup/data.shp",
  42. new AttributePropertyMapper("BLKGRPCE10", "NAMELSAD10", "NAMELSAD10"), new ShpGeometryWriter());*/
  43. /*i.exec(new URL("file:///home/dimi/workspace/area/data/shapefiles/ny-block/tl_2010_36_tabblock10.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/ny_block/data.shp",
  44. new AttributePropertyMapper("BLOCKCE10", "NAME10", "NAME10"), new ShpGeometryWriter());*/
  45. /*i.exec(new URL("file:///home/dimi/workspace/area/data/shapefiles/ny-countysub/tl_2010_36_cousub10.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/ny_countysub/data.shp",
  46. new AttributePropertyMapper("COUSUBFP10", "NAMELSAD10", "NAMELSAD10"), new ShpGeometryWriter());*/
  47. /*i.exec(new URL("file:///home/dimi/workspace/area/data/shapefiles/ny-county/tl_2010_36_county10.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/ny_county/data.shp",
  48. new AttributePropertyMapper("COUNTYNS10", "NAMELSAD10", "NAMELSAD10"), new ShpGeometryWriter());*/
  49. /*i.exec(new URL("file:///home/dimi/workspace/area/data/shapefiles/iceland/ISL_adm2.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/is_2/data.shp",
  50. new AttributePropertyMapper("ID_2", "NAME_2", "NAME_2"), new ShpGeometryWriter());*/
  51. i.exec(new URL("file:///home/dimi/workspace/area/data/shapefiles/iceland/ISL_adm1.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/is_1/data.shp",
  52. new AttributePropertyMapper("ID_1", "NAME_1", "NAME_1"), new ShpGeometryWriter());
  53. /*i.exec(new URL("file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/msoa_raw/data.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/msoa/data.shp",
  54. new AttributePropertyMapper("MSOA04CD", "MSOA04NM", "MSOA04NM"), new ShpGeometryWriter());*/
  55. /*i.exec(new URL("file:///home/dimi/workspace/core/resources/shapefiles/msoa/data_hi.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/msoa/data.shp",
  56. new AttributePropertyMapper("MSOA04CD", "MSOA04NM", "MSOA04NM"), new ShpGeometryWriter());*/
  57. /*i.exec(new URL("file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/lsoa_raw/data.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/lsoa/data.shp",
  58. new AttributePropertyMapper("LSOA04CD", "LSOA04NM", "LSOA04NM"), new ShpGeometryWriter());
  59. */
  60. //i.exec(new URL("file:///home/dimi/workspace/area/data/shapefiles/admin/united_kingdom_administrative.shp"),"/tmp/test.shp");
  61. //These are diva shps:
  62. i.exec(new URL("file:///home/dimi/workspace/area/data/shapefiles/gb/GBR_adm1.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/uk_1/data.shp",
  63. new AttributePropertyMapper("ID_1", "NAME_1", "NAME_1"), new ShpGeometryWriter());
  64. i.exec(new URL("file:///home/dimi/workspace/area/data/shapefiles/gb/GBR_adm2.shp"),"file:///home/dimi/git/saltaku/tileserver/resources/test/shapefiles/uk_2/data.shp",
  65. new AttributePropertyMapper("ID_2", "NAME_2", "NAME_2"), new ShpGeometryWriter());
  66. }
  67. }