mercredi 13 mars 2019

Unauthorized API Arcgis to Google Maps in laravel

I am newbie in Arcgis, but i want to learn about it. So i have a problem for this. I want to put Arcgis data from an API into Google Map. I have make it in Laravel 5.7 and javascript. But i got an error Unautorized like image below

enter image description here

This is my javascript in view blade laravel :

 <div id="map">

  </div>
    <script>
      var map;
      const TILE_ORIGIN = [-20037508.34789244, 20037508.34789244];
      const ORIG_X = 1;
      const ORIG_Y = 0;
      const MAP_SIZE = 20037508.34789244 * 2;
      const MINX = 0;
      const MAXX = 1;
      const MINY = 2;
      const MAXY = 3;

      function getBoundingBox(x, y, zoom){
         tileSize = MAP_SIZE / Math.pow(2, zoom);
         minx = TILE_ORIGIN[ORIG_X] + x * tileSize;
         maxx = TILE_ORIGIN[ORIG_X] + (x+1) * tileSize;
         miny = TILE_ORIGIN[ORIG_Y] - (y+1) * tileSize;
         maxy = TILE_ORIGIN[ORIG_Y] - y * tileSize;

         bbox = [minx, miny, maxx, maxy];


        return bbox;
      }
      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: {lat: -6.160323, lng: 106.905114},
          zoom: 18
        });

        var imageMapType = new google.maps.ImageMapType({
        getTileUrl: function(coord, zoom) {
          resultBBox = getBoundingBox(coord.x, coord.y,  zoom);
          url = "http://xx.xx.x.xx/arcgis/services/Asset/AssetMAP_Mobile/MapServer/WmsServer?LAYERS=1,2,3,4,5&TILED=true&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image/png&SRS=EPSG:3857&BBOX="+resultBBox[MINX]+","+resultBBox[MINY]+","+resultBBox[MAXX]+","+resultBBox[MAXY]+"&WIDTH=256&HEIGHT=256" ; //API
          console.log(url);

              return url;

            },

                tileSize: new google.maps.Size(256, 256)
        });
        map.overlayMapTypes.push(imageMapType);
      }
    </script>
    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBu5nZKbeK-WHQ70oqOWo-_4VmwOwKP9YQ&callback=initMap"
    async defer></script>

The error is for authentication, i must put username and password right? but i don't know how to put the authentication for username and password in the code. Anyone can help me?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2F7WLSS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire