isladogs
MVP / VIP
- Local time
- Today, 11:09
- Joined
- Jan 14, 2017
- Messages
- 18,773
Those of you who’ve read any of my previous threads will know I tend to ask about some fairly obscure topics.
Here’s another example
…. Apologies for its length
Recently, I’ve been working with adding layers to static Google maps and downloading the image files to my Access apps. For example:
The code used to download the image file is very simple and is based on a Windows API
The DownloadFileFromURL function uses Internet Explorer no matter what your default browser is.
The problem is this has a URL character limit of 2083 characters and adding layers to maps can easily exceed this limit
A typical URL (for the Milton Keynes postcode area) is :
This has almost 1700 characters so is fine
The URL can be shortened (to around 1200 characters by encoding the path (giving the same map):
If you post either of the above into a browser window you will get the map with the blue boundary path shown above.
However, many Google map URLs I’m using still exceed the 2083 limit even when encoded
For example, this boundary path for the Paisley area (PA) is over 3300 characters
If pasted into Chrome or Firefox it works. With IE it doesn’t
So I’m looking for the best solution. Possible methods (with comments) include:
1 Use another browser instead of IE
Chrome & Firefox both allow URLs of at least 64000 characters – more than enough. BUT DownloadFileFromURL won’t work with either
2 Shorten path by using fewer decimal places in lat/long data Boundary precision reduced but should be OK BUT encoded path is no shorter than before
3 Shorten path by using fewer points in lat/long data e.g. use alternate points only
Boundary precision reduced but should be OK
Need to find simple way of selecting alternate points using code. I have over 18000 such boundary paths to fix
4 Find another function that works in Chrome/Firefox
Excellent idea but what?
5 Use a dynamic map in a web browser control
Dynamic maps can be problematic in web browser controls
Also depends on IE so doesn’t help
6 Shorten the url using bit.ly or similar
Doesn’t work if the path is over 2000 characters or thereabouts.
The paths can’t be read correctly - defeats the whole point really!
The Google equivalent goo.gl is a bit better in this respect but is about to be scrapped! Replacement is called Firebase. Its more powerful but not quite the same idea.
If you got to the end, thank you for reading it
Any suggestions for solving any of the above would be VERY welcome particularly points 3 or 4
So indeed would be any other good ideas
Here’s another example

Recently, I’ve been working with adding layers to static Google maps and downloading the image files to my Access apps. For example:
The code used to download the image file is very simple and is based on a Windows API
Code:
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal _
szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Public Function DownloadFilefromWeb(url As String, FileName As String) As Boolean
DownloadFilefromWeb = URLDownloadToFile(0, url, FileName, 0, 0)
End Function
The DownloadFileFromURL function uses Internet Explorer no matter what your default browser is.
The problem is this has a URL character limit of 2083 characters and adding layers to maps can easily exceed this limit
A typical URL (for the Milton Keynes postcode area) is :
Code:
[SIZE="2"]https://maps.googleapis.com/maps/api/staticmap?center=52.0624,-0.666126&zoom=9&size=800x400&maptype=roadmap&path=color:blue|weight:3|fillcolor:0xFFFF0033|52.14162,-0.81819|52.14162,-0.82284|52.1631,-0.76845|52.16524,-0.74465|52.1656,-0.73731|52.18081,-0.69401|52.19602,-0.66556|52.19262,-0.64087|52.22197,-0.59076|52.23503,-0.59166|52.2463,-0.5217|52.27618,-0.53351|52.29479,-0.51758|52.31555,-0.47857|52.28871,-0.41774|52.29586,-0.37891|52.27421,-0.368|52.25632,-0.37461|52.24594,-0.3535|52.24791,-0.35797|52.23217,-0.32469|52.21892,-0.28086|52.20264,-0.2898|52.1792,-0.31879|52.16507,-0.30805|52.13161,-0.33954|52.11926,-0.35565|52.11729,-0.35547|52.09958,-0.3934|52.08669,-0.37372|52.07399,-0.38643|52.06683,-0.36889|52.05806,-0.39985|52.03767,-0.39752|52.02514,-0.36585|52.01476,-0.3841|51.98846,-0.40718|51.98273,-0.40879|51.95536,-0.42364|51.94891,-0.46515|51.9541,-0.48215|51.97343,-0.51687|51.97182,-0.56124|51.96914,-0.57251|51.95196,-0.59184|51.94194,-0.63192|51.96663,-0.66896|51.96556,-0.69329|51.9482,-0.75055|
51.95339,-0.81175|51.92834,-0.77846|51.91116,-0.80334|51.8972,-0.82874|51.9083,-0.89835|51.88307,-0.95758|51.89756,-0.99426|51.90382,-1.00642|51.90848,-1.01859|51.90955,-1.00696|51.92494,-1.04955|51.91975,-1.05617|51.94498,-1.09374|51.95375,-1.10645|51.97808,-1.09625|52.00152,-1.07245|52.00599,-1.08802|52.0323,-1.06458|52.03605,-1.05688|52.05878,-1.03881|52.06737,-1.00446|52.05967,-0.9642|52.08329,-0.92805|52.07041,-0.87777|52.05932,-0.88994|52.06952,-0.87151|52.07345,-0.88064|52.08168,-0.86292|52.09618,-0.87867|52.11765,-0.81819|52.14162,-0.81819&markers=color:blue%7Csize:normal%7Clabel:X%7C52.0624,-0.666126&key=AIzaSyAHXXMSyKgS00M314zzHr0gSg0upA-q1hI[/SIZE]
This has almost 1700 characters so is fine
The URL can be shortened (to around 1200 characters by encoding the path (giving the same map):
Code:
https://maps.googleapis.com/maps/api/staticmap?zoom=9&size=800x400&maptype=roadmap&path=color:blue|weight:3|fillcolor:0xFFFF0033|enc:o~f}h?nw~c_?_____?f~___?gbc__?wvi__?ok___?wnc__?ge___?_q`__?w|a__?wkg__?w|a__?_nd__?vq___?g{c__?gtd__?owh__?gpa__?fe___?wca__?otl__?ozd__?~ia__?wub__?_cb__?gbc__?wrf__?vgd__?g|j__?wj`__?wrf__?nhc__?wca__?nob__?vj`__?n}`__?gbc__?ok___?~w___?~bb__?gme__?fpa__?_rg__?~bb__?fw`__?~tc__?ftd__?nva__?wca__?fme__?~fe__?fpa__?~bb__?nk___?ge___?fib__?nlf__?fpa__?wub__?fpa__?~ia__?vj`__?gib__?fw`__?v`e__?~{b__?ok___?fpa__?_ge__?n}`__?nob__?vgd__?vnc__?f~___?nk___?~md__?v|a__?nd`__?f_g__?g~___?fib__?wub__?vye__?fe___?~qg__?vq___?~ia__?fib__?vub__?n}`__?~xf__?g{c__?fff__?fe___?~tc__?nob__?nij__?g~___?f|j__?f{c__?ose__?fib__?f{c__?nva__?nad__?wca__?fnl__?f{c__?~uj__?w|a__?~_f__?od`__?~ia__?_x___?fpa__?ok___?_ja__?w|a__?vkg__?f~___?nd`__?g{c__?nlf__?gw`__?~ia__?_uc__?o}`__?_uc__?_uc__?_x___?~bb__?oad__?wnc__?_x___?_q`__?wnc__?oob__?_q`__?wye__?vj`__?_yf__?wnc__?_`f__?fpa__?owh__?vca__?~ia__?wc
a__?oob__?wq___?fw`__?gw`__?oob__?ova__?~bb__?ohc__?g|j__?_uc__?_____?&border='0'&markers=color:blue%7Csize:normal%7Clabel:X%7C52.0624,-0.666126&key=AIzaSyAHXXMSyKgS00M314zzHr0gSg0upA-q1hI
If you post either of the above into a browser window you will get the map with the blue boundary path shown above.
However, many Google map URLs I’m using still exceed the 2083 limit even when encoded
For example, this boundary path for the Paisley area (PA) is over 3300 characters
Code:
https://maps.googleapis.com/maps/api/staticmap?zoom=7&size=800x400&maptype=roadmap&path=color:blue|weight:3|fillcolor:0xFFFF0033|enc:w~cti?nb}y_?_____?g{c__?nd`__?wnc__?n}`__?ge___?fw`__?nk___?fe___?~{b__?~p`__?_____?vj`__?wub__?vj`__?f~___?fw`__?~w___?fe___?vj`__?~bb__?n~g__?nob__?fcj__?ok___?~qg__?vnc__?f{c__?vub__?vub__?gpa__?~dp__?v|a__?n}`__?gme__?fnl__?wgd__?vq___?_x___?wj`__?o}`__?fe___?wca__?vq___?gw`__?~}p__?_uc__?vca__?n}`__?nob__?~xf__?vwp__?~ia__?ok___?fpa__?nzd__?vdh__?fe___?fqh__?f~___?~w___?fcj__?ok___?vye__?oob__?nob__?_nd__?vln__?wca__?vub__?wub__?ge___?_nd__?fpa__?nk___?vir__?gbc__?wca__?v|a__?gpa__?v`e__?fw`__?fbc__?nxo__?~md__?~_f__?vgd__?vca__?v`e__?fbc__?fff__?oob__?~gl__?nzd__?fib__?nhc__?vzl__?fff__?neg__?_ge__?~ym__?n{k__?voj__?oad__?vub__?vgd__?vnc__?npi__?vq___?ftd__?gtd__?~wx__?nob__?fuk__?oad__?g~___?g}q__?gji__?oeg__?g{c__?od`__?_ja__?o|r__?n}`__?gme__?_ge__?gtd__?fe___?gpa__?~md__?~ia__?vrf__?_q`__?f{c__?olf__?wq___?g{c__?_`f__?gji__?_yf__?_uc__?olf__?vca__?wca__?nhc__?vj`__?~t
c__?w`e__?gpa__?g{c__?ose__?fib__?_uc__?~jh__?g{c__?nd`__?_|b__?w|a__?_rg__?g~___?o}`__?~md__?_q`__?~p`__?_|b__?fxg__?wq___?vj`__?ova__?wca__?w|a__?vub__?ova__?gw`__?_cb__?ozd__?od`__?_am__?gkp__?vgd__?oob__?v|a__?nva__?f}q__?n|r__?vrf__?nmm__?~}p__?ncr__?nwh__?~bb__?fme__?od`__?ok___?~md__?oob__?v|a__?~w___?fbc__?_cb__?vnc__?n}`__?fme__?f~x__?voj__?nbk__?gw`__?~nk__?neg__?~gl__?_x___?vkg__?_|b__?oob__?opi__?opi__?_nd__?~{b__?g{c__?vnc__?_x___?~fe__?ova__?ntl__?~xf__?n~g__?fib__?voj__?_ja__?nob__?ose__?wgd__?ova__?gtd__?wkg__?_ja__?ova__?nhc__?oob__?gw`__?_|b__?gib__?o}`__?_ja__?gxg__?_hl__?_ja__?_kh__?olf__?_rg__?wj`__?_uc__?fbc__?g{c__?o}`__?opi__?gme__?o~g__?gw`__?_}i__?wq___?wgd__?~{b__?opi__?ozd__?fe___?_cb__?gcj__?o{k__?oic`_?_ep__?w|a__?_q`__?nd`__?gtd__?w`e__?gxg__?fgm__?nob__?vnc__?wca__?ge___?ova__?woj__?olf__?ght__?o}`__?~md__?ose__?_q`__?oob__?gzu__?ose__?nbk__?~w___?nd`__?gbc__?nus__?fcj__?nmm__?vgd__?~|i__?wj`__?f{c__?o}`__?fex__?fme__?f|j__?wq___?vxw__?fpa__?~fe__?vub__?vvi__?ok___?nlf__?~bb__
?f~___?vub__?v`e__?nd`__?fcj__?w`e__?wca__?_cb__?_ge__?_x___?fe___?wca__?nob__?o}`__?fbc__?fpa__?vye__?_x___?~bb__?gib__?_|b__?_cb__?g~___?oad__?nad__?_q`__?fe___?wub__?gzu__?gib__?oxo__?vca__?wvi__?_____?ge___?ozd__?neg__?gpa__?wub__?wnc__?~|i__?g{c__?wca__?nva__?vca__?vub__?fme__?nd`__?f{c__?o}`__?od`__?oad__?_`f__?_q`__?vca__?_yf__?_cb__?w|a__?fib__?wq___?voj__?n~g__?vye__?vj`__?vgd__?ftd__?n~g__?g~___?ge___?_nd__?oeg__?w|a__?w|a__?oad__?_sn__?ozd__?wj`__?_uc__?_|b__?o}`__?vca__?gme__?wca__?ova__?gcj__?od`__?oeg__?_uc__?o_o__?wub__?gcj__?vca__?oxo__?wca__?ohc__?fpa__?wdh__?nd`__?g_g__?nhc__?gyn__?_ge__?wcz__?~w___?_wq__?~tc__?wj`__?v`e__?_pr__?fib__?gbc__?wj`__?o~g__?o~g__?o~g__?~w___?_di__?_ge__?ova__?gtd__?o_o__?nk___?_kh__?f|j__?g|j__?nob__?od`__?vzl__?gtd__?fw`__?oz}__?ohc__?oad__?gff__?_ep__?od`__?o`v__?g_g__?w~o__?nse__?~bb__?nfn__?wca__?~ia__?gw`__?vkg__?v`~__?nva__?vln__?o}`__?_x___?fuk__?_nd__?~md__?v`e__?~tc__?_`f__?nfn__?vvi__?vrf__?_____?~fe__?ohc__?vkg__?fme__?vnc__?f~___?v}h__?vca__?~p`__?nd
`__?~qg__?ohc__?nbk__?_ok__?ok___?g`n__?_____?_____?_____?_ge__?~bb__?_n}__?~md__?oad__?vq___?ge___?_____?gqh__?~w___?_cb__?~p`__?wye__?nob__?_____?&border='0'&markers=color:blue%7Csize:normal%7Clabel:X%7C56.0713,-4.91337&key=AIzaSyAHXXMSyKgS00M314zzHr0gSg0upA-q1hI
If pasted into Chrome or Firefox it works. With IE it doesn’t
So I’m looking for the best solution. Possible methods (with comments) include:
1 Use another browser instead of IE
Chrome & Firefox both allow URLs of at least 64000 characters – more than enough. BUT DownloadFileFromURL won’t work with either
2 Shorten path by using fewer decimal places in lat/long data Boundary precision reduced but should be OK BUT encoded path is no shorter than before
3 Shorten path by using fewer points in lat/long data e.g. use alternate points only
Boundary precision reduced but should be OK
Need to find simple way of selecting alternate points using code. I have over 18000 such boundary paths to fix
4 Find another function that works in Chrome/Firefox
Excellent idea but what?
5 Use a dynamic map in a web browser control
Dynamic maps can be problematic in web browser controls
Also depends on IE so doesn’t help
6 Shorten the url using bit.ly or similar
Doesn’t work if the path is over 2000 characters or thereabouts.
The paths can’t be read correctly - defeats the whole point really!
The Google equivalent goo.gl is a bit better in this respect but is about to be scrapped! Replacement is called Firebase. Its more powerful but not quite the same idea.
If you got to the end, thank you for reading it
Any suggestions for solving any of the above would be VERY welcome particularly points 3 or 4
So indeed would be any other good ideas
Attachments
Last edited: