Can I get Google maps to ignore part of a search?

540 views Asked by At

I have a website which shows scheduled upcoming bike rides using Google Calendar. The location field automatically links to Google maps, but some of the information can make the Google maps search fail, and there's no way to turn off the map link.

Example: The upcoming ride has in the location field "Seven Hills Station, North side of the train tracks, 9am sharp". When you click on the map link, it just brings up a map of the US. If you search for "Seven Hills Station", it comes up with the train station in Seven Hills NSW, which is what we want. So if there was an operator that made the Google maps search ignore everything after "Hills" (like the question mark in URLs), I could keep displaying the calendar events in the same format and have working maps linked from it. Does anyone know of an operator that can make Google maps ignore part of a search?

Cheers, Aston

1

There are 1 answers

0
kaho On

I think you can use regex to delete everything after the ,

using the replace function, this is how you replace something in JS: str.replace(/,.*/g, "");

http://jsfiddle.net/gvzpe9h9/