private void readDao(GtfsReader reader) throws IOException { dao = new GtfsRelationalDaoImpl(); reader.setEntityStore(dao); reader.setDefaultAgencyId(getFeedId().getId()); reader.run(); }
reader.setEntityStore(store); reader.setInternStrings(true); reader.setDefaultAgencyId(gtfsFeedId.getId());
@SuppressWarnings("unchecked") public static void main(String[] args) throws IOException { if (args.length != 5) { System.err.println("usage: gtfs_path lat1 lon1 lat2 lon2"); System.exit(-1); } double lat1 = Double.parseDouble(args[1]); double lon1 = Double.parseDouble(args[2]); double lat2 = Double.parseDouble(args[3]); double lon2 = Double.parseDouble(args[4]); CoordinateBounds bounds = new CoordinateBounds(lat1, lon1, lat2, lon2); GtfsReader reader = new GtfsReader(); reader.setDefaultAgencyId("1"); reader.getEntityClasses().retainAll(Arrays.asList(Stop.class)); reader.setInputLocation(new File(args[0])); reader.addEntityHandler(new EntityHandlerImpl(bounds)); reader.run(); }
@SuppressWarnings("unchecked") public static void main(String[] args) throws IOException { if (args.length != 5) { System.err.println("usage: gtfs_path lat1 lon1 lat2 lon2"); System.exit(-1); } double lat1 = Double.parseDouble(args[1]); double lon1 = Double.parseDouble(args[2]); double lat2 = Double.parseDouble(args[3]); double lon2 = Double.parseDouble(args[4]); CoordinateBounds bounds = new CoordinateBounds(lat1, lon1, lat2, lon2); GtfsReader reader = new GtfsReader(); reader.setDefaultAgencyId("1"); reader.getEntityClasses().retainAll(Arrays.asList(Stop.class)); reader.setInputLocation(new File(args[0])); reader.addEntityHandler(new EntityHandlerImpl(bounds)); reader.run(); }
@SuppressWarnings("unchecked") public static void main(String[] args) throws IOException { if (args.length != 5) { System.err.println("usage: gtfs_path lat1 lon1 lat2 lon2"); System.exit(-1); } double lat1 = Double.parseDouble(args[1]); double lon1 = Double.parseDouble(args[2]); double lat2 = Double.parseDouble(args[3]); double lon2 = Double.parseDouble(args[4]); CoordinateBounds bounds = new CoordinateBounds(lat1, lon1, lat2, lon2); GtfsReader reader = new GtfsReader(); reader.setDefaultAgencyId("1"); reader.getEntityClasses().retainAll(Arrays.asList(Stop.class)); reader.setInputLocation(new File(args[0])); reader.addEntityHandler(new EntityHandlerImpl(bounds)); reader.run(); }
@SuppressWarnings("unchecked") public static void main(String[] args) throws IOException { if (args.length != 2) { System.err.println("usage: gtfs_path polygon_path"); System.exit(-1); } Geometry points = readPoints(args[1]); GtfsReader reader = new GtfsReader(); reader.setDefaultAgencyId("1"); reader.getEntityClasses().retainAll(Arrays.asList(Stop.class)); reader.setInputLocation(new File(args[0])); reader.addEntityHandler(new EntityHandlerImpl(points)); reader.run(); }
@SuppressWarnings("unchecked") public static void main(String[] args) throws IOException { if (args.length == 0) { System.err.println("usage: stop-consolidation-file gtfs_path agencyId [gtfs_path agencyId ...]"); System.exit(-1); } EntityHandlerImpl handler = new EntityHandlerImpl(); for (int i = 1; i < args.length; i += 2) { GtfsReader reader = new GtfsReader(); reader.setDefaultAgencyId(args[i + 1]); reader.setInputLocation(new File(args[i])); reader.getEntityClasses().retainAll( Arrays.asList(Agency.class, Stop.class)); reader.addEntityHandler(handler); reader.run(); } Set<AgencyAndId> ids = handler.getIds(); BufferedReader reader = new BufferedReader(new FileReader(args[0])); String line = null; while ((line = reader.readLine()) != null) { if (line.startsWith("#") || line.startsWith("{{{") || line.startsWith("}}}") || line.length() == 0) continue; String[] tokens = line.split("\\s+"); AgencyAndId id = AgencyAndIdLibrary.convertFromString(tokens[0]); if (!ids.contains(id)) System.out.println(id + " <- " + line); } }
@SuppressWarnings("unchecked") public static void main(String[] args) throws IOException { if (args.length != 2) { System.err.println("usage: gtfs_path polygon_path"); System.exit(-1); } Geometry points = readPoints(args[1]); GtfsReader reader = new GtfsReader(); reader.setDefaultAgencyId("1"); reader.getEntityClasses().retainAll(Arrays.asList(Stop.class)); reader.setInputLocation(new File(args[0])); reader.addEntityHandler(new EntityHandlerImpl(points)); reader.run(); }
/**** * Private Methods ****/ private void readGtfs() throws IOException { GenericMutableDao dao = _dao; if (!_entityTransformStrategies.isEmpty()) dao = new DaoInterceptor(_dao); _reader.setEntityStore(dao); if (_agencyId != null) _reader.setDefaultAgencyId(_agencyId); for (File path : _gtfsInputDirectories) { _log.info("reading gtfs from " + path); _reader.setInputLocation(path); _reader.run(); } }
@SuppressWarnings("unchecked") public static void main(String[] args) throws IOException { if (args.length != 2) { System.err.println("usage: gtfs_path polygon_path"); System.exit(-1); } Geometry points = readPoints(args[1]); GtfsReader reader = new GtfsReader(); reader.setDefaultAgencyId("1"); reader.getEntityClasses().retainAll(Arrays.asList(Stop.class)); reader.setInputLocation(new File(args[0])); reader.addEntityHandler(new EntityHandlerImpl(points)); reader.run(); }
private static Collection<Stop> readStopsFromGtfsPath(String path) throws IOException { String defaultAgencyId = null; int index = path.indexOf(File.pathSeparatorChar); if( index != -1) { defaultAgencyId = path.substring(index+1); path = path.substring(0,index); } GtfsReader reader = new GtfsReader(); reader.setInputLocation(new File(path)); if( defaultAgencyId != null) reader.setDefaultAgencyId(defaultAgencyId); reader.readEntities(Agency.class); reader.readEntities(Stop.class); return reader.getEntityStore().getAllEntitiesForType(Stop.class); } }
reader.setDefaultAgencyId(bundle.getDefaultAgencyId()); reader.setInputLocation(bundle.getPath()); for (Map.Entry<String, String> entry : bundle.getAgencyIdMappings().entrySet())
reader.setDefaultAgencyId(bundle.getDefaultAgencyId()); reader.setInputLocation(bundle.getPath()); for (Map.Entry<String, String> entry : bundle.getAgencyIdMappings().entrySet())
private void readReferenceGtfs() throws IOException { _log.info("reading reference GTFS at " + _gtfsReferenceDirectory); GenericMutableDao dao = new GtfsRelationalDaoImpl(); _referenceReader.setEntityStore(dao); if (_agencyId != null) _referenceReader.setDefaultAgencyId(_agencyId); _referenceReader.setInputLocation(_gtfsReferenceDirectory); _referenceReader.run(); _context.setReferenceReader(_referenceReader); }
private static Collection<Stop> readStopsFromGtfsPath(String path, String defaultAgencyId) throws IOException { GtfsReader reader = new GtfsReader(); reader.setInputLocation(new File(path)); if (defaultAgencyId != null) reader.setDefaultAgencyId(defaultAgencyId); reader.readEntities(Agency.class); reader.readEntities(Stop.class); return reader.getEntityStore().getAllEntitiesForType(Stop.class); }
private static Collection<Stop> readStopsFromGtfsPath(String path, String defaultAgencyId) throws IOException { GtfsReader reader = new GtfsReader(); reader.setInputLocation(new File(path)); if (defaultAgencyId != null) reader.setDefaultAgencyId(defaultAgencyId); reader.readEntities(Agency.class); reader.readEntities(Stop.class); return reader.getEntityStore().getAllEntitiesForType(Stop.class); }
reader.setInputLocation(bundle.getPath()); if (bundle.getDefaultAgencyId() != null) reader.setDefaultAgencyId(bundle.getDefaultAgencyId()); reader.readEntities(Stop.class);
public static GtfsContext readGtfs(File path, String defaultAgencyId) throws IOException { GtfsRelationalDaoImpl dao = new GtfsRelationalDaoImpl(); GtfsReader reader = new GtfsReader(); reader.setInputLocation(path); reader.setEntityStore(dao); if (defaultAgencyId != null) reader.setDefaultAgencyId(defaultAgencyId); reader.run(); CalendarService calendarService = createCalendarService(dao); return new GtfsContextImpl(dao, calendarService); }
reader.setDefaultAgencyId(gtfsBundle.getDefaultAgencyId());
reader.setDefaultAgencyId(gtfsBundle.getDefaultAgencyId());