title: Making Use Of Railway Route from Google Maps API
body: <p>I have a specific requirement where i have to display only railway stations in the map rather than the whole map. How can this be achieved.?. Please find the below code that i have tried.</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;style type="text/css"&gt;
              html { height: 100% }
              body { height: 100%; margin: 0px; padding: 0px }
              #map_canvas { height: 100% }
          &lt;/style&gt;
          &lt;script type="text/javascript"
              src="http://maps.googleapis.com/maps/api/js?libraries=drawing&amp;sensor=true"&gt;
          &lt;/script&gt;
          &lt;script type="text/javascript"&gt;
              function initialize() {
                  // init map
  
                  var myOptions = {
                      mapTypeId: google.maps.MapTypeId.ROADMAP
                  };
                  var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
                  var drawingManager = new google.maps.drawing.DrawingManager();
                  drawingManager.setMap(map);
                  // init directions service
                  var dirService = new google.maps.DirectionsService();
                  var dirRenderer = new google.maps.DirectionsRenderer({suppressMarkers: true});
                  dirRenderer.setMap(map);
  
                  // highlight a street
                  // highlight a street
                  var request = {
                          origin: '',
                          destination: '',
                          travelMode: google.maps.TravelMode.TRANSIT
                      };
  
                  dirService.route(request, function (response, status) {
                          if (status == google.maps.DirectionsStatus.OK) {
                              dirRenderer.setDirections(response);
  
                              var legs = response.routes[0].legs;
                              for (i = 0; i &lt; legs.length; i++) {
                                  var steps = legs[i].steps;
                                  for (j = 0; j &lt; steps.length; j++) {
                                      var transitMode = steps[j].travel_mode;
  
                                      if (transitMode == "TRANSIT") {
                                          var vehicle = steps[j].transit.line.vehicle.type;
                                          if (vehicle == "HEAVY_RAIL") {
                                              var nextSegment = steps[j].path;
  
                                              for (k = 0; k &lt; nextSegment.length; k++) {
                                                 // polyline.getPath().push(nextSegment[k]);
                                              }                            
                                          }
                                      }
  
  
                                  }
                              }
                          }
                      });
              }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body onload="initialize()"&gt;
          &lt;div id="map_canvas" style="width:100%; height:100%"&gt;&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any help will be much appreciated.. Thanks in advance..</p>