B I Posted December 5, 2019 Share Posted December 5, 2019 I want to find out how "zoomed in" I am on a map so that I can then set the zoom level of another map to the same level and the contents of the map can be compared on the same scale.from Spotfire.Dxp.Application.Visuals import *from Spotfire.Dxp.Application.Visuals.Maps import * sourceMap = sourceMapChart.As[MapChart]() destinationMap = destinationMapChart.As[MapChart]() #Get zoom level of source map ##### #Set zoom level of destination map ####Does anyone know if there is an API to get this valueCheers,BI Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted December 6, 2019 Share Posted December 6, 2019 Check the sample script references in the following wiki article to acheive your use case https://community.spotfire.com/wiki/how-zoom-pre-defined-map-location-tibco-spotfire-using-ironpython-scripting Link to comment Share on other sites More sharing options...
B I Posted December 6, 2019 Author Share Posted December 6, 2019 Thanks for the feedback but that doesn't solve my issue unfortunately. That code allows me to zoom to preset view extents but I just want the map to zoom in/out on whatever area it is currently centred on. I need to get the "zoom-level" of one map in its current state and then apply that to the second map. Link to comment Share on other sites More sharing options...
Michael Kalada 2 Posted December 9, 2019 Share Posted December 9, 2019 import clr clr.AddReference('System.Windows.Forms') from System.Windows.Forms import MessageBox from Spotfire.Dxp.Application.Visuals import Maps from Spotfire.Dxp.Application.Visuals.Maps import GeographicExtent, InteractionMode as im, Projection as pn for vis in Document.ActivePageReference.Visuals: if vis.Title == 'Map chart 1': map = vis.As[Maps.MapChart]() map.InteractionMode = im.Panning map.Projection = pn.WebMercator Document.Properties["South"] = str(map.ViewExtent.South) Document.Properties["East"] = str(map.ViewExtent.East) Document.Properties["North"] = str(map.ViewExtent.North) Document.Properties["West"] = str(map.ViewExtent.West) Link to comment Share on other sites More sharing options...
Michael Kalada 2 Posted December 9, 2019 Share Posted December 9, 2019 the above script captures the zoom level of "Map chart 1" and writes to doc properties. Let me know if that works for you and I'll dig up the script that applies those to another map chart Link to comment Share on other sites More sharing options...
B I Posted December 10, 2019 Author Share Posted December 10, 2019 Thank you for the suggestion but, again, I don't want the second map to be focused on the same area of the map as the first map. I just want the second map to be zoomed in or out of whatever area it is currently focused on so that the scale of its content matches that of the first map. For example, the first map might be zoomed on Europe at a scale of 1:10,000 and I want the second map to be zoomed in/out to a scale of 1:10,000 on whatever part of the map it is currently set over (e.g. Arabia) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now