21 package org.matsim.utils.gis.matsim2esri.network;
23 import org.geotools.api.feature.simple.SimpleFeature;
24 import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
25 import org.geotools.feature.simple.SimpleFeatureBuilder;
26 import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
27 import org.locationtech.jts.geom.Coordinate;
28 import org.locationtech.jts.geom.GeometryFactory;
29 import org.locationtech.jts.geom.LineString;
38 private final CoordinateReferenceSystem
crs;
39 private final GeometryFactory
geofac;
45 this.geofac =
new GeometryFactory();
51 SimpleFeatureTypeBuilder typeBuilder =
new SimpleFeatureTypeBuilder();
52 typeBuilder.setName(
"link");
53 typeBuilder.setCRS(this.crs);
54 typeBuilder.add(
"the_geom", LineString.class);
55 typeBuilder.add(
"ID", String.class);
56 typeBuilder.add(
"fromID", String.class);
57 typeBuilder.add(
"toID", String.class);
58 typeBuilder.add(
"length", Double.class);
59 typeBuilder.add(
"freespeed", Double.class);
60 typeBuilder.add(
"capacity", Double.class);
61 typeBuilder.add(
"lanes", Double.class);
62 typeBuilder.add(
"visWidth", Double.class);
63 typeBuilder.add(
"type", String.class);
65 this.builder =
new SimpleFeatureBuilder(typeBuilder.buildFeatureType());
71 double width = this.widthCalculator.
getWidth(link);
75 Object [] attribs =
new Object[10];
77 attribs[1] = link.
getId().toString();
88 return this.builder.buildFeature(null, attribs);
89 }
catch (IllegalArgumentException e) {
final CoordinateReferenceSystem crs
final GeometryFactory geofac
static String getType(Node node)
LineStringBasedFeatureGenerator(final WidthCalculator widthCalculator, final CoordinateReferenceSystem crs)
SimpleFeature getFeature(final Link link)
double getNumberOfLanes()
double getWidth(Link link)
final WidthCalculator widthCalculator
SimpleFeatureBuilder builder