小编shr*_*tha的帖子

在LeafletJS中打印地图

我是LeafletJS的新人.我想在LeafletJS中打印地图.我的打印代码是这样的:

     printProvider = L.print.provider({
      capabilities: printConfig,
      method: 'GET',
      dpi: 254,
      autoLoad: true,
      // outputFormat: 'pdf',
      customParams: {
          mapTitle: 'Print Test',
          comment: 'Testing Leaflet printing'
      }
  });
  // Create a print control with the configured provider and add to the map
  printControl = L.control.print({
      provider: printProvider
  });
  map.addControl(printControl);
Run Code Online (Sandbox Code Playgroud)

但是,当我点击打印按钮错误就像这样

Proxy Error.
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /mapfish-print/pdf/print.pdf.

Reason: Error reading from remote server
Run Code Online (Sandbox Code Playgroud)

谁能帮我?

leaflet

9
推荐指数
1
解决办法
5133
查看次数

如何在openlayers-3中添加Google底图?

在openlayers-2中,我们可以添加谷歌底图(卫星,物理,混合等).我需要在openlayer-3中添加google basemaps.如何添加谷歌底图???

openlayers中的CODE-3

map = new ol.Map({
      layers: [
         new ol.layer.Group({
            layers: [
               new ol.layer.Tile({
                  source: null,
                  visible:false
                  }),
                  new ol.layer.Tile({
                  source: new ol.source.MapQuest({layer: 'sat'})
                  }),
                  new ol.layer.Tile({
                  source: new ol.source.OSM(),
                  visible:false
                    })
                 ]})
                ],
                target: 'map',
                view: new ol.View({
                    center:[28.566667, 4.01666699999998],
                    zoom:7
                    }),
                controls: ol.control.defaults({

                       attribution:false

                }).extend([
                    scaleLineControl
                ]),
            });

        lyr=new ol.layer.Tile({  source: new ol.source.TileWMS({
            url: 'http://localhost:8080/geoserver/wms',
            params: {'LAYERS': 'test:test', 'TILED': true},
            serverType: 'geoserver'
            })
        });
map.addLayer(lyr);
Run Code Online (Sandbox Code Playgroud)

我需要google basemaps而不是osm和mapquest.

openlayers openlayers-3

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

leaflet ×1

openlayers ×1

openlayers-3 ×1