public static Geometry getGeometryFromShapeFile(String shapefile, int idField) { MyMultiFeatureReader mfr = new MyMultiFeatureReader(); try { mfr.readMultizoneShapefile(shapefile, idField); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException("Cannot read shapefile from " + shapefile); } List<MyZone> list = mfr.getAllZones(); if (list.size() > 1) { LOG.warn("There are multiple shapefiles in " + shapefile); LOG.warn("Only the first will be used as the geographic area."); } MultiPolygon area = list.get(0); return area; }
public SurveyParser(String shapefile, int idField) { this.sc = ScenarioUtils.createScenario(ConfigUtils.createConfig()); this.tripMap = new HashMap<>(); this.zoneMap = new HashMap<>(); this.gridMap = new HashMap<>(); this.propabilityMap = new TreeMap<>(); /* Parse the transport zone shapefile, and add each zone to the Map. */ MyMultiFeatureReader mfr = new MyMultiFeatureReader(); try { mfr.readMultizoneShapefile(shapefile, idField); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException("Could not read transport zones from " + shapefile); } for (MyZone zone : mfr.getAllZones()) { zoneMap.put(zone.getId().toString(), zone); } }