Add vector tile and layer in debug client for AreaStops - #4565
Conversation
|
What if we create a new endpoint and enable it when If you want it to part of the regular vector tiles endpoint, you can add a mapping in router-config.json. |
|
I will split the vector tiles API in tow, one as is in sandbox, and one in the core OTP code, which has a fixed set of debug layers. |
t2gran
left a comment
There was a problem hiding this comment.
I a not qualified to review the JS code, but the rest looks ok.
| /* This program is free software: you can redistribute it and/or | ||
| modify it under the terms of the GNU Lesser General Public License | ||
| as published by the Free Software Foundation, either version 3 of | ||
| the License, or (at your option) any later version. | ||
|
|
||
| This program is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License for more details. | ||
|
|
||
| You should have received a copy of the GNU General Public License | ||
| along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ |
There was a problem hiding this comment.
Should we remove this from all js files?
I think that is safe according to our LICENCE.md file.
Required for compatibility with jts version 1.17
61db73a to
38eb276
Compare
Codecov ReportBase: 60.70% // Head: 60.69% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #4565 +/- ##
=============================================
- Coverage 60.70% 60.69% -0.02%
- Complexity 12240 12242 +2
=============================================
Files 1579 1584 +5
Lines 63414 63450 +36
Branches 6990 6987 -3
=============================================
+ Hits 38498 38508 +10
- Misses 22740 22768 +28
+ Partials 2176 2174 -2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
| </dependency> | ||
| <dependency> | ||
| <groupId>com.wdtinc</groupId> | ||
| <groupId>io.github.ci-cmg</groupId> |
There was a problem hiding this comment.
I took a look at this fork. If I'm not mistaken, the only thing it adds is the migration to a newer JTS version. Am I seeing this correctly?
wdtinc/mapbox-vector-tile-java@master...CI-CMG:mapbox-vector-tile:master
There was a problem hiding this comment.
Yes, that is correct. We use a newer version of JTS, and the previous one crashed on serializing polylines.
|
I tried it out with IBI's flex feeds in Atlanta and Seattle and it works really well. |
t2gran
left a comment
There was a problem hiding this comment.
In this review I was "very" picky, I normally try not to - sorry for that. Things like using the least open access modifier should not take extra time when writing code - the default should be private.
| import org.locationtech.jts.geom.Envelope; | ||
|
|
||
| /* http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames */ | ||
| public class WebMercatorTile { |
There was a problem hiding this comment.
In this class there is a mixture of (y, x) and (lat, lon). I would prefer to stick to (lat, lon). Then in the JavaDoc one the class level we could mention that lat == x and lon == y in JTS. I hope I got it right ;-)
There was a problem hiding this comment.
A JavaDoc comments would be nice. There are also some magic numbers in here witch to me is not obvious what means like tile2lat(y + 1, zoom), 180 and 360.
Most of the method are are public, but not used outside class/package -> convert them to private/package.
There was a problem hiding this comment.
X and Y in this class refer to the x and y index of the map, used in the URL. I added some clarifications to the code and removed unused parts, and made helpers private
| double minLon = tile2lon(x, zoom); | ||
| double maxLon = tile2lon(x + 1, zoom); | ||
| return new Envelope(maxLon, minLon, maxLat, minLat); | ||
| } |
There was a problem hiding this comment.
The first 4 lines of the 2 methods above are duplicates - not sure if there is an easy way to avoid it.
There was a problem hiding this comment.
I converted everything to the JTS envelope.
|
|
||
| public class AreaStopsLayerBuilder extends LayerBuilder<AreaStop> { | ||
|
|
||
| private static final Map<MapperType, BiFunction<TransitService, Locale, PropertyMapper<AreaStop>>> mappers = Map.of( |
There was a problem hiding this comment.
If you give this a name BiFunction<TransitService, Locale, PropertyMapper<AreaStop>> the code become much easier to read. What I mean is to create a private functional interface at the bottom of this class.
| new T2<>("id", input.getId().toString()), | ||
| new T2<>("name", i18NStringMapper.mapNonnullToApi(input.getName())) |
There was a problem hiding this comment.
The T2 class is deleted, you need to make a record here.
| import org.opentripplanner.transit.model.site.AreaStop; | ||
| import org.opentripplanner.transit.service.TransitService; | ||
|
|
||
| public class DebugClientAreaStopPropertyMapper extends PropertyMapper<AreaStop> { |
There was a problem hiding this comment.
All public class definitions and methods should have JavaDoc, except methods inheriting the JavaDoc.
|
The unit test coverage is going down int this PR. |
…into otp2_debug_area_stops
I'm not sure how it works exactly, but if you merge dev-2.x you get more up-do-date coverage data. |
| /** | ||
| * Common functionality for creating a vector tile response. | ||
| */ | ||
| public class VectorTileUtils { |
There was a problem hiding this comment.
Is VectorTileResponseFactory a better name?
91d7f87

Summary
Currently it is not possible to visualize the coverage areas of individual flex areas. Add a vector tile layer and use it in the debug client.
TODO: We need to decide how to do configuration fir this, should we do it automatically or require the user to do it. Currently this requires the vector tile sandbox feature to be enabled and the following layer to be included.EDIT: Now always enabled