Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java @ 1119:faca1825818e
Write additional attributes ELEVATION and KILOMETER into crosssection track shapefiles.
flys-artifacts/trunk@2626 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 01 Sep 2011 07:04:01 +0000 |
parents | 5b1198c27d43 |
children | 66783d957201 |
comparison
equal
deleted
inserted
replaced
1118:7398280b11a0 | 1119:faca1825818e |
---|---|
57 | 57 |
58 | 58 |
59 public static SimpleFeatureType buildFeatureType( | 59 public static SimpleFeatureType buildFeatureType( |
60 String name, String srs, Class geometryType) | 60 String name, String srs, Class geometryType) |
61 { | 61 { |
62 return buildFeatureType(name, srs, geometryType, null); | |
63 } | |
64 | |
65 | |
66 /** | |
67 * Creates a new SimpleFeatureType using a SimpleFeatureTypeBuilder. | |
68 * | |
69 * @param name The name of the FeatureType. | |
70 * @param srs The SRS (e.g. "EPSG:31466"). | |
71 * @param geometryType The geometry type's class (e.g. Polygon.class). | |
72 * @param attrs Optional. An object with attribute-name/attribute-class | |
73 * pairs where index 0 specifies the name as string and index 1 the type | |
74 * as class. | |
75 * | |
76 * @return a new SimpleFeatureType. | |
77 */ | |
78 public static SimpleFeatureType buildFeatureType( | |
79 String name, String srs, Class geometryType, Object[][] attrs) | |
80 { | |
62 try { | 81 try { |
63 SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); | 82 SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); |
64 CoordinateReferenceSystem crs = CRS.decode(srs); | 83 CoordinateReferenceSystem crs = CRS.decode(srs); |
65 | 84 |
66 builder.setName("flys"); | 85 builder.setName("flys"); |
67 builder.setNamespaceURI("http://www.intevation.de/"); | 86 builder.setNamespaceURI("http://www.intevation.de/"); |
68 builder.setCRS(crs); | 87 builder.setCRS(crs); |
69 builder.setSRS(srs); | 88 builder.setSRS(srs); |
70 | 89 |
71 builder.add("geometry", geometryType, crs); | 90 builder.add("geometry", geometryType, crs); |
91 | |
92 if (attrs != null) { | |
93 for (Object[] attr: attrs) { | |
94 builder.add((String) attr[0], (Class) attr[1]); | |
95 } | |
96 } | |
72 | 97 |
73 return builder.buildFeatureType(); | 98 return builder.buildFeatureType(); |
74 } | 99 } |
75 catch (NoSuchAuthorityCodeException nsae) { | 100 catch (NoSuchAuthorityCodeException nsae) { |
76 } | 101 } |