The Route360°- PolygonService
PolygonService is used to query the Route360° Service to get travel time polygons starting from a specified source point or a list of source points. The service has only one method
getTravelTimePolygons which is configured via
TravelOptions. The returned polygons represent the reachable area from a point (or points) of origin within a given travel time. The query can be parameterized by travel times, mode of travel and other parameters provided using the
travelOptions object. The resulting object can be be displayed in either LeafletJS or the Google Maps API.
Multiple travel time polygons
Sometimes it might be useful to visualize multiple travel time polygons on the same map
In order to generate the polygons, on or more source points needs to be provided. You can use the
TravelOptions.addSource(src) to add one or
TravelOptions.setSources(src) method to set all source points. If you set multiple source points you have to decide which polygon intersection mode you want to use. Furthermore you can set the
travelType for each source point individually by setting a travelType to each source. The default intersection mode is average, however the API supports three different modes:
The union option means that no intersection of the polygons is performed. We merge the polygons generated on the server side to reduce file size. So each marker has its independent travel time polygons.
The intersection option generates an intersection of the polygons generated for all source points. This means that no independent polygons exist anymore, e.g. the polygon representing the 10 minute area (as shown in the image below) is the area that is reachable from both source points in 10 minutes.
Intersection method is available at plan level basic and above.
The average options generates polygons based the average travel time for all source points. This means that an individual travel time can be higher than the travel time boundary, as shown in the picture below, as long as the average total travel time for all source points to a specific target (the marker with the !) is lower than the travel time boundary.
Average method is available at plan level pro and above.
To customize your polygons, you can specify the travel times for which you want to generate polygons. The defaults for this service are
walk with polygons for 5 to 30 minutes in 5 minutes steps.
Polygon travel times are limited by plan level. Check our plans for details.
You can set the travel type with
TravelOptions.setTravelType('type'), where 'type' is one of the following four options:
This returns polygons which indicate the area which is reachable by foot. The default travel speed is 5 km/h, but you can set
TravelOptions.setWalkSpeed(number) to set your desired speed. If elevation is enabled for your area, you can configure penalties and awards for up/down hill travel. If you want to penalize uphill travel, you can set
TravelOptions.setWalkUphill(penalty) to a high value (default is 10), or if you want to reward downhill travel you can set
TravelOptions.setDownhill(award) with a positive value (the default is 0, so no award).
This returns polygons which indicate the area which is by bike. The default travel speed is 15 km/h, but you can set
TravelOptions.setBikeSpeed(number) to set your desired speed. As with
walk, if elevation is enabled for your area, you can configure penalties and awards for up/down hill travel. If you want to penalize uphill travel, you can set
TravelOptions.setBikeUphill(penalty) to a high value (default is 20), or if you want to reward downhill travel you can set
TravelOptions.setDownhill(award) with a positive value (the default is -10).
This returns polygons which mark the area which are only reachable by bike. The default travel speed is determined by the speed limit tagged to a certain street in OpenStreetMaps. This option also considers one-way streets and traffic lights and other turning restrictions.
This returns polygons which mark the area which are reachable by transit. We perform a 'walk'-routing step from the starting point to the first transit station and from the last transit station to the target point. The connections are determined by the GTFS data supplied by the travel agencies of the given area. You can additionally set these parameters:
This represents the time from when on a transit connection should be found. The time is represented by the difference, measured in seconds, between the current time and midnight, of today. For 2:45pm this would be ((45 60) + (14 60 * 60)) = 53100. This defaults to the current time and can be set by
TravelOptions.setTime(seconds). You can also use the
r360.Util.getHoursAndMinutesInSeconds() method to get the current time.
This represents the date on which a transit connection should be found. The format of the date is YYYYMMDD, e.g.: 20150731 for the 31st of July in 2015. This defaults to the current date. You can also use the
r360.Util.getCurrentDate() method to obtain a valid date for the service.
The colors of the polygons is fully configurable. Using the
setColors() method of the polygon layer, you can define any color scheme you want. You can additionally Set inverse polygons, which mask out the unreachable areas, as opposed to coloring the reachable areas.
Default Route360° mode
Color blind mode
High contrast mode
Minimum polygon hole size
Minimum polygon hole size is the area threshold of a hole inside a polygon which should not be filled with the corresponding polygon color, this is useful if you want to reduce the (file) size of the returned polygon (at the cost of reduced accuracy). This becomes very visible in areas that are not accessible - we may show a park as accessible to cars if it is smaller than the minimum hole size. is makes the polygons less complex, and better looking, but the middle of the park isn't technically accessible by car. This can be mitigated by modifying the minimum hole size, if accuracy is more important than presentation.
Minimum hole size is limited by plan level. Check our plans for details.
Minimum hole size comparison
Smaller minimum hole size can exclude inaccessible areas from the polygons at the cost of speed and beauty