#21172 closed enhancement (fixed)
[PATCH] Add method to create geometric distances from a point
Reported by: | taylor.smock | Owned by: | Don-vip |
---|---|---|---|
Priority: | normal | Milestone: | 21.07 |
Component: | Core | Version: | |
Keywords: | Cc: |
Description
Use cases:
- Creating sidewalks at specified distances from a road (I really ought to release the plugin where I did this, or fold it into a different plugin)
- Expanding bboxes by a set distance (I'm using this code in the Mapillary plugin to set the expansion of the search bbox for selection)
Attachments (3)
Change History (10)
by , 3 years ago
Attachment: | 21172.patch added |
---|
comment:1 by , 3 years ago
Summary: | [PATCH] Add method to create geometric distances from a point → [Wip PATCH] Add method to create geometric distances from a point |
---|
by , 3 years ago
Attachment: | 21172.2.patch added |
---|
comment:2 by , 3 years ago
Summary: | [Wip PATCH] Add method to create geometric distances from a point → [PATCH] Add method to create geometric distances from a point |
---|
attachment:21172.2.patch has the following additions:
- TestUtils gets a new method,
createTestMatrix
- Tests for the following (using
createTestMatrix
):- Projection: EPSG:3857 (WGS84)
- Latitudes: 0, 89, -89
- Longitudes: 0, -179, 179
- Angles: 0, 90, 180, 270, 15, 30, 45, 60, 75
- Distances: 1, 10, 100, 1000, 10000
The second point means there are 1 * 3 * 3 * 9 * 5 = 405
separate tests. The test checks that the expected distance between the new point and the original point are correct, and that the bearing from the original point to the new point matches the expected angle. On my machine, the 405 tests takes ~1 minute. The test matrix can probably be reduced (I'll upload another patch with that done).
by , 3 years ago
Attachment: | 21172.3.patch added |
---|
Drop some angles and distances from the test matrix (1 minute -> 14 seconds)
comment:3 by , 3 years ago
Milestone: | → 21.07 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
follow-up: 6 comment:5 by , 3 years ago
Would it be possible to make this function available in mapcss? Atm, I think about validator like #17188 or checking that footway=sidewalk
has a nearby main road, though, it might be useful for styles, too.
comment:6 by , 3 years ago
Replying to skyper:
Would it be possible to make this function available in mapcss? Atm, I think about validator like #17188 or checking that
footway=sidewalk
has a nearby main road, though, it might be useful for styles, too.
Probably. How would it be used?
Possible example:
node[bus=yes][public_transport=stop_position] !<some random symbol, e.g. □>(0, 5) node[highway=bus_stop] { throwError("Bad public transport stop"); }
I can't think of a good way to just make a function, as I don't think our MapCSS implementation would allow us to parse recursive MapCSS, although I could be wrong (I haven't checked). Example:
node[bus=yes][public_transport=stop_position][distance(node[highway=bus_stop], 0, 5)] { throwError("Bad public transport stop"); }
The function definition would look something like this:
public List<IPrimitive> nearbyPrimitives(Predicate<OsmPrimitive> predicate, double minDistance, double maxDistance)
Add tests, correct math