Hi Simo,
I’m a bit confused; I think the goal is to avoid sending request to the server when calling OgcApiFeatureLayer.QueryTools.GetFeaturesWithinDistanceOf(), is that right? If yes, it should be fine if we build up the cache on the local file system, unless you are looking for caching everything into memory or some other kind of caching?
Here is some quick description about scale:
Scale is simply the ratio between a distance on your screen and the corresponding distance in the real world. For instance, a scale of 1000 means that 1 inch on your screen represents 1000 inches in reality.
Let’s say you want to create a tile matrix where 100 pixels on the screen represent 50 meters on the ground. What scale would that be? Let’s break it down:
- Convert pixels to inches:
100 pixels ≈ 1.04 inches (assuming 96 DPI, because 100 / 96 ≈ 1.04).
- Calculate ground distance per inch:
If 1.04 inches correspond to 50 meters, then 1 inch represents about 50 / 1.04 ≈ 48 meters .
- Convert meters to inches:
Since 1 meter is approximately 39.37 inches, then 48 meters is about 48 × 39.37 ≈ 1890 inches .
This means one inch on the screen represents about 1890 inches in the real world, giving you a scale of roughly 1:1890 .
Using the ThinkGeo API
If 100 pixels represent 50 meters, the resolution is 0.5 meters per pixel. You can then get the scale like this:
var scale = MapUtil.GetScaleFromResolution(0.5, GeographyUnit.Meter);
So, let’s say the bbox of the server is 500 meter by 500 meter, scale of 1890 represents 0.5 meter per pixel, so the 500x500 meter extent can be present by a 1000x1000 pixel image. So the following code means creating a tileMatrix using 256x256 pixel tile to fill up the 1000x1000 extent.
tileMatrix = new TileMatrix(1890, 256, 256, bbox, GeographyUnit.Meter);
Thanks,
Ben