1

I'm wondering if there is a way to get a place name, or a place type, or whatever it's called, from Google Maps, using only longitude and latitude coordinates.

I have this URL.

https://www.google.com/maps/place/@42.34,-71.10

In Google Maps I see this.

enter image description here

The closest thing to the red marker is Simmons University, but Simmons University is NOT in the URL. If I click the text that says 'Simmons University', I get this URL.

https://www.google.com/maps/place/Simmons+University/@42.34,-71.1021887,17z/data=!4m13!1m7!3m6!1s0x0:0x0!2zNDLCsDIwJzI0LjAiTiA3McKwMDYnMDAuMCJX!3b1!8m2!3d42.34!4d-71.1!3m4!1s0x89e379f7e743c9c5:0xa77a577bc7bd4396!8m2!3d42.339063!4d-71.1004376

Now, Simmons University is in the URL. Is there some way to extract the text of whatever is closest to the red marker?

I hacked this code together.

from selenium import webdriver
from time import sleep
driver = webdriver.Chrome('/home/datafiles/chromedriver')
driver.get('https://www.google.com/maps/place/@42.34,-71.10')
sleep(2)

I'm getting this error.

WebDriverException: Message: 'chromedriver' executable may have wrong permissions.

The environment is actually Linux and I'm using Python in a Jupyter Notebook. I've never used Linux before.

ASH
  • 20,759
  • 19
  • 87
  • 200

2 Answers2

1

Since there are special characters in your URL instead of

driver.get('https://www.google.com/maps/place/@42.34,-71.10')

Try this:

driver.get(r'''https://www.google.com/maps/place/@42.34,-71.10''')
Prophet
  • 32,350
  • 22
  • 54
  • 79
  • 1
    Raw strings cause backslashes to be treated literally, nothing else. Triple-quoted strings simply allow for embedded newline characters. Neither have anything to do with the characters present in the URL. – chepner Aug 11 '21 at 22:37
  • @chepner see https://stackoverflow.com/questions/49899423/how-to-pass-special-character-in-url-in-windows-authentication. Isn't it similar problem? – Prophet Aug 11 '21 at 22:41
  • I have no idea why that answer was selected. The raw string didn't do anything useful. You can see this for yourself: `'https://www.google.com/maps/place/@42.34,-71.10' == r'''https://www.google.com/maps/place/@42.34,-71.10'''` evaluates to True. Both literals produce the exact same string. – chepner Aug 11 '21 at 22:44
  • The assumption in that question appears to be that the literal string `password` is standing in for a string that *does* require a raw string to preserve the intended value. – chepner Aug 11 '21 at 22:45
1

short answer - no. It's canvas and need other tools for that

nuzooo
  • 133
  • 1
  • 11