Jump to content

Horizontal Well Sticks on Map - Please Help!


AlexG

Recommended Posts

Hello,

 

Is there a way for me to plot horizontal oil wells on map? I saw on the video referenced below the that she was able to do it but I have no idea how she did it. 

 

My data table has a column for strat of the stick location (lat and long ) and end of the stick location (lat and long). 

Can some one please help me out?

 

Thank you!

Link to comment
Share on other sites

You could plot your data as a marker layer, and connect by a line for each WellID, if your data were in the format:
Lat Long Type WellID
where Lat Long are the coordinates of each point, and Type is a flag that says Heel or Toe.

Alternatively, you could transform your points into lines, generating a shapefile (vector) dataset, that can be plotted on the map as a feature layer.
To do this, you can create a data function to run the Python script below, where  "df" is the input data table and "Output" is the output dataset.
I have written a sample dxp file (saved in Spotfire 14.0) to show this. I have generated some sample data to test.

import pandas as pd
import geopandas as gpd
from shapely.geometry import LineString

# Save existing columns
original_columns = df.columns.tolist()

# Convert each row to a LineString
df['geometry'] = df.apply(
    lambda row: LineString([(row['Long Heel'], row['Lat Heel']), (row['Long Toe'], row['Lat Toe'])]), axis=1
)


# Convert DataFrame to GeoDataFrame
gdf = gpd.GeoDataFrame(df, geometry='geometry', crs='EPSG:4326')


# Prepare output for Spotfire
# Calculate bounding coordinates and centers for the resulting GeoDataFrame
shape_bounds=  gdf.bounds
shape_bounds = shape_bounds[['minx','maxx','miny','maxy']]
shape_bounds.columns=['XMin','XMax','YMin','YMax']

#Suppress coordinate warnings as these are only a concern over large distances
import warnings
warnings.filterwarnings("ignore")
shape_centroid_points = gdf.centroid
shape_centroid=pd.DataFrame({'XCenter':[],'YCenter':[]})
shape_centroid["XCenter"] = shape_centroid_points.centroid.map(lambda p: p.x)
shape_centroid["YCenter"] = shape_centroid_points.centroid.map(lambda p: p.y)
warnings.filterwarnings("default")
#Turn geometry to binary and downgrade data frame to simple pandas
wkb_geometry = gpd.GeoSeries.to_wkb(gdf['geometry'])
Output=pd.DataFrame({'geometry':wkb_geometry})
Output = pd.concat([Output,shape_bounds,shape_centroid],axis=1)
# Add back original columns 
Output = pd.concat([Output,df[original_columns]],axis=1)

# Set Spotfire geocoding metadata: this is the last statement
Output["XMax"].spotfire_column_metadata = {"MapChart.ColumnTypeId": ["XMax"]}
Output["YMax"].spotfire_column_metadata = {"MapChart.ColumnTypeId": ["YMax"]}
Output["XMin"].spotfire_column_metadata = {"MapChart.ColumnTypeId": ["XMin"]}
Output["YMin"].spotfire_column_metadata = {"MapChart.ColumnTypeId": ["YMin"]}
Output["geometry"].spotfire_column_metadata = {"MapChart.ColumnTypeId": ["Geometry"], "ContentType": ["application/x-wkb"]}

 

test_14.0.dxp

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...