terravion / terravion-examples

TerrAvion API example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tile server support multiple blockIds

ikendoit opened this issue · comments

Dear TerrAvion team,

My company is currently exploring your tile-api, and we are seeing great potential in the imager-tile API: [https://github.com/terravion/terravion-examples/blob/master/docs/GET_IMAGE_TILES.md]

I wonder, can we set the "blockId" parameter to accept multiple blockIds ?
Or is it restricted to only 1 blockId ?

I am thinking of something like:
https://maps.terravion.com/api2/users/u_id/z/x/y.png?blockId=block_id_1,block_id_2,block_id_3
But currently, the api will return empty tiles if requested with more than 1 blockId.

Hello @ikendoit

Tiles are not requested by blockId, but by latitude, longitude and zoom level. So what a mapping software does is basically loading them dynamically from a given base url adding those 3 parameters as {x}/{y}/{z} and appending the file type at the end.

So in order to load different tiles, you give the map different coordinates and it will change it's z and y. On TerrAvion API, if you want to change the tile type -like when you want to load a different product for the same field- you specify that as a query parameter, which will give you a different tile for the given latitude, longitude and zoom level. As you can see on our docs here.

Then, if you want to download many tiles at once -because you want to load them faster from a local url, for instance- then you would need to write your code in a way that it builds a list of block ids and a list of products, and then loop over them downloading coordinate by coordinate. That's actually a common practice on any mapping app that allows you to download tiles for offline use.

If you need further help don't hesitate to contact us at support [at] terravion [dot] com

Hello @jgtoriginal ,

Thank you for the answer, but I have forgotten to explain my use case, which may have caused misunderstanding.

For context:

  • I have a bunch of blocks, ordered for 2020.
  • Each block is tied to a customer. But each customer must only be able to view their assigned blocks.
  • My Customers can use the web app, which leverages the Tileserver API to view their blocks.
  • With the Web App in mind, I don't want a customer to be able to view all the blocks that I have.
    I want to limit their Tile API call to load only blockIds that they have permission to view.

From there, I found the "blockId" query-parameter, provided in the Tile API Doc. Which I discovered can limit the Tile loads to show only the single specified block_id.

But my issue is that the "blockId" query-parameter only supports single block id.
I tried to pass multiple block ids in, with comma separated, but the Tile API will return empty result.

My question is: can the "blockId" query-parameter be able to accept multiple block ids ?
I hope this description can give you more insight about my situation. Please tell me if this should be posted in a new Github issue.

Hello @ikendoit

As I previously said, the only way to load or download tiles is by coordinates, so if you want to download tiles for multiple block ids, you'd need to create an array of block ids first and loop over that array getting each block's tiles as you iterate.

And if you need to administer access to those blocks, you'd need to determine that block list according to your each user's conditions.

For further help do not hesitate to contact support.

Thanks.