0

I'm trying to export PLSS grid from ArcGIS map server and I have a duplicate labels in PLSS map service. Using OpenLayers 5 enter image description here My code

    mapPLSSTownshipLayer = new ol.layer.Tile({
    extent: [-13884991, 2870341, -7455066, 6338219],
    source: new ol.source.TileArcGISRest({
        url: 'https://gis.blm.gov/arcgis/rest/services/Cadastral/BLM_Natl_PLSS_CadNSDI/MapServer/export?dynamicLayers=[{"id":1,"source":{"type":"mapLayer","mapLayerId":1},"minScale":4000000.000000047,"maxScale":0,"drawingInfo":{"renderer":{"type":"simple","symbol":{"type":"esriSFS","color":[0,255,0,0],"outline":{"type":"esriSLS","color":[38,38,38,255],"width":2}}},"labelingInfo":[{"labelPlacement":"esriServerPolygonPlacementAlwaysHorizontal","labelExpression":"[TWNSHPLAB]","minScale":550000,"maxScale":0,"symbol":{"type":"esriTS","color":[0,0,0,255],"haloColor":[255,255,255,255],"haloSize":2,"font":{"family":"Arial","size":13}}}]}}]&TRANSPARENT=true&SIZE=700%2C700',
        params: {
            'DPI':210,
            'FORMAT':'PNG24'
        },
        ratio: 1
    }),
    maxResolution: 300
});

I tried change image size but my params seems overwriting by default enter image description here

Any suggestions?

  • OpenLayers will override tile size to match the tile size of its tile grid (the default is 256). When using a zoom factor of two set tileGrid: ol.tilegrid.createXYZ({tileSize: 512}) or tileGrid: ol.tilegrid.createXYZ({tileSize: 1024}) as an option in the source. – Mike Jan 17 at 11:27
1

I added

tileGrid: new ol.tilegrid.createXYZ({
   tileSize: [2500, 2500]
})

into my source and no more duplicate labels.

mapPLSSTownshipLayer = new ol.layer.Tile({
    extent: [-13884991, 2870341, -7455066, 6338219],
    source: new ol.source.TileArcGISRest({
    url: 'https://gis.blm.gov/arcgis/rest/services/Cadastral/BLM_Natl_PLSS_CadNSDI/MapServer/export?dynamicLayers=[{"id":1,"source":{"type":"mapLayer","mapLayerId":1},"minScale":4000000.000000047,"maxScale":0,"drawingInfo":{"renderer":{"type":"simple","symbol":{"type":"esriSFS","color":[0,255,0,0],"outline":{"type":"esriSLS","color":[38,38,38,255],"width":2}}},"labelingInfo":[{"labelPlacement":"esriServerPolygonPlacementAlwaysHorizontal","labelExpression":"[TWNSHPLAB]","minScale":1050000,"maxScale":0,"symbol":{"type":"esriTS","color":[0,0,0,255],"haloColor":[255,255,255,255],"haloSize":2,"font":{"family":"Arial","size":5}}}]}}]&TRANSPARENT=true&SIZE=1000%2C1000',
    params: {
       'DPI':95,
       'FORMAT':'PNG24'
    },
    tileGrid: new ol.tilegrid.createXYZ({
        tileSize: [2500, 2500]
    }),
    maxResolution: 300
});

Thank you Mike.

0

I fixed this issue with "singleTile" as true in the layer options. For dynamic ArcServer layers, OL was requesting multiple (dynamic) tiles so it was making multiple labels.

layer = new OpenLayers.Layer.ArcGIS93Rest( "ArcGIS Server Layer","http://localhost/arcgis/rest/services/AmountofTaxesDue/MapServer/export", 
            {layers: "show:0,2"},
            {  "singleTile": true}
        );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.