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
- Angular Show All When No Filter Is Supplied
- Why does a function show up as not defined
- I count the time the user takes to solve my quiz using Javascript but I want the same time displayed on another page
- Set "More" "Less" font size
- Using pagination on a table in AngularJS
- How to sort these using Javascript or Jquery Most effectively
- how to fill out the table with next values in array with one button
- State with different subviews
- Ajax jQuery firing multiple time display event for the same result
- Getting and passing MVC Model data to AngularJS controller
- Disable variable in eval
- javascript nested loops waiting for user input
- .hover() seems to overwrite .click()
- How to sort a multi-dimensional array by the second array in descending order?
- How do I find the fonts that are not loading in a CORS situation ( MoovWeb )?
Related Questions in AZURE-MAPS
- How to access Azure Maps API from browser using Azure App Service Active Directory authentication?
- Unable to resize the azure map in angular
- Azure map remove default border / outline
- Azure maps - Removing country borders from map
- How to add MultiPolygons along with Bubble Layer or (any point data) in azure-maps?
- Azure Indoor Maps not rendering
- How to re-draw a route after the origin location changes using Azure Maps in Android application
- Using azure maps fuzzy search returns duplicate results
- Azure Maps: How to install version 3 of the azure-maps-control package
- Can Azure Maps keep the display of linestring shape for all zoom Levels?
- Accessing Azure Maps JavaScript methods via Blazor WASM Maps Component
- can't load geojson file into azure maps using javascript, but gives 404 error
- Accessing .Net methods via JSInvokeable from HTML within Blazor WASM
- azure maps outlining a polygon extrusion or adding a line extrusion layer to highlight the outline of shapes
- Removing a Layer From Azure Maps
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 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.