Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArcGIS APIs do not allow adding tilesets to ArcGIS Online #114

Open
brendan-ward opened this issue Jul 30, 2021 · 9 comments
Open

ArcGIS APIs do not allow adding tilesets to ArcGIS Online #114

brendan-ward opened this issue Jul 30, 2021 · 9 comments
Labels

Comments

@brendan-ward
Copy link
Collaborator

Reported in #113

Need to ensure that tilesets with ArcGIS APIs enabled can be successfully added to ArcGIS Online, or provide guidance in the README as to why not.

@brendan-ward
Copy link
Collaborator Author

Possible bug in showing all LODs. See example ArcGIS API endpoint (shows only LOD 0)
and tileJSON which supports everything between 0 and 21.

When adding to ArcGIS Online, it also makes a request to the info endpoint, which we don't provide (example valid info).

If the info request succeeds, it then makes a request to the MapServer endpoint, which we provide here. Then it makes another request to the layers endpoint (example), which we provide as an extremely minimal endpoint (we don't have info about the layers).

It also may need to make a request to the legend endpoint (example), which we provide as an extremely mimimal endpoint (we don't have info about the legend).

So - first task is to support the info endpoint and see where things break after that.

@reyemtm
Copy link

reyemtm commented Aug 3, 2021

I was able to get it to add an empty layer item to ArcGIS Online just by using the MapServer endpoint, but it then looks for the single layer at the layer endpoint, which is not "MapServer/layer/" but rather "MapServer/0", with 0 being the first layer of the "layers" array. I believe if this would return the first item in the layers array it should work.

Edit - I have it working but it only shows the minScale level of detail. It appears the level of detail function is not populating all the levels.

Edit - The lod for loop function did not like uint8, changing that to int seems to work, now to fix the incorrect tile coordinates...needed to add the flip y code. The layer is working in AGOL but alas print is still not working. The print result is empty.

@reyemtm
Copy link

reyemtm commented Aug 4, 2021

I'm wondering if instead of targeting a MapServer endpoint with layers, we should instead target just a MapServer with no layers, at least for image mbtiles with one layer. The whole service is contained within one response - see this response from a cache served via ArcGIS Online.

https://tiles.arcgis.com/tiles/CRjnKyCe3OfYTMC3/arcgis/rest/services/2020_Fairfiled_3857_Cache/MapServer?f=pjson

Also still facing the issue that my working MapServer layer will not print. It may have something to do with this issue - https://support.esri.com/en/technical-article/000018259. The tiles are fetched, they just don't show up on the map.

@brendan-ward
Copy link
Collaborator Author

@reyemtm thanks for digging into this further and trying to get it working. Are you able to turn your fixes for LOD and tile coordinates into a PR?

For debugging the print issue, it might be useful to enable request logging on your server (if you haven't already), then inspect the logs for all requests made while the print job is running. That would give us greater insight into what endpoints the print job is hitting, and where it might be hitting an endpoint it expects that causes it to fail. Or maybe you already did this, and that's what you meant by "the tiles are fetched" ?

Good point about not returning any layers, at least for image services, if we can get away with it. The layers endpoint still exists though:
https://tiles.arcgis.com/tiles/CRjnKyCe3OfYTMC3/arcgis/rest/services/2020_Fairfiled_3857_Cache/MapServer/layers

But can return empty layers array.

@reyemtm
Copy link

reyemtm commented Aug 4, 2021 via email

@brendan-ward
Copy link
Collaborator Author

@reyemtm can you please clarify what you mean by

tiles are shifted slightly

Are they shifted in the Y direction or X direction or both? Is the shift roughly consistent (as a proportion of tile size) across zoom levels, or does it increase with increasing zoom level?

@reyemtm
Copy link

reyemtm commented Aug 4, 2021

Both directions, to the SE. It is slight but noticeable. It's weird since they are pointing to the same data as the tile server. It would appear that AGOL is performing some sort of transformation, not sure why since it has the same projection as the working cached service. I even tried to add the wkid as Esri has it - but that did not change anything. It is not porpotional, it is a very slight maybe 2-3' shift, which would be consistent with a projection/transformation shift.

"spatialReference": {
    "wkid": 102100,
    "latestWkid": 3857
}

https://arcg.is/DvG0r

@brendan-ward
Copy link
Collaborator Author

It looks like the shift is only observable at the highest zoom levels, which suggests that it is has to do with the absolute coordinate position of the tileset origin rather than a slight shifting at each level of detail.

It looks like the origin values are slightly different between what shows in your TileJSON from mbtileserver:

20037508

(though it is hard-coded to correct value here?)

Whereas in the AGOL cached map service:
https://www2.ci.lancaster.oh.us/tileserver/arcgis/rest/services/2020_fairfield_3in_z21/MapServer

-20037508.342787

and the WMTS service

-20037508.34278925

@reyemtm
Copy link

reyemtm commented Aug 5, 2021

Nice catch on the origin. Now to figure out which one is right...

Looks like this is hard-coded in the wmts package.

And it looks like this is a case where GO is not treating the integers correctly or as expected. They are defined as float32 but should be float64 (confirmed). The values could also be changed from what AGOL is providing (current):

"origin": {
    "x": -20037508.342787,
    "y": 20037508.342787
},

to the result of the actual calculation:

xmin: -20037508.3427892,
ymin: -20037508.3427892,
xmax: 20037508.3427892,
ymax: 20037508.3427892

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants