loading all routes

302 views
Skip to first unread message

Ommel

unread,
Oct 4, 2013, 4:53:41 AM10/4/13
to opentripp...@googlegroups.com
Hi and Good Day to all,

How can I load all the routes that my Graph object has?

Do I have to put something on the graph builder xml config file?

Thanks,
Ommel

Laurent GRÉGOIRE

unread,
Oct 8, 2013, 3:42:19 AM10/8/13
to opentripp...@googlegroups.com
Hi Ommel,

On 04/10/2013 10:53, Ommel wrote:
> How can I load all the routes that my Graph object has?

Do you need to load them as a web-service interface or to access them in
the java code?

> Do I have to put something on the graph builder xml config file?

Not specially, if you have specified a GTFS file to load the route will
be loaded part of that process.

HTH,

--Laurent

Ommel

unread,
Oct 21, 2013, 5:43:01 AM10/21/13
to opentripp...@googlegroups.com
Hi Laurent,

Sorry for the very late reply. Been busy for 2 weeks.

Anyway, Yes I want them to load as a web-service interface.

Is it possible to load only one route using the route id? I already tried it but otp did not give me any result.

Thanks!!

Andrew Byrd

unread,
Oct 21, 2013, 5:49:29 AM10/21/13
to opentripp...@googlegroups.com
What do you mean by "load a route"? What is it being loaded into, and
what is the desired outcome?

Please give a detailed description of what you want to achieve.

-Andrew

On 10/21/2013 05:43 PM, Ommel wrote:
> Hi Laurent,
>
> Sorry for the very late reply. Been busy for 2 weeks.
>
> Anyway, Yes I want them to load as a web-service interface.
>
> Is it possible to load only one route using the route id? I already
> tried it but otp did not give me any result.
>
> Thanks!!
>
> On Tuesday, October 8, 2013 3:42:19 PM UTC+8, Laurent Gr�goire wrote:
>
> Hi Ommel,
>
> On 04/10/2013 10:53, Ommel wrote:
> > How can I load all the routes that my Graph object has?
>
> Do you need to load them as a web-service interface or to access
> them in
> the java code?
>
> > Do I have to put something on the graph builder xml config file?
>
> Not specially, if you have specified a GTFS file to load the route will
> be loaded part of that process.
>
> HTH,
>
> --Laurent
>
> --
> You received this message because you are subscribed to the Google
> Groups "OpenTripPlanner Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to opentripplanner...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Ommel

unread,
Oct 21, 2013, 6:01:54 AM10/21/13
to opentripp...@googlegroups.com
Hi Andrew,

Sorry if my question is not clear.

I mean, is it possible to get the route information of a bus or train going to a certain location using the /transit/routeData api call.

http://www.opentripplanner.org/apidoc/0.9.2/resource_TransitIndex.html#path__transit_routeData.html

I'll be using the data given by the planner api response.

Does /transit/routeData response gives the geometry of the route?

I hope I made myself clear now. :D

Thanks

Ommel

unread,
Oct 23, 2013, 3:58:27 AM10/23/13
to opentripp...@googlegroups.com
Bump and Good Day,

How can I get the shape of the route? using an api call.

Do I have to config something on the files on my otp server? for this to work.

Thanks

Laurent GRÉGOIRE

unread,
Oct 23, 2013, 1:07:24 PM10/23/13
to opentripplanner-dev
cc opentripplanner-dev.

---------- Forwarded message ----------
From: Laurent GRÉGOIRE <laurent....@gmail.com>
Date: 23 October 2013 18:32
Subject: Re: [OpenTripPlanner] loading all routes
To: Ommel <ommel.an...@gmail.com>

Hi Ommel,


On 23/10/2013 09:58, Ommel wrote:
> How can I get the shape of the route? using an api call.
>
> Do I have to config something on the files on my otp server? for this to
> work.

Currently AFAIK there is no such API call:

The shape of a route in the GTFS specs (and in OTP too) is a collection
of polylines, as potentially every trip can have a different shape.
Currently OTP assign each route trip to a specific "variant", a variant
being defined by a unique ordered list of stops.

Even if most of the time the geometrical shape of all trips for one
variant would be the same, in general this potentially could not be the
case. A general algorithm trying to make the union of this set to
generate a "unique" shape for a route could be theorically implemented,
but the implementation, altough possible, is probably not trivial; also
the term "route shape" can have different meanings for different use
cases (graph-like, collection of shapes, directed/non-directed...)

However an API call for getting the shape for a particular trip would be
much easier to implement, it's just a model class and a REST method.

HTH,

--Laurent


Tuukka Hastrup

unread,
Oct 23, 2013, 2:09:00 PM10/23/13
to opentripp...@googlegroups.com

Here's some example code that (given a leg from an itinerary) fetches the route (variant) geometry via the OTP TransitIndex method variantForTrip, decodes it to normal WGS84 and draws it on a Leaflet map:

$.getJSON otp_base_url + "transit/variantForTrip", {tripId: leg.tripId, tripAgency: leg.agencyId}, (data) ->
    geometry = data.geometry
    points = (new L.LatLng(point[0]*1e-5, point[1]*1e-5) for point in decode_polyline(geometry.points, 2))
    line_layer = new L.Polyline(points)
    line_layer.addTo(map)

decode_polyline here is decode from https://github.com/ahocevar/openlayers/blob/bbc73a21d865b8e6756ae2e759bec5e0c2742f42/lib/OpenLayers/Format/EncodedPolyline.js#L104


Hoping this helps,
Tuukka
--
You received this message because you are subscribed to the Google Groups "OpenTripPlanner Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opentripplanner...@googlegroups.com.

Ommel

unread,
Oct 24, 2013, 1:41:57 AM10/24/13
to opentripp...@googlegroups.com
Thanks for the reply Laurent and Tuukka

What I really want to achieve is like Trimet's Routes List

http://ride.trimet.org/?lang=t&from=SAFEWAY+-+WOODSTOCK&to=CANYON+PLACE+SHOPPING+CENTER&after=9:07+pm&on=10/23/13&min=T&walk=0.9999&mode=A&xo=45.4792&yo=-122.6163&xd=45.4923&yd=-122.7977&id=7016&mapit=Y&submit=Plan+trip#/submit&fromPlace=SAFEWAY - WOODSTOCK::45.479200,-122.616300&toPlace=CANYON PLACE SHOPPING CENTER::45.492300,-122.797700&mode=TRANSIT,WALK&min=QUICK&maxWalkDistance=1609&time=9:07 pm&date=10/23/13&arriveBy=false&itinID=1&wheelchair=&preferredRoutes=&unpreferredRoutes=

check Trimet Route Tab. I need to load all the routes available from my build and get the route shape when I chooses a route.

I just found out this one yesterday that's why its hard for me to explain what I really need from my previous messages.

Again Thanks!!

On Thursday, October 24, 2013 2:09:00 AM UTC+8, Tuukka Hastrup wrote:

Here's some example code that (given a leg from an itinerary) fetches the route (variant) geometry via the OTP TransitIndex method variantForTrip, decodes it to normal WGThanks for your reS84 and draws it on a Leaflet map:
To unsubscribe from this group and stop receiving emails from it, send an email to opentripplanner-dev+unsub...@googlegroups.com.

Tuukka Hastrup

unread,
Oct 24, 2013, 2:09:29 AM10/24/13
to opentripp...@googlegroups.com

As Laurent explained, routes don't have a shape but route variants do. Thus, you have to get the list of variants of a route using the /transit/routeData request, and draw the shape of each variant.
To unsubscribe from this group and stop receiving emails from it, send an email to opentripplanner...@googlegroups.com.

Ommel

unread,
Oct 24, 2013, 2:17:00 AM10/24/13
to opentripp...@googlegroups.com
Can you give me an example call for /transit/routeData?

When I'm trying it, it gives me an empty response

like this one. http://166.78.179.20:8080/opentripplanner-api-webapp/ws/transit/routeData?id=LTFRB_PUJ1985&agency=LTFRB

Thanks

Laurent GRÉGOIRE

unread,
Oct 24, 2013, 3:29:34 AM10/24/13
to opentripp...@googlegroups.com
Hi all,

On 24/10/2013 08:09, Tuukka Hastrup wrote:
> As Laurent explained, routes don't have a shape but route variants do.
> Thus, you have to get the list of variants of a route using the
> /transit/routeData request, and draw the shape of each variant.

Indeed I've overlooked the existing geometry returned in the "get route
variant data" call. However please keep in mind that theorically the
GTFS specification never guarantee that all trips from a given variant
will use the same exact shape (variants in OTP are mainly used for
"topological" purposes). Depending on your actual data, assuming an
identical shape for all trips of a given variant is probably safe though.

HTH,

--Laurent

Tuukka Hastrup

unread,
Oct 24, 2013, 3:32:50 AM10/24/13
to opentripp...@googlegroups.com

You don't seem to have any GTFS data loaded into the Graph.obj, as this should include some transitModes elements: http://166.78.179.20:8080/opentripplanner-api-webapp/ws/metadata

Also, if you had GTFS data loaded and TransitIndex generated, this should list the routes: http://166.78.179.20:8080/opentripplanner-api-webapp/ws/transit/routes
To unsubscribe from this group and stop receiving emails from it, send an email to opentripplanner...@googlegroups.com.

Tuukka Hastrup

unread,
Oct 24, 2013, 3:57:52 AM10/24/13
to opentripp...@googlegroups.com
2013-10-24 10:29, Laurent GR�GOIRE kirjoitti:
> On 24/10/2013 08:09, Tuukka Hastrup wrote:
>> As Laurent explained, routes don't have a shape but route variants do.
>> Thus, you have to get the list of variants of a route using the
>> /transit/routeData request, and draw the shape of each variant.
> Indeed I've overlooked the existing geometry returned in the "get route
> variant data" call. However please keep in mind that theorically the
> GTFS specification never guarantee that all trips from a given variant
> will use the same exact shape (variants in OTP are mainly used for
> "topological" purposes).

In theory this may happen, but I'd be interested in seeing this case in
some real dataset, as it would mean the route has multiple shapes going
from one stop to the next.

> Depending on your actual data, assuming an
> identical shape for all trips of a given variant is probably safe though.

Isn't variant a concept defined by OpenTripPlanner though, so we could
as well refine the definition of variant so that when the shapes of two
trips differ then they must belong in different variants as well?

Ommel

unread,
Oct 24, 2013, 5:20:02 AM10/24/13
to opentripp...@googlegroups.com
Hi All,

If the GTFS is not loaded in my Graph.obj file. I have to rebuild.

Here's my graph-builder.xml file

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

    <bean id="gtfsBuilder" class="org.opentripplanner.graph_builder.impl.GtfsGraphBuilderImpl">
        <property name="gtfsBundles">
            <bean id="gtfsBundles" class="org.opentripplanner.graph_builder.model.GtfsBundles">
                <property name="bundles">
                    <list>
                        <bean class="org.opentripplanner.graph_builder.model.GtfsBundle">
                            <property name="url" value="" />
                            <property name="defaultAgencyId" value="TriMet" />

                            <!-- By default, bikes may only be taken along on transit trips if the GTFS data allows them to be.
                                 If the GTFS data doesn't contain appropriate data, but the actual transit trips do allows bikes
                                 to be taken along, a defaultBikesAllowed property may be specified to allow bikes.
                             -->
                            <property name="defaultBikesAllowed" value="true" />
                        </bean>
                    </list>
                </property>
            </bean>
        </property>

        <!-- GTFS-rt ALERTS -->
        <property name="gtfsGraphBuilders">
            <list>
                <bean class="org.opentripplanner.graph_builder.impl.transit_index.TransitIndexBuilder" />
            </list>
        </property>
    </bean>


    <bean id="osmBuilder" class="org.opentripplanner.graph_builder.impl.osm.OpenStreetMapGraphBuilderImpl">
        <!-- Use an OSM provider that reads a file -->
        <property name="provider">
            <bean class="org.opentripplanner.openstreetmap.impl.AnyFileBasedOpenStreetMapProviderImpl">
                <property name="path" value="/otp/cache/osm/latest.osm" />
            </bean>
        </property>

        <!-- Street Traversal Permisssion and Biking weighting is configurable, but we'll use the defaults for OSM...
 
             Street Traversal Permisssion: what modes are allowed on certain road/surface types (e.g., no cars on bike lanes, etc...)

             Bike weighting: the planner is using a 'shortest path' algorithm to choose one route from another.  To prefer certain paths
                             for biking (e.g., bike lanes), we can make the theoretical lenght of a street type shorter or longer, thus
                             more or less attractive to the routing engine.  Weights of > 1.0 make a road type shorter (more attactive)

             @see http://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access-Restrictions
             @see https://github.com/openplans/OpenTripPlanner/blob/master/opentripplanner-graph-builder/src/main/java/org/opentripplanner/graph_builder/impl/osm/DefaultWayPropertySetSource.java
        -->
        <property name="defaultWayPropertySetSource">
            <bean class="org.opentripplanner.graph_builder.impl.osm.DefaultWayPropertySetSource" />
        </property>

        <!-- custom unamed street namer -->
        <property name="customNamer">
            <bean class="org.opentripplanner.graph_builder.impl.osm.PortlandCustomNamer" />
        </property>
    </bean>


    <bean id="nedBuilder" class="org.opentripplanner.graph_builder.impl.ned.NEDGraphBuilderImpl">
        <property name="gridCoverageFactory">
                <bean class="org.opentripplanner.graph_builder.impl.ned.NEDGridCoverageFactoryImpl">
                    <property name="cacheDirectory" value="/otp/cache/ned" />
                </bean>
        </property>
    </bean>

    <bean id="transitStreetLink" class="org.opentripplanner.graph_builder.impl.TransitToStreetNetworkGraphBuilderImpl" />
    <bean id="checkGeometry" class="org.opentripplanner.graph_builder.impl.CheckGeometryGraphBuilderImpl" />
    <bean id="mapBuilder" class="org.opentripplanner.graph_builder.impl.map.MapBuilder"/>

    <bean id="graphBuilderTask" class="org.opentripplanner.graph_builder.GraphBuilderTask">
        <!-- typical config -->
        <property name="path" value="/OpenTripPlanner" />

        <property name="graphBuilders">
            <list>
                <ref bean="gtfsBuilder" />
                <ref bean="osmBuilder" />
                <ref bean="mapBuilder" />
                <ref bean="checkGeometry" />
