Hearth Posted July 22 Share Posted July 22 I'm trying to portray on a map the amount of water injected in a series of SWD wells. I calculated a theoretical radius for each SWD well based on its cumulative injection volume. I was trying to use these values in the "Draw Circular Radius Data Function" but it appears it can only handle 1 radius value which is applied to every well, and not a value for each well. I could be wrong and handling the inputs section incorrectly, but if not, is this possible through another method? Any help is greatly appreciated. Link to comment Share on other sites More sharing options...
Hearth Posted July 22 Author Share Posted July 22 Apologies, I figured out how to change the parameter type of the input to a column. Once I did that though, I'm getting the below error that I'm unsure how to fix. Link to comment Share on other sites More sharing options...
Gaia Paolini Posted July 23 Share Posted July 23 what version of Spotfire are you on? Link to comment Share on other sites More sharing options...
Hearth Posted July 23 Author Share Posted July 23 I was previously on 12.5, but just downloaded the 14.4 version, and I'm still getting the same error. That error only happens if I tell it to limit by the map marking. If I don't, I don't get that error, but the map will zoom way out and not draw any circles. The only way it will draw a circle is if I set the circular radius to a fixed value. Link to comment Share on other sites More sharing options...
Solution Gaia Paolini Posted July 23 Solution Share Posted July 23 We are developing Python functionality for geospatial analysis. That also covers generating circles. The new function also assumes fixed radii but can be tweaked. Interesting use case and I will make sure to make it easier to use variable radii in the next version. It's new functionality so no supporting articles yet. You should be able to see and install the "spotfire_dsml" Python package (top menu > Tools > Python Tools > Package management). I tried it with a table containing a latitude, longitude, id and radius for ten fictitious items. I am attaching the Spotfire example. It was saved with Spotfire 14.0. It reacts to marking, I added a bit of code so that if nothing is marked it returns an empty table. I added a couple of Iron Python buttons to remove markings or mark all, you might need to trust them. This is the Python data function: input is a data table (locations) with columns Latitude, Longitude, Radius and ID. Also input is the units for the radius (e.g. km, miles or meters). The output is a new data table (circle_buffer) rendered as a feature layer. # Python libraries import pandas as pd #Spotfire-dsml libraries from spotfire_dsml.geo_analytics import shape_utilities, io_utilities #If nothing is marked return empty circle if locations.shape[0] == 0: circle_buffer = pd.DataFrame({'geometry':['N/A']}) else: # Using fixed column names in this example radius = locations['Radius'].tolist() latitude = locations['Latitude'].tolist() longitude = locations['Longitude'].tolist() # Optional: add id of original point to generated circles id = locations['ID'] # Create circle buffers around the points for i in range(locations.shape[0]): # Argument circle_id is optional circle_buffer_i = shape_utilities.create_circle_buffer(radius[i],radius_units,[latitude[i]], [longitude[i]], circle_id=pd.Series([id[i]])) if i==0: circle_buffer = circle_buffer_i.copy() else: circle_buffer = pd.concat([circle_buffer,circle_buffer_i]) # Format buffer for export to Spotfire circle_buffer = io_utilities.prepare_geo_dataframe_for_spotfire(circle_buffer) Radius.txt Circle_buffers_multiple_radii_with_marking.dxp Link to comment Share on other sites More sharing options...
Hearth Posted July 24 Author Share Posted July 24 This worked great, thank you, Gaia! 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