0

I created a google maps directions url generator in python. Every link has been working fine except for this one.

https://www.google.com/maps/dir/York,+PA,+USA/11815+Chapel+Woods+Ct,+Clarksville,+MD+21029,+USA/12923+Roberts+Ridge+Ct,+Bristow,+VA+20136,+USA/3530+E+Richmond+Rd+#3,+Richmond,+VA+23223,+USA/8017+Alloway+Ln,+Beltsville,+MD+20705,+USA/York,+PA,+USA

For some reason 8017 Alloway Ln, Beltsville, MD 20705, USA and York, PA, USA are automatically cut from the url once the map loads but you can clearly see the link is formatted properly.

Any ideas why this is happening? Thank you.

AMolina
  • 1,355
  • 1
  • 7
  • 17
prime90
  • 889
  • 2
  • 14
  • 26
  • Where did you get that URL from? Notice the URL doesn't have the correct Richmond Rd in it when opened on Google Maps (it has one in Staten Island, at least for me). You are not starting with a valid URL, you need to include the whole URL. – geocodezip Aug 27 '19 at 00:52
  • I made it from the dev guide on google https://developers.google.com/maps/documentation/urls/guide Richmond Rd is pulling up in the right location for me – prime90 Aug 27 '19 at 01:00

2 Answers2

2

When I URLencode the # (%23) it works:

https://www.google.com/maps/dir/York,+PA,+USA/11815+Chapel+Woods+Ct,+Clarksville,+MD+21029,+USA/12923+Roberts+Ridge+Ct,+Bristow,+VA+20136,+USA/3530+E+Richmond+Rd+%233,+Richmond,+VA+23223,+USA/8017+Alloway+Ln,+Beltsville,+MD+20705,+USA/York,+PA,+USA

link

screenshot of resulting map

geocodezip
  • 158,664
  • 13
  • 220
  • 245
  • Interesting, What does %23 indicate? I changed it to "apt+3" and it worked as well. – prime90 Aug 27 '19 at 03:39
  • That (`%23`) is a urlencoded `#`. `#` aren't allowed in URLs (they have a [meaning](https://stackoverflow.com/questions/8192742/what-is-the-meaning-of-in-url-and-how-can-i-use-that)) – geocodezip Aug 27 '19 at 03:42
1

It seems google missed changing "#3" to "apt+3". It makes sense '#' would interfere with the link.

prime90
  • 889
  • 2
  • 14
  • 26