Google's 'Place Autocomplete' doesn't show any results for an address with an apartment number and street number range e.g. "2/61-69 Macquarie St, Sydney NSW 2000" (apartment 2, of the building located at 61-69 Macquarie Street).
However, it does show results for "61-69 Macquarie St, Sydney NSW 2000" and "2/69 Macquarie St, Sydney NSW 2000".
Is there a way to get it to find the full address - or maybe some javascript could trim the "2/61-" off before google searches for it, or get Google to ignore that part of the typed string when it looks up possible addresses and add it back to the matching results.
Related
I have a text file with following contents-
"\n\n\n\n\n\n\n\n\t\n\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\n\n\n\t\n\t\t\n\t\t\t\t
Hotline: +49 40-300 51 701\n\t\n\t\n\t
Languages\n\t\n\t\n\t\t\n\t\t\n\t\t
Travel plan \n\t\n\t\n\n\n\n\t\t\n\n\t\t\n\t\t\t\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\n\n\t\t\n\t\t\t\t
Book\t
Packages from € 59\n
\tAccommodation and arrival\n
\tMusical packages\n
\tMaritime packages\n\t
Hamburg for Families\n\t
Experience Hamburg & Culture\n\n\n\n\n\t
Hotels from € 24\n\t
Book online now!\n\t
Theme hotels\n\t
Hotels by location\n\t
Special Offers\n\t
Hotels from A-Z\n\t
Other accommodation\n\n\n\n\n\t
Tickets from € 8\n\tBook online now!\n\t
Musicals Hamburg\n\tHamburg maritime\n\t
Sightseeing tours & city walks\n\tMuseums & Exhibitions\n\tHamburg for Families\n\n\n\n\n\t
Hamburg CARD\n\tBook online now!\n\tAll benefits at a glance\n\tFrequently asked questions\n\n\n\n\n\t
Group trips\n\tBooking request\n\tHamburg Guides and theme walks\n\n\n\n\n\n\n\t\n\t\tOffer\n\n\t\t\n\n\t\t\n\n\t\t
Hamburg CARD\n\t\tFree travel by bus, rail and ferry (HVV) and up to 50% discount on more than 150 tourist...\n\n\t\n\t\n\t\t\n\t\t\t\n\t\t\t\t
from 10,50 EUR\n\t\t\t\n\t\t\n\n\t\n\n\n\n\n\n\n\tAttractions\tBest of Hamburg\n\t
Town Hall\n\tThe \"Michel\"\n\tSt. Pauli & Reeperbahn\n\t
Elbphilharmonie\n\tJungfernstieg\n\tMiniatur Wunderland\n\tTierpark Hagenbeck\n\t
All about the Alster\n\tBlankenese\n\n\n\n\n\tHamburg Maritime\n\t
Urbanshore Hamburg\n\tPort of Hamburg\n\tLandungsbrücken\n\tFish Market\n\tSpeicherstadt\n\tOn the Elbe\n\tHafenCity\n\tWillkomm-Höft\n\tÖvelgönne\n\n\n\n\n\tHistoric Hamburg\n\tThe Old Elbe Tunnel\n\t"
I want to split it on the \n. I tried
string.split("\n")
string.split('\n')
string.split("""\n""")
string.split("\\n")
Nothing of this seems to work. How do I get it done in scala?
Split by \n, then \t, flatten, then remove empty strings.
var lines = Source.fromFile("/Users/rasika/Documents/example.txt").getLines.mkString
val result = lines.split("\\\\n").flatMap(_.split("\\\\t")).filter(_.nonEmpty).toList
Result
Hotline: +49 40-300 51 701
Languages
Travel plan
Book
Packages from € 59
Accommodation and arrival
Musical packages
Maritime packages
Hamburg for Families
Experience Hamburg & Culture
Hotels from € 24
Book online now!
Theme hotels
Hotels by location
Special Offers
Hotels from A-Z
Other accommodation
Tickets from € 8
Book online now!
Musicals Hamburg
Hamburg maritime
Sightseeing tours & city walks
Museums & Exhibitions
Hamburg for Families
Hamburg CARD
Book online now!
All benefits at a glance
Frequently asked questions
Group trips
Booking request
Hamburg Guides and theme walks
Offer
Hamburg CARD
Free travel by bus, rail and ferry (HVV) and up to 50% discount on more than 150 tourist...
from 10,50 EUR
Output exceeds cutoff limit.
If you want to split on literal \n in your text (i.e. literal text, and not just a newline), then try this:
string.split("\\\\n")
In a regex context in Java/Scala, a literal backslash requires four backslashes.
Since you're splitting on newlines, and io.Source.fromFile.getLines separates on newlines, you'll need to read the whole file in one go instead, with
val string = io.Source.fromFile(filepath).mkString
as per this answer. Then your attempts should work e.g.
string.split('\n')
How can I retrieve the complete address of a point on the map?
I am currently using L.esri.Geocoding.geocodeService() which returns the following info - (This is an example)
Are there reverse geocoders which return the complete address of a place (including Apartment #/ Building #, street and country name (instead of/ in addition to the country code))?
I'm using https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-geocoder/
map.addControl(new mapboxgl.Geocoder());
But when I try New York City addresses the map centers on an incorrect location.
I expect the address to be the center of the map when the map relocates.
But I see that it is incorrect, sometimes by a lot
For example, for "1 Broadway, New York, NY" I see (1 Broadway is not even viewable without panning and zooming)
Is there a better geocoder example that works correctly for NYC addresses?
BUT the correct map is something like this:
It seems to work in other locations
Moscone Center SF (correct)
Whitehouse (correct)
I want to search for places such as "Apple Store", "Italian Restaurant" etc. and also for address such as "5th Ave, New York, NY, United States".
How can I search for places and set MKPlacemark for each place I find?
If you are worried about requests limit for Google Maps API, you can use some of open source maps API instead perhaps, like Nominatim API , look at http://wiki.openstreetmap.org/wiki/Nominatim
From iOS 6.1 Apple introduced a new search API - MKLocalSearch. You create a MKLocalSearchRequest using string and region to search in (the region is just a hint for the search, it doesn't guarantee results will fall within this region) and use this request to initialise a MKLocalSearch, which asynchronously gives you the results in an MKLocalSearchResponse object. It was only introduced in january, so it has it's issues at this stage - you only ever get 10 results per search, plus some of the results are strange, but it's definitely worth checking out. There's also no way to specify the type of object (town/business/landmark etc.) you're searching for, which is a shame. Here's a cool tutorial. Note that the more precise the region you supply the better the results.
I am trying to figure out how to parse an address using T-SQL and I suck at T-SQL. My challenge is this,
I have a table called Locations defined as follows:
- City [varchar(100)]
- State [char(2)]
- PostalCode [char(5)]
My UI has a text box in which a user can enter an address in. This address could be in the form of essentially anything (yuck, I know). Unfortunately, I cannot change this UI either. Anyways, the value of the text box is passed into the stored procedure that is responsible for parsing the address. I need to take what the person enters and get the PostalCode from the Locations table associated with their input. For the life of me, I cannot figure out how to do this. There are so many cases. For instance, the user could enter one of the following:
Chicago, IL
Chicago, IL 60601
Chicago, IL, 60601
Chicago, IL 60601 USA
Chicago, IL, 60601 USA
Chicago IL 60601 USA
New York NY 10001 USA
New York, NY 10001, USA
You get the idea. There are a lot of cases. I can't find any parsers online either. I must not be looking correctly. Can someone please point me to a parser online or explain how to do this? I'm willing to pay for a solution to this problem, but I can't find anything, I'm shocked.
Perhaps a CLR function might be a better choice than tsql. Check out http://msdn.microsoft.com/en-us/magazine/cc163473.aspx for an example of using regular expressions to parse some pretty complex string inputs into table value results. Now you get to be as creative as you please with your regex matching but the following regex should get you started:
(.*?)([A-Z]{2}),? (\d+)( USA)?$
If you're reluctant to use CLR functions, perhaps you have regex functionality in the calling system, like ASP.Net or PHP.