<!-- NED builder commented out - ->
                <ref bean="nedBuilder" />
<!- - -->
                <ref bean="transitStreetLink" />
            </list>
        </property>
    </bean>
</beans>

I emptied the Gtfs bundle. if you need the gtfs bundle zip I can email the link to Tuukka.
Can you help me to figure out how to load the gtfs bundle into my graph object file?

Many Thanks!!!

Andrew Byrd

unread,
Oct 24, 2013, 5:39:38 AM10/24/13
to opentripp...@googlegroups.com
Yes, it is an OTP concept, not a GTFS one and could be redefined.
However, I imagine that multiple shapes for a single variant (i.e.
vehicles can take multiple different paths when traveling along the
exact same sequence of stops) is very rare, perhaps rare enough that
even if an example can be found it's not worth adding special logic to
support.

-Andrew

Laurent GRÉGOIRE

unread,
Oct 24, 2013, 5:42:45 AM10/24/13
to Tuukka Hastrup, opentripp...@googlegroups.com
On 24/10/2013 09:57, Tuukka Hastrup wrote:
> In theory this may happen, but I'd be interested in seeing this case in
> some real dataset, as it would mean the route has multiple shapes going
> from one stop to the next.

It's indeed probably unusual. I can see a scenario however where during
certain hours a certain portion of the road network is closed and a bus
would take a detour to avoid it (city center during days, rush
hours...). Also a long distance bus/coach route may switch between
different options between two stops, depending on the date/time to
optimize time by avoiding traffic.

However in most of the case the end-user would not really care as stops
would remain the same. I'm not sure this is a really important issue, as
long as the geometry is only used for display purposes.

Writing this, I'm thinking of on-board depart planning mode that we
recently implemented, which rely on intra-stop route geometry to find
and interpolate the estimated remaining time of the current hop. For
this particular case (long distance varying route geometry) we could
theorically end-up with imprecise or wrong results. This scenario has
not been though of; but so far no issues have been raised.

>> Depending on your actual data, assuming an
>> identical shape for all trips of a given variant is probably safe though.
>
> Isn't variant a concept defined by OpenTripPlanner though, so we could
> as well refine the definition of variant so that when the shapes of two
> trips differ then they must belong in different variants as well?

AFAIK variants are used for defining what a schedule pattern is, and the
routing algorithm is optimized to take this into account (one state per
route variant at each board edge for example). Duplicating variants for
distinct geometry could be dangerous performance-wise, as you could
end-up with a degenerate case where you have one variant per trip:
comparing geometry is not always exact, and you could have a
badly-behaved GTFS generating process that create a new shape for each
trip, by using slighly different sampling points for example (especially
that coordinates are stored in floating-point decimal format, which are
not well-known for their numerical stability...) So you end up relying
on a fuzzy geometry comparison algorithm. A better/simpler option may be
to store for each variant a list of geometries, and keeping a "trip ID
-> geometry" index.

HTH,

--Laurent

Andrew Byrd

unread,
Oct 25, 2013, 1:48:25 AM10/25/13
to opentripp...@googlegroups.com
On Thursday, October 24, 2013 5:20:02 PM UTC+8, Ommel wrote:
Here's my graph-builder.xml file
[...]

    <bean id="gtfsBuilder" class="org.opentripplanner.graph_builder.impl.GtfsGraphBuilderImpl">
        <property name="gtfsBundles">
            <bean id="gtfsBundles" class="org.opentripplanner.graph_builder.model.GtfsBundles">
                <property name="bundles">
                    <list>
                        <bean class="org.opentripplanner.graph_builder.model.GtfsBundle">
                            <property name="url" value="" />
                            <property name="defaultAgencyId" value="TriMet" />


 Your URL property is empty, so I suppose the problem is that you are not providing any GTFS feed. Try this instead:
<bean class="org.opentripplanner.graph_builder.model.GtfsBundle">
  <property name="url" value="http://developer1.trimet.org/schedule/gtfs.zip"/>
  <property name="defaultAgencyId" value="TriMet"/>
  <property name="defaultBikesAllowed" value="true"/>
</bean>


-Andrew

Ommel

unread,
Nov 5, 2013, 1:16:55 AM11/5/13
to opentripp...@googlegroups.com
I really left the url blank, it loads the gtfs during the graph build.
my colleague modified the tram shapes and fares, it was loaded in the api call response.
http://166.78.179.20:8080/opentripplanner-webapp/ here's the trip planner.
http://166.78.179.20:8080/opentripplanner-api-webapp/ws/metadata as tuukka stated, GTFS data are not loaded in my Graph.obj file, I'm very confused at this one since my trip planner is working.

Is there something wrong with my graph builder config? or there's a problem with our gtfs data?

Thanks!!!

Laurent GRÉGOIRE

unread,
Nov 5, 2013, 3:12:34 AM11/5/13
to opentripp...@googlegroups.com
Hi,

On 05/11/2013 07:16, Ommel wrote:
> I really left the url blank, it loads the gtfs during the graph build.

If you leave the URL blank, I can't see how the builder can load the
GTFS data (there is currently no black magic in OTP). I think you should
double-check if you see any GTFS loading output in your graph building
process in the first place.

HTH,

--Laurent

Ommel

unread,
Nov 5, 2013, 3:43:27 AM11/5/13
to opentripp...@googlegroups.com
I mean on this post, I left the url blank but in my graph builder file I got a GTFS data. Sorry for the confusion.

Laurent GRÉGOIRE

unread,
Nov 5, 2013, 3:46:38 AM11/5/13
to opentripp...@googlegroups.com
On 05/11/2013 09:43, Ommel wrote:
> I mean on this post, I left the url blank but in my graph builder file I
> got a GTFS data. Sorry for the confusion.

Ha OK. It could be that your GTFS data is expired, you can check that
too. And please carefully inspect the graph builder and server logs, I'm
sure you will find hints for your issue there. OTP is usually quite
verbose but it's handy in case of problem. Activate INFO logs to get a
full picture.

HTH,

--Laurent

Ommel

unread,
Nov 5, 2013, 4:41:16 AM11/5/13
to opentripp...@googlegroups.com

when I clicked on Trip Viewer on my leaflet client (see attached image)

this one's on my local box,

the one on http://166.78.179.20:8080/opentripplanner-webapp/ and my local has the same build, same tomcat installed and otp version

and I looked on the catalina logs

