Tabnine Logo
PolygonFeatureFactory$Builder
Code IndexAdd Tabnine to your IDE (free)

How to use
PolygonFeatureFactory$Builder
in
org.matsim.core.utils.gis

Best Java code snippets using org.matsim.core.utils.gis.PolygonFeatureFactory$Builder (Showing top 4 results out of 315)

origin: matsim-org/matsim

@Test
public void testShapeFileWriterWithSelfCreatedContent_withMatsimFactory_Polygon() throws IOException {
  String outFile = utils.getOutputDirectory() + "test.shp";
  
  PolygonFeatureFactory ff = new PolygonFeatureFactory.Builder()
      .setName("EvacuationArea")
      .setCrs(DefaultGeographicCRS.WGS84)
      .addAttribute("name", String.class)
      .create();
  
  Coordinate[] coordinates = new Coordinate[]{new Coordinate(0,0),new Coordinate(0,1),new Coordinate(1,1),new Coordinate(0,0)};
  SimpleFeature f = ff.createPolygon(coordinates);
  
  Collection<SimpleFeature> features = new ArrayList<SimpleFeature>();
  features.add(f);
  
  Geometry g0 = (Geometry) f.getDefaultGeometry();
  
  ShapeFileWriter.writeGeometries(features, outFile);
  
  SimpleFeatureSource s1 = ShapeFileReader.readDataFile(outFile);
  SimpleFeatureCollection fts1 = s1.getFeatures();
  SimpleFeatureIterator it1 = fts1.features();
  SimpleFeature ft1 = it1.next();
  Geometry g1 = (Geometry) ft1.getDefaultGeometry();
  
  Assert.assertEquals(g0.getCoordinates().length, g1.getCoordinates().length);
}
origin: matsim-org/matsim

private void initFeatureType(String outputCRS) {
  
  this.polygonFeatureFactory = new PolygonFeatureFactory.Builder().
  setCrs(MGC.getCRS(outputCRS)).
  addAttribute("type", String.class).
  create();
}    

origin: matsim-org/matsim

  public void write(String shpFile) {
    CoordinateReferenceSystem crs = MGC.getCRS(coordinateSystem);

    PolygonFeatureFactory factory = new PolygonFeatureFactory.Builder().addAttribute(ID_HEADER, String.class)
        .setCrs(crs).setName("zone").create();

    List<SimpleFeature> features = new ArrayList<>();
    for (Zone z : zones.values()) {
      String id = z.getId() + "";
      features.add(factory.createPolygon(z.getMultiPolygon(), new Object[] { id }, id));
    }

    ShapeFileWriter.writeGeometries(features, shpFile);
  }
}
origin: matsim-org/matsim

private void initLandUseFeatureType(String landUseType) {
  
  // TODO make CRS adjustable
  
  this.polygonFeatureFactory = new PolygonFeatureFactory.Builder().
  setCrs(MGC.getCRS(TransformationFactory.DHDN_GK4)).
  //setName("buildings").
  setName("land_use").
  addAttribute(landUseType, String.class).
  create();
}    

org.matsim.core.utils.gisPolygonFeatureFactory$Builder

Most used methods

  • <init>
  • addAttribute
  • create
  • setCrs
  • setName

Popular in Java

  • Making http post requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • findViewById (Activity)
  • setRequestProperty (URLConnection)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now