Is it possible to create a text label that stays the same relative size compared to the map when zooming in or out? Reading the docs and looking at the symbol layer sample, it seems that this is not possible and that the label will always have the same absolute size (appearing larger when zooming out), but I'm curious whether it is possible to achieve this somehow, using some sort of undocumented feature. If not, is it possible to request this feature somewhere; or is this out of scope?
Azure Maps label text that scales with the zoom level
114 Views Asked by Jelle At
1
There are 1 best solutions below
Related Questions in JAVASCRIPT
- Using Puppeteer to scrape a public API only when the data changes
- inline SVG text (js)
- An array of images and a for loop display the buttons. How to assign each button to open its own block by name?
- Storing the preferred font-size in localStorage
- Simple movie API request not showing up in the console log
- Authenticate Flask rest API
- Deploying sveltekit app with gunjs on vercel throws cannot find module './lib/text-encoding'
- How to request administrator rights?
- mp4 embedded videos within github pages website not loading
- Scrimba tutorial was working, suddenly stopped even trying the default
- In Datatables, start value resets to 0, when column sorting
- How do I link two models in mongoose?
- parameter values only being sent to certain columns in google sheet?
- Run main several times of wasm in browser
- Variable inside a Variable, not updating
Related Questions in AZURE-MAPS
- Zooming in on a cluster eventually resolves to a single pin
- SpiderClusterManager exists in React-Azure-Maps?
- How do I create a NetTopologySuite.Polygon from a Atlas.BoundingBox?
- How can I close a popup in Azure Maps
- click has 0 eventArgs.shapes for a clustered SymbolLayer
- Adding more pins to a SymbolLayer
- How do I create a spatial index in Entity Framework?
- Map point (in DB) within bounding box
- Get click on Map Popup
- Why are SymbolLayer event handlers synchronous?
- Multiple pins - same location
- Azure Maps Creator unable to create data registry
- What is the purpose/difference of the Feature class over Shape
- Popup on a SymbolLayer
- Can I add anything to Shape.Properties?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Yes it is possible to scale the label so that its size stays relative to some physical distance on the ground. To achieve this you need to use a style expression to scale the label size based on the maps zoom level. An interpolation expression is a good option but is a bit complicated as you need to decide how big you want the label at one zoom level, and then calculate its scaled size at a second one as it requires a minimum of two inputs. The map scales such that each zoom level covers two as much area as the one before it so an exponential interpolation works well. It does get a bit difficult when zoomed out as the size can become smaller than 1, so setting a minimum pixel size is a good option, alternative you can hide the label when outside of the desired zoom range. Here is a simple example:
You can see a running version of this code here: https://rbrundritt.azurewebsites.net/Demos/AzureMaps/ScalingLabels.html
I find that just adjusting the 50000 value to a different number allows you to easily scale the label to a more appropriate size while the zoom scaling seems to still work pretty good relative to the ground. Try replacing 50000 with 5000 and you will see what I mean.
Note, if your label becomes really large when zoomed in (larger than the map canvas), the label may disappear as the center point may become out of view. There isn't much you can do about this using this approach. If you have a lot of labels and need to support this scenario, you would then need to consider creating static map tiles. That said, usually if the label is larger than the map canvas, you can't read it and its just in the way.