How can I create a zoom based Graphics Renderer using the GraphicsOverlay with the Android Runtime SDK ?
I am on version 100.13.0
I want to be able to see some simple point marker when zoomed out and when I zoom close enough (passing a certain zoom threshold) to the graphic I want to display the actual graphic.
Is there is a more automatic way to do this with a Renderer than switching out the graphic myself ?
If not possible on Android Runtime, is it possible with the Javascript api ?
Please let me know. Thanks
Solved! Go to Solution.
Hi Dhruvin,
The function names should be the same in android as well.
Also, only multilayer symbols are supported as scale-based and alternate symbols.
you can convert PictureMarkerSymbol to a MultilayerSymbol using below fucnction.
toMultilayerSymbol()
Sample code
//Create a picture marker symbol from URI.
val pmSymbol = PictureMarkerSymbol("http://xxx/pushpin/BrownPushpin.png")
pmSymbol.height = 50f
pmSymbol.width = 50f
// Create an ArcGISMap with Light Gray Canvas basemap and set it to MapView
mapView.map = ArcGISMap(Basemap.createLightGrayCanvas())
// Create Multilayer point symbol from Picture marker symbol
val MultilayerPointSymbol = pmSymbol.toMultilayerSymbol()
// Create a graphics overlay to be identified against
val graphicsOverlay = GraphicsOverlay()
val graphic = Graphic(Point(50.0, 50.0, mapView.spatialReference),MultilayerPointSymbol)
graphicsOverlay.graphics.add(graphic)
mapView.graphicsOverlays.add(graphicsOverlay)
//Set reference properties on symbol to allow it to support alternate symbols
MultilayerPointSymbol.referenceProperties = SymbolReferenceProperties(0.0, 40_000_000.0)
Hope this helps.
Hi,
Yes, it is possible to create scale based symbols in Runtime. Here is a blog that explains how to create them. A sample to showcase is still in works.
Release Notes:
https://developers.arcgis.com/android/reference/release-notes/100.13/#alternate-symbol...
Blog post:
https://www.esri.com/arcgis-blog/products/api-net-win-desktop/developers/defining-scale-based-symbol...
Thanks
Rama
Thanks Rama for this info.
When do you think the sample will be available ?
I see that the blog post is for Runtime .net api, are the api functions very similarly named in Android runtime ?
We are using PictureMarkerSymbol for our Graphics. Our process is: VectorDrawables -> Bitmap -> PictureMarkerSymbol.
How can we use MultilayerSymbol instead of PictureMarkerSymbol?
The API documentation mentions this is only compatible with MultilayerSymbol
Thanks
Hi Dhruvin,
The function names should be the same in android as well.
Also, only multilayer symbols are supported as scale-based and alternate symbols.
you can convert PictureMarkerSymbol to a MultilayerSymbol using below fucnction.
toMultilayerSymbol()
Sample code
//Create a picture marker symbol from URI.
val pmSymbol = PictureMarkerSymbol("http://xxx/pushpin/BrownPushpin.png")
pmSymbol.height = 50f
pmSymbol.width = 50f
// Create an ArcGISMap with Light Gray Canvas basemap and set it to MapView
mapView.map = ArcGISMap(Basemap.createLightGrayCanvas())
// Create Multilayer point symbol from Picture marker symbol
val MultilayerPointSymbol = pmSymbol.toMultilayerSymbol()
// Create a graphics overlay to be identified against
val graphicsOverlay = GraphicsOverlay()
val graphic = Graphic(Point(50.0, 50.0, mapView.spatialReference),MultilayerPointSymbol)
graphicsOverlay.graphics.add(graphic)
mapView.graphicsOverlays.add(graphicsOverlay)
//Set reference properties on symbol to allow it to support alternate symbols
MultilayerPointSymbol.referenceProperties = SymbolReferenceProperties(0.0, 40_000_000.0)
Hope this helps.