[AccessD] [EXTERNAL] Re: New Web Browser Control - Local Files for Google Maps
David Emerson
newsgrps at dalyn.co.nz
Sat May 20 18:50:44 CDT 2023
Hi all,
I tried these permutations with no success:
var image = 'file:///https://msaccess/'+dir+'\htm\images\' + parms[3]+ '.png'
var image = 'file:///https:\\msaccess\'+dir+'\htm\images\' + parms[3]+ '.png'
var image = 'https://msaccess/'+dir+'\htm\images\' + parms[3]+ '.png'
var image = 'https:\\msaccess\'+dir+'\htm\images\' + parms[3]+ '.png'
Here is the whole file text (I have removed the actual Google api key):
<!DOCTYPE html>
<!-- saved from url=(0016)http://localhost -->
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: Directions Waypoints</title>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
// *** Need to replace key with actual key in next line ***
<script type="text/javascript" src="http://maps.google.com/maps/api/js?key=ReplaceWithGoogleKey"></script>
<script type="text/javascript">
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
function initialize() {
showPoints();
}
function showPoints() {
var overlaytype;
var dir;
var parms = new Array();
var checkboxArray = document.getElementById("mappoints");
//Get avg lat, lng so we can determine how to center the map
//Get min and max lat, lng so we can determine zoom level for map
var avglat = 0;
var avglng = 0;
var minlat = 9999;
var minlng = 9999;
var maxlat = -9999;
var maxlng = -9999;
var scale = 0;
var latlng = new Array();
var sumlat = 0;
var sumlng = 0;
var basisscale = 0.062163 * 1.1; // calculated lat lng area that will fit at zoom 13, plus 10%
var basiszoom = 13; // 13 is our basis zoom value for scaling to other zoom values.
var zm = 1; // default
var tempscale = 0;
//Sum lat, lng for averaging. Find min and max values for zoom.
for (var i = 0; i < checkboxArray.length; i++) {
latlng = checkboxArray[i].value.split(";");
if (i^=0) {
sumlat = sumlat + (+latlng[0])
sumlng = sumlng + (+latlng[1])
if (+latlng[0] < minlat) {minlat = +latlng[0]}
if (+latlng[1] < minlng) {minlng = +latlng[1]}
if (+latlng[0] > maxlat) {maxlat = +latlng[0]}
if (+latlng[1] > maxlng) {maxlng = +latlng[1]}
}
}
//default
avglat = latlng[0];
avglng = latlng[1];
if (checkboxArray.length > 0) {
//Compute average lat, lng
avglat = sumlat/(checkboxArray.length-1);
avglng = sumlng/(checkboxArray.length-1);
}
//Find the largest difference between points on map
scale = Math.max(maxlat-minlat,maxlng-minlng);
tempscale = basisscale
// Find the smallest scale, then we'll work up
for (var i = (basiszoom+1); i<21;i++) {
tempscale = tempscale/2;
}
// Find the appropriate zoom level based on the farthest apart points being drawn
// Zoom level can be between 1 (farthest out) and 20 (closest)
for (var i = 20; i>0; i--) {
if (scale < tempscale) {
//Found an appropriate zoom level
zm = i;
break;
}
tempscale = tempscale * 2;
}
//alert("about to enter for loop");
for (var i = 0; i < checkboxArray.length; i++) {
parms = checkboxArray[i].value.split(";");
if (i==0) {
overlaytype = parms[0];
//alert("overlaytype=" + overlaytype);
// The second parm is the folder this application resides in. The parent folder to the /htm subfolder.
dir = parms[1];
//alert("dir=" + dir);
dir = dir.replace(/%20/g," ");
//alert("dir2=" + dir);
//dir = dir.replace("\\","/");
// replace all backslashes with forward slash. the backslash is a special character in javascript.
// str.replace(/find/g,"replace");
dir = dir.replace(/\\/g,"/");
//alert("dir=" + dir);
} else {
//alert("processing" + checkboxArray[i].value);
if (i==1) {
var firstlocation = new google.maps.LatLng(avglat, avglng);
var myOptions = {
zoom: zm,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: firstlocation
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}
//alert("overlaytype 2 =" + overlaytype);
switch(overlaytype)
{
case "1":
alert("case 1");
break;
case "2":
// "Heat Map"
// *** Here is the line that doesn't seem to work ***
// var image = 'file:///'+dir+'/htm/images/' + parms[3] + '_Marker' + parms[4]+ '.png'
// var image = 'file:///'+dir+'/htm/images/' + parms[3]+ '.png'
// var image = 'file:///https://msaccess/'+dir+'\htm\images\' + parms[3]+ '.png'
// var image = 'file:///https:\\msaccess\'+dir+'\htm\images\' + parms[3]+ '.png'
// var image = 'https://msaccess/'+dir+'\htm\images\' + parms[3]+ '.png'
// var image = 'https:\\msaccess\'+dir+'\htm\images\' + parms[3]+ '.png'
//alert(image);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(parms[0],parms[1]),
map: map,
icon: image
});
attachSecretMessage(marker, parms[4]);
break;
default:
alert("case default");
}
}
}
}
var prev_infowindow = false;
function attachSecretMessage(marker, secretMessage) {
var infowindow = new google.maps.InfoWindow({
content: secretMessage
});
marker.addListener('click', function () {
if (prev_infowindow) {
prev_infowindow.close();
}
prev_infowindow = infowindow;
infowindow.open(marker.get('map'), marker);
});
}
function jsleep(ms){
//s=s*1000;
var a=true;
var n=new Date();
var w;
var sMS=n.getTime();
while(a){
w=new Date();
wMS=w.getTime();
if(wMS-sMS>ms) a=false;
}
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="float:left;width:100%;height:100%;"></div>
<div id="control_panel" style="float:right;width:30%;text-align:left;padding-top:20px">
<select multiple id="mappoints">
<option value="2;C:\AATemp">2</input>
<option value="-41.280556;174.778278;CTL;BuildingMarker;Name: CTL
<br>70 Featherston Street
<br>Wellington
<br>6011">Central </input>
<option value="-41.11346;174.8469;HH01;ManholeMarker;Name: HH01
<br>1 Gloaming Hill
<br>Titahi Bay
<br>Porirua
<br>5022">1 Gloaming Hill</input>
</select>
</div>
</body>
</html>
-----Original Message-----
From: AccessD <accessd-bounces+newsgrps=dalyn.co.nz at databaseadvisors.com> On Behalf Of Ryan W
Sent: Saturday, May 20, 2023 10:37 PM
To: Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Subject: Re: [AccessD] [EXTERNAL] Re: New Web Browser Control - Local Files for Google Maps
David,
Here's what I found:
<img src="file.png"/> works (this path is relative to the html file I am
loading)
<img src="C:\files\file.png"/> did not work (showed a broken image link)
<img src="https://msaccess/C:\files\file.png"/> worked
On Sat, May 20, 2023 at 7:57 AM Ryan W <wrwehler at gmail.com> wrote:
> Perhaps it too, needs to be prefixed? https://msaccess/C
> :\AATemp\htm\images\BuildingMarker.png?
>
>
>
> On Sat, May 20, 2023 at 7:46 AM David Emerson <newsgrps at dalyn.co.nz>
> wrote:
>
>> The current line (which works when the file is opened directly in a
>> web
>> browser) is:
>>
>> var image = 'file:///'+dir+'/htm/images/' + parms[3]+ '.png'
>>
>> which translates to:
>>
>> var image = 'file:///C:/AATemp/htm/images/BuildingMarker.png'
>>
>> Should this be changed in some way?
>>
>> Regards
>>
>> David Emerson
>> Dalyn Software Ltd
>> Adelaide, Australia
>>
>>
>>
>>
>> -----Original Message-----
>> From: AccessD
>> <accessd-bounces+newsgrps=dalyn.co.nz at databaseadvisors.com>
>> On Behalf Of David Emerson
>> Sent: Saturday, May 20, 2023 10:03 PM
>> To: 'Access Developers discussion and problem solving' <
>> accessd at databaseadvisors.com>
>> Cc: 'Shane Groff' <shaneg at microsoft.com>
>> Subject: Re: [AccessD] [EXTERNAL] Re: New Web Browser Control - Local
>> Files for Google Maps
>>
>> I checked and the folder (and subfolders) are trusted locations.
>>
>> Just to confirm, the file seems to load. It is the processing of the
>> HTML/javascript syntax that I seem to have problems with in getting
>> the image files recognised for the map markers. I am guessing that
>> this is causing the whole webpage to stop loading.
>>
>> Regards
>>
>> David Emerson
>> Dalyn Software Ltd
>> Adelaide, Australia
>>
>>
>>
>> -----Original Message-----
>> From: AccessD
>> <accessd-bounces+newsgrps=dalyn.co.nz at databaseadvisors.com>
>> On Behalf Of Ryan W
>> Sent: Saturday, May 20, 2023 9:20 PM
>> To: Access Developers discussion and problem solving <
>> accessd at databaseadvisors.com>
>> Cc: Shane Groff <shaneg at microsoft.com>
>> Subject: Re: [AccessD] [EXTERNAL] Re: New Web Browser Control - Local
>> Files for Google Maps
>>
>> David
>>
>> Perhaps any local files Access tries to load with any scripts needs
>> to be in a trusted location? Just a thought.
>>
>> Sent from my iPhone
>>
>> > On May 20, 2023, at 12:01 AM, Shane Groff via AccessD <
>> accessd at databaseadvisors.com> wrote:
>> >
>> > It's in Office 365 Current Channel, Version 2304.
>> >
>> > Shane
>> >
>> > -----Original Message-----
>> > From: AccessD
>> > <accessd-bounces+shaneg=microsoft.com at databaseadvisors.com> On
>> > Behalf Of Rocky Smolin
>> > Sent: Friday, May 19, 2023 9:52 PM
>> > To: Access Developers discussion and problem solving
>> > <accessd at databaseadvisors.com>
>> > Subject: Re: [AccessD] [EXTERNAL] Re: New Web Browser Control -
>> > Local Files for Google Maps
>> >
>> > Wow! Nice! What version of access has that browser control?
>> >
>> >> On Fri, May 19, 2023 at 9:34 PM Shane Groff via AccessD <
>> accessd at databaseadvisors.com> wrote:
>> >>
>> >> Yes, that is documented here:
>> >> https://supp/
>> >> ort.microsoft.com%2Fen-us%2Foffice%2Fuse-the-edge-browser-control-
>> >> on-
>> >> a
>> >> -form-f9f731be-8f9b-4dd2-a5cb-525cfaed52d5%23%3A~%3Atext%3DAdd%252
>> >> 0an
>> >> %
>> >> 2520Edge%2520Browser%2520Control%2520to%2520a%2520form%2Cbox.%2520
>> >> 4%2
>> >> 5
>> >> 20Do%2520one%2520of%2520the%2520following%253A%2520&data=05%7C01%7
>> >> Csh
>> >> a
>> >> neg%40microsoft.com%7Caa323b65bd0b47d64dd708db58edf614%7C72f988bf8
>> >> 6f1
>> >> 4
>> >> 1af91ab2d7cd011db47%7C1%7C0%7C638201551312601836%7CUnknown%7CTWFpb
>> >> GZs
>> >> b
>> >> 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0
>> >> %3D
>> >> %
>> >> 7C3000%7C%7C%7C&sdata=7h6mcE%2BfLJFsaHhL5ncY3bkTCKGE1agjoxGOJV3zQb
>> >> E%3
>> >> D
>> >> &reserved=0
>> >>
>> >> In the 'Navigating to Local Files' section.
>> >>
>> >> Shane
>> >>
>> >> -----Original Message-----
>> >> From: AccessD
>> >> <accessd-bounces+shaneg=microsoft.com at databaseadvisors.com>
>> >> On Behalf Of Ryan W
>> >> Sent: Friday, May 19, 2023 5:45 PM
>> >> To: Access Developers discussion and problem solving <
>> >> accessd at databaseadvisors.com>
>> >> Subject: [EXTERNAL] Re: [AccessD] New Web Browser Control - Local
>> >> Files for Google Maps
>> >>
>> >> IIRC you have to prefix the local file URL with
>> >> http(s?)://msaccess/
>> >>
>> >> eg:
>> >> https://msaccess/C:\mywebpage.html
>> >>
>> >> did that not work?
>> >>
>> >> On Fri, May 19, 2023 at 7:33 PM David Emerson
>> >> <newsgrps at dalyn.co.nz>
>> >> wrote:
>> >>
>> >>> Hi Team,
>> >>>
>> >>>
>> >>>
>> >>> I have been using some code which creates a local file for
>> >>> mapping sites onto Google Maps. It has worked fine when opening
>> >>> up the file directly in a browser.
>> >>>
>> >>>
>> >>>
>> >>> When I try to open the file in the new web browser control the
>> >>> web page doesn't appear.
>> >>>
>> >>>
>> >>>
>> >>> Does anyone have experience with this that I could share my file
>> >>> with to see where I am going wrong?
>> >>>
>> >>>
>> >>>
>> >>> I have read through this sight but without success:
>> >>>
>> >>>
>> >>> https://www/.
>> >>> access-programmers.co.uk%2Fforums%2Fthreads%2Fmicrosoft-access-ed
>> >>> ge-
>> >>> br
>> >>> &data=05%7C01%7Cshaneg%40microsoft.com%7Ca2b4391054bb460ba0f808db
>> >>> 58c
>> >>> b7
>> >>> c2b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6382014032256780
>> >>> 40%
>> >>> 7C
>> >>> Unknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI
>> >>> 6Ik
>> >>> 1h
>> >>> aWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=FuudVimiekZ9IXctSU8vHGUd
>> >>> Ksv
>> >>> K9
>> >>> pNacDz8z3zfhn4%3D&reserved=0
>> >>> owser-control-is-finally-here.326988/
>> >>> <https://www/
>> >>> .access-programmers.co.uk%2Fforums%2Fthreads%2Fmicrosoft-access-e
>> >>> dge
>> >>> -b
>> >>> rowser-control-is-finally-here.326988%2F&data=05%7C01%7Cshaneg%40
>> >>> mic
>> >>> ro
>> >>> soft.com%7Ca2b4391054bb460ba0f808db58cb7c2b%7C72f988bf86f141af91a
>> >>> b2d
>> >>> 7c
>> >>> d011db47%7C1%7C0%7C638201403225678040%7CUnknown%7CTWFpbGZsb3d8eyJ
>> >>> WIj
>> >>> oi
>> >>> MC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000
>> >>> %7C
>> >>> %7
>> >>> C%7C&sdata=D2PeMmM3JlJQhP8f2HQ0K7itBLWE9gTJ%2FZfM6TuhVJE%3D&reser
>> >>> ved
>> >>> =0
>> >>>>
>> >>>
>> >>>
>> >>>
>> >>> Regards
>> >>>
>> >>>
>> >>>
>> >>> David Emerson
>> >>>
>> >>> Dalyn Software Ltd
>> >>>
>> >>> Moved from Wellington, NZ. Now in Adelaide, Australia
>>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> https://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> https://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>
--
AccessD mailing list
AccessD at databaseadvisors.com
https://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
More information about the AccessD
mailing list