cmv / cmv-app

CMV - The Configurable Map Viewer - A community supported open source mapping framework built with the Esri JavaScript API and the Dojo Toolkit
https://demo.cmv.io/
MIT License
325 stars 278 forks source link

vector tile service 4.x supported? #908

Closed hoogw closed 5 years ago

hoogw commented 5 years ago

Here is sample of arcgis vector tile server 4.x click any vector tile server, on this page.

https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services

I have tried at config.js

It does not work with vector tile (4.x 'index' )

It may be work with regular vector tile ( 'flat')

arcgis pro, by default, export 'index' vector tile package. Which will omit the tiles do not have features, instead use look up table to maintain the index. ( largely reduce the size of tile package)

while if you choose 'flat' when export vector tile package at arcgis pro. you will get regular, like mapbox tileJson v2 , tile package

I think this CMV use arcgis-js-api 3.x, essentially js 3.x will not support above vector tile server( require js 4.x)

Can you test and make above vector tile server works? I can not, it works, but missing lots of tiles. Only if you make CMV use js 4.x, will works.

hoogw commented 5 years ago

Here is my code, error

error TypeError: Cannot read property 'length' of undefined _ControllerBase.js:95

Error:

         `
                      //centralized error handler
         handleError: function (options) {
            if (this.config.isDebug) {
                if (typeof(console) === 'object') {
                   for (var option in options) {
                       if (options.hasOwnProperty(option)) {
                            console.log(option, options[option]);
                        }
                }
            }

`

My code:

         `var ___operational_layer = 
                     {

                 type: 'vectortile',
                // title: 'State',
                // url: "https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Diverse_Index/VectorTileServer/resources/styles/root.json?f=json",
                 url: "https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Diverse_Index/VectorTileServer",
                 options: {
                       id: 'vectortile111111',
                       opacity: 0.8,
                       visible: true
                   }

        }; // layers`
hoogw commented 5 years ago

Never mind, I fix my bugs. So it works fine now. closed