Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select Link custom modification #924

Draft
wants to merge 12 commits into
base: dev
Choose a base branch
from
8 changes: 5 additions & 3 deletions src/main/java/com/conveyal/gtfs/GTFSCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public class GTFSCache implements Component {
// The following two caches hold spatial indexes of GTFS geometries for generating Mapbox vector tiles, one spatial
// index per feed keyed on BundleScopedFeedId. They could potentially be combined such that cache values are a
// compound type holding two indexes, or cache values are a single index containing a mix of different geometry
// types that are filtered on iteration. They could also be integreated into the GTFSFeed values of the main
// GTFSCache#cache. However GTFSFeed is already a very long class, and we may want to tune eviction parameters
// types that are filtered on iteration. They could also be integrated into the GTFSFeed values of the main
// GTFSCache#cache. However, GTFSFeed is already a very long class, and we may want to tune eviction parameters
// separately for GTFSFeed and these indexes. While GTFSFeeds are expected to incur constant memory use, the
// spatial indexes are potentially unlimited in size and we may want to evict them faster or limit their quantity.
// spatial indexes are potentially unlimited in size, so we may want to evict them faster or limit their quantity.
// We have decided to keep them as separate caches until we're certain of the chosen eviction tuning parameters.

/** A cache of spatial indexes of TripPattern shapes, keyed on the BundleScopedFeedId. */
Expand Down Expand Up @@ -127,6 +127,8 @@ public FileStorageKey getFileKey (String id, String extension) {
// The feedId of the GTFSFeed objects may not be unique - we can have multiple versions of the same feed
// covering different time periods, uploaded by different users. Therefore we record another ID here that is
// known to be unique across the whole application - the ID used to fetch the feed.
// NOTE as of 2023, this is no longer true. All uploaded feeds have assigned unique UUIDs so as far as I know
// they can't collide, we don't need this uniqueId field, and we may not even need bundle-scoped feed IDs.
feed.uniqueId = id;
return feed;
}
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/com/conveyal/gtfs/GTFSFeed.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,18 @@ public class GTFSFeed implements Cloneable, Closeable {
/** The MapDB database handling persistence of Maps to a pair of disk files behind the scenes. */
private DB db;

/** An ID (sometimes declared by the feed itself) which may remain the same across successive feed versions. */
/**
* An ID (sometimes declared by the feed itself) which may remain the same across successive feed versions.
* In R5 as of 2023 this is always overwritten with a unique UUID to avoid problems with successive feed versions
* or edited/modified versions of the same feeds.
*/
public String feedId;

/**
* This field was merged in from the wrapper FeedSource. It is a unique identifier for this particular GTFS file.
* Successive versions of the data for the same operators, or even different copies of the same operator's data
* uploaded by different people, should have different uniqueIds.
* In practice this is mostly copied into WrappedGTFSEntity instances used in the Analysis GraphQL API.
* In R5 as of 2023, this field will contain the bundle-scoped feed ID used to fetch the feed object from the
* GTFSCache (but is not present on disk or before saving - only after it's been reloaded from a file by the cache).
*/
public transient String uniqueId; // set this to feedId until it is overwritten, to match FeedSource behavior
public transient String uniqueId;

// All tables below should be MapDB maps so the entire GTFSFeed is persistent and uses constant memory.

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/conveyal/gtfs/GeometryCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* LoadingCache so should be thread safe and provide granular per-key locking, which is convenient when serving up
* lots of simultaneous vector tile requests.
*
* This is currently used only for looking up geomertries when producing Mapbox vector map tiles, hence the single
* This is currently used only for looking up geometries when producing Mapbox vector map tiles, hence the single
* set of hard-wired cache eviction parameters. For more general use we'd want another constructor to change them.
*/
public class GeometryCache<T extends Geometry> {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/conveyal/r5/analyst/Grid.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
Expand Down Expand Up @@ -170,7 +171,8 @@ public List<PixelWeight> getPixelWeights (Geometry geometry, boolean relativeToP

double area = geometry.getArea();
if (area < 1e-12) {
throw new IllegalArgumentException("Feature geometry is too small");
LOG.warn("Discarding feature. Its area is too small to serve as a denominator ({} square degrees).", area);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return Collections.EMPTY_LIST;
}

if (area > MAX_FEATURE_AREA_SQ_DEG) {
Expand Down
Loading
Loading