Nov 05, 2013 5:16:50 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Jersey threw exception
java.lang.IllegalArgumentException: Comparison method violates its general contract!
    at java.util.TimSort.mergeHi(TimSort.java:868)
    at java.util.TimSort.mergeAt(TimSort.java:485)
    at java.util.TimSort.mergeCollapse(TimSort.java:410)
    at java.util.TimSort.sort(TimSort.java:214)
    at java.util.TimSort.sort(TimSort.java:173)
    at java.util.Arrays.sort(Arrays.java:659)
    at java.util.Collections.sort(Collections.java:217)
    at org.opentripplanner.api.ws.TransitIndex.getStopTimesForStop(TransitIndex.java:384)
    at sun.reflect.GeneratedMethodAccessor102.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ObjectOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:258)
    at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.opentripplanner.web.authentication.WSSEAuthenticationFilter.doFilter(WSSEAuthenticationFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.opentripplanner.jsonp.JsonpCallbackFilter.doFilter(JsonpCallbackFilter.java:61)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:724)

Thanks again Laurent.

Laurent GRÉGOIRE

unread,
Nov 5, 2013, 7:36:41 AM11/5/13
to opentripp...@googlegroups.com
Hi,

On 05/11/2013 10:41, Ommel wrote:
> java.lang.IllegalArgumentException: Comparison method violates its
> general contract!
> at java.util.TimSort.mergeHi(TimSort.java:868)
> ...
> at java.util.Collections.sort(Collections.java:217)
> at
> org.opentripplanner.api.ws.TransitIndex.getStopTimesForStop(TransitIndex.java:384)

This smells either a bug in OTP or a faulty GTFS -- Collections.sort
require a transitive, symetric and stable compare function which seems
to be not the case. Did you pass your GTFS in the gtfs-validator?

You maybe also want to check if you have the error with the latest version.

If you still have the bug in the latest version and your GTFS is valid,
you can dump the result.stopTimes list just before Collections.sort()
and check if the sort compare function is transitive, and stable (a>b
and b>c => a>c, a>b => b<a), the compare function is probably making
some assumption (I think it suppose that departure *after* arrival for
each stop time -- so a faulty GTFS will break this).

HTH,

--Laurent

Andrew Byrd

unread,
Nov 5, 2013, 7:44:35 AM11/5/13
to opentripp...@googlegroups.com
On 11/05/2013 07:36 PM, Laurent GR�GOIRE wrote:
> Comparison method violates its
> general contract!

This is a bug in a library we depend on. You will find a discussion and
a solution at:
https://groups.google.com/forum/#!msg/opentripplanner-users/JuPegr1uqrM/Q6J-RcwTiysJ

-Andrew

Andrew Byrd

unread,
Nov 5, 2013, 7:46:13 AM11/5/13
to opentripp...@googlegroups.com
Oh, never mind. I just saw that the error is not in an STRTree.

-Andrew

Laurent GRÉGOIRE

unread,
Nov 5, 2013, 7:49:13 AM11/5/13
to opentripp...@googlegroups.com
On 05/11/2013 13:46, Andrew Byrd wrote:
> On 11/05/2013 07:44 PM, Andrew Byrd wrote:
>> On 11/05/2013 07:36 PM, Laurent GRÉGOIRE wrote:
>>> Comparison method violates its
>>> general contract!
> Oh, never mind. I just saw that the error is not in an STRTree.

Indeed, I think this could be caused by the following comparaison
function which seems to assume positive hop time:

Collections.sort(result.stopTimes, new Comparator<StopTime>() {
@Override
public int compare(StopTime o1, StopTime o2) {
if (o1.phase.equals("arrival") &&
o2.phase.equals("departure"))
return 1;
if (o1.phase.equals("departure") &&
o2.phase.equals("arrival"))
return -1;
return o1.time - o2.time > 0 ? 1 : -1;
}
});

So a faulty GTFS may break the sort.

HTH,

--Laurent

Ommel

unread,
Nov 15, 2013, 1:37:53 AM11/15/13
to opentripp...@googlegroups.com
Hi to all,

Sorry for another very late reply.

I modified the gtfs, removed the warnings and made it validated.
But got the same problem, routes are not showing up in this page http://166.78.179.20:8080/opentripplanner-api-webapp/ws/transit/routes
Looked on the metadata http://166.78.179.20:8080/opentripplanner-api-webapp/ws/metadata it has an empty transitModes field

I checked on my latest catalina log file, I don't know if it has to do with my problem. better to post it though
INFO: Deploying configuration descriptor OpenTripPlanner.xml
Nov 14, 2013 12:01:43 AM org.apache.catalina.startup.HostConfig deployDescriptor

Thanks for your patience
Reply all
Reply to author
Forward
0 new messages