Comments (7)
@Naphier Apologies, the documentation is sort of nested: https://www.mapbox.com/mapbox-unity-sdk/docs/03-examples.html#mesh-generation-basics (documentation is still WIP).
Range
essentially describes how many tiles you would like to load in each direction from the center tile. 1 x 1 x 1 x 1 will load a 3 x 3 grid of tiles. We could name this better 😏.
Zoom
describes which zoom level you would like to request for each tile. See:
- https://www.mapbox.com/api-documentation/#retrieve-tiles
- http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
Regarding the calculations and conversions, the world scale factor is recorded in MapController
as WorldScaleFactor
. This is also what the local scale of the root object is set to. Our conversions.cs
class contains a bunch of methods that might help you.
Alternatively, you may want to write your own implementation of MapController
that uses TileCover. This makes it easy to get all the tiles in a geographic bounds.
Can you share more about what sort of map you're trying to build?
from mapbox-unity-sdk.
That description of range helps it to make sense.
So if I have a tile size of say, 100 and range of 1,1,1,1 I would expect a 300m square. But that's also dependent on zoom level. According to documentation I can request zoom level of 0 - 22 (would be good if you guys limited this with a Range attribute in the Unity inspector). If I request less than 5 all I get are black textures (sometimes ? mark textures). If I request higher than 18 then the snap y to zero doesn't seem to work properly (tiles are maybe out of range of the raycast?). If I request higher than 19 then not only does the snap to y no longer work, but I also get ? mark textures. This is using mapbox://styles/mapbox/satellite-streets-v9
.
.
It seems that a zoom level of 17 is close to 1:1 when I'm using:
- Tile size: 200
- Zoom 17
- Range 5,5,5,5
Ultimately, I think it would be more useful to Unity devs to be able to simply define a Unity world unit to map meters ratio, overall map size in Unity units (i.e. meters for most), and pixel density for images. I'm less concerned with entering a geographic bounds than just having control over the map unit to Unity world unit ratio. Does this make sense?
from mapbox-unity-sdk.
So if I have a tile size of say, 100 and range of 1,1,1,1 I would expect a 300m square. But that's also dependent on zoom level.
This is not quite true. 100
represents how many units in unity each tile is. Zoom level plays no factor in this.
If I request less than 5 all I get are black textures
Known issue: #42, apparently due to crazy scale values.
If I request higher than 19 then not only does the snap to y no longer work, but I also get ? mark textures.
@brnkhy can you look into this snapping issue? Please note that zoom > 19 is technically only supported in certain locations.
Ultimately, I think it would be more useful to Unity devs to be able to simply define a Unity world unit to map meters ratio, overall map size in Unity units (i.e. meters for most), and pixel density for images. I'm less concerned with entering a geographic bounds than just having control over the map unit to Unity world unit ratio. Does this make sense?
If you ensure the localScale of worldRoot
is 1, you will have a 1:1 scale with the real world (and now TileSize
is a non-factor. Using this as your basis, you should easily be able to decide your own relative scale.
That said, it might make sense to create another implementation of MapController
to perform the conversions you mentioned above (or maybe a different editor implementation).
from mapbox-unity-sdk.
@Naphier develop
now has an ITileProvider
and AbstractMap
(which is not quite abstract yet 😏 ). Using these abstractions, you should be able to create your own implementations much easier. Let me know if I can help clarify or point you in the right direction.
from mapbox-unity-sdk.
Is there any reason for specifying the size of tile? It can be quite easily computed based on zoom. Each zoom has some specific resolution in meters per pixel of heightmap. Since we know the size of tile, which is 256, then given latitude, it is easily computed as 156543.03 meters/pixel * cos(latitude) / (2 ^ zoom).
For further reference: http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Resolution_and_Scale
from mapbox-unity-sdk.
Is there any reason for specifying the size of tile?
Yes. We figure some developers will want control over the "scale" of their world. Gigantic worlds can cause all sorts of bugs. However, this is just one implementation (which is why we're in the middle of abstracting maps and tile providers). Most of these are application specific, and many developers have different needs.
Also:
from mapbox-unity-sdk.
Since we have added ITileProvider
(and AbstractTileProvider
), you can now easily create your own system for requesting/disposing of tiles.
from mapbox-unity-sdk.
Related Issues (20)
- Unexpected behaviour on SetZoom HOT 1
- The 3D models on the map change their position when locating is activated.
- Setting the Map Extent Options to CameraBounds at runtime doesn't work HOT 1
- Spawn prefabs upwards with a fixed gap
- why only mapbox street v7 can edit POI prefab
- Mapbox + Unity Cloud Build
- Error: Cannot Initialize non-default texture with negative or zero width HOT 1
- suddort URP ? HOT 2
- How to Apply Texture to Tiles
- Swapped North/South and West/East coordinates in Tile Id To Bounds?
- This project is dead? HOT 12
- Your hardware does not support this application. Failed to load 'libmain.so' java.lang.UnsatisfiedLinkError: dopen failed: library "libmain.so" not found HOT 1
- Can I make changes to AbstractMap's Features?
- Can I make changes to AbstractMap's Map Layers Tileset ID via code during runtime?
- heatmap rendering issue
- Meta Quest 3 Build Issues
- Some Building Meshes get "cutoff"
- Mapbox building:levels property support of Unity SDK HOT 3
- language support for raster tile
- Unity - Mapbox environment "Profiles"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapbox-unity-sdk.