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

Aggregation area limits: convert deg2 to grid cells or km2? #882

Open
trevorgerhardt opened this issue Jul 13, 2023 · 1 comment
Open

Aggregation area limits: convert deg2 to grid cells or km2? #882

trevorgerhardt opened this issue Jul 13, 2023 · 1 comment

Comments

@trevorgerhardt
Copy link
Member

A user recently attempted to create an aggregation area that exceeded our 2 deg2 limit. Found here:

/** Maximum area allowed for features in a shapefile upload */
private static final double MAX_FEATURE_AREA_SQ_DEG = 2;

Historically, this limit was in place due to high CPU utilization when rasterizing large files. Is that limitation still justified? Are there other reasons why we were limiting to 2deg2? Could we safely increase this limit?


While considering this, I also wondered why this seems to be the only limitation that we have in deg2. It may have been used due in that location due to the ease in checking size in those units without a conversion. But users don't typically know what 1 deg2 converts to in km2. Or how that lines up with grid cells.

For example, Grids are constructed with WebMercatorExtents, which also limit the size, but by checking the total number of grid cells (currently limited to 5,000,000).

Additionally, GeometryUtils limits bounds size by square kilometers. Setting 975,000 km2 as the maximum (and explicitly noting that it is large enough for California). The limit corresponds to approximately 16 million grid cells at z9. Used here:

public static void checkWgsEnvelopeSize (Envelope envelope, String thingBeingChecked) {
checkWgsEnvelopeRange(envelope);
checkWgsEnvelopeAntimeridian(envelope, thingBeingChecked);
if (roughWgsEnvelopeArea(envelope) > MAX_BOUNDING_BOX_AREA_SQ_KM) {
throw new IllegalArgumentException(String.format(
"Geographic extent of %s (%.0f km2) exceeds limit of %.0f km2.",
thingBeingChecked, roughWgsEnvelopeArea(envelope), MAX_BOUNDING_BOX_AREA_SQ_KM
));
}
}

This GeometryUtils method is used to check the bounds of OSM files, GTFS files, data sources, and opportunity datasets (through Grid.java).

Should we consolidate/standardize our geographic limits to either km2 or grid cell count? Both in terms of the units that we use and the limitations themselves.

@trevorgerhardt trevorgerhardt changed the title Aggregation area limits: convert deg<sup>2</sup> to grid cells or km<sup>2</sup>? Aggregation area limits: convert deg2 to grid cells or km2? Jul 13, 2023
ansoncfit added a commit to conveyal/docs that referenced this issue Aug 9, 2023
The discussion of the 2 square degree limit for individual features should be revised when conveyal/r5#882 is addressed.
@geodarcy
Copy link

geodarcy commented Aug 9, 2023

Just a comment from a user. While you mention that the current limit is big enough for California, I live in Canada. I'm trying to use r5 through an R library. With a previous version of r5, I successfully built a network for all of Canada, but I mostly need to build networks at the provincial level. With the geographic limit, I cannot build a network for most of the provinces. Even if I need to build networks at the city level, due to IT limitations at work, geofabrik.de is the only place to obtain OSM data and the province is the lowest level that can be downloaded. I would really appreciate the spatial limit being removed or greatly increased. (Also, at one point I noticed a limit against OSM data above 85 degrees north. Canada has valid OSM data north of 85 degrees)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants