Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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