2

I am developing a webapp using opentripplanner. I have followed 2 and five minute tutorials at their websites, there is also a opentripplaner-geocoder.war webapp, but i am unable to figure out that how can i use this geocoder.

2

To work with geocoder in OTP please refer to this post. here

There are some slight improvements to the above post though( I have to spent hours to figure them out!), these are as follows

For Google basemap

  1. In config.js just add these codes after the OSM declaration in baselayers:

     new OpenLayers.Layer.Google(
               "Google"),
    
  2. Add the Google Maps API script tag to index.html in the directory otp-opnlayers-client/src/main/webapp/ (or otp-leaflet-client/src/main/webapp/ depending on version):

    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
    

For Google Geocoder

  1. In config.js set enabled : true or (depending on version) add the following block to the otp.config variable:

    geocoders : [
         {
                name: "Geocoder",
                className: "otp.core.Geocoder",
                url: "/otp-geocoder/geocode",
                addressParam: "address",
         }
    ]
    
  2. In application-context.xml, under otp-geocoder/scr/main/resources/org/opentripplanner/geocoder/, change the value of ref of the geocoderServer bean to geocoderGoogle:

    <bean id="geocoderServer" class="org.opentripplanner.geocoder.ws.GeocoderServer">
            <property name="geocoder" ref="geocoderGoogle" />
    </bean>
    
  3. Build and restart the server. Then try http://localhost:8080/otp-geocoder/geocode/?address=18.516446,73.851751.

P.S. - I'm working on a latest version of opentripplanner i.e. SNAPSHOT 0.9

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.