<jupyter_start><jupyter_text>Example 1: GeoLineStrings<jupyter_code># import the geolinestring class
from pygeoshape.geolinestring import GeoLineString
%matplotlib inline<jupyter_output><empty_output><jupyter_text>1. (X, Y, Z) Data<jupyter_code># Given x,y,z coordinates
coordinates_1 = [[1, 1, 1], [1, 1, 5], [1, 8, 5], [3, 3, 3],[5,1,2],[6,10,2]]
coordinates_2 = [[6,10,2],[3,3,3],[5,5,8],[5, 5, 5], [5, 5, 1], [3, 3, 3], [2, 2, 1]]

# Lets define two geolinestrings
# Since the data provided is already in X,Y coordinates, we can pass the argument: isXY=True
gls1 = GeoLineString(coordinates_1, is_xy=True)
gls2 = GeoLineString(coordinates_2, is_xy=True)
# There are two known intersections in the above sample data: [3, 3, 3] and [6, 10, 2]

# GeoLineStrings support .intersects() and .intersection() functions that are found in shapely

print(gls1.intersects(gls2))
print(gls1.intersection(gls2)) ## Returns the intersection locations
# GeoLineStrings also have a helper function to view the 3D linestring
gls1.plot()
# gls2 plot
gls2.plot()
# You can also pass the second linestring to the plot function to plot both on the same figure
gls1.plot(gls2)<jupyter_output><empty_output><jupyter_text>2. (Longitude, Latitude, Altitude) Data The required format for the GeoLineString is (Longitude, Latitude, Altitude)All units should be specified in meters.When working with (Lon., Lat., Alt) data you will need to specify two transformation EPSG codes:* epsg_from: Where the coordinates are being transformed from* epsg_proj: Where to project the coordinate transformationThe default epsg_from field is set to epsg:4326, which is most likely suitable for most needs https://epsg.io/4326The deault epsg_proj field is set to the US National Atlas Equal Area https://epsg.io/2163, which one may need to change based on the focal area of the data<jupyter_code>coordinates_3 = [[-71,42, 100], [-71.3, 42, 100], [-72,41,500],[-71.2,42.5, 100]]
coordinates_4 = [[-71.2,42.5, 100], [-71.3, 42, 100], [-71,41,100]]
# Lets define two additional geolinestrings
# Since the data provided is in (lon,lat,alt) coordinates, we omit the isXY=True field
gls3 = GeoLineString(coordinates_3, epsg_proj='epsg:2163')
gls4 = GeoLineString(coordinates_4) # epsg_proj default is 'epsg:2163'
gls3.plot()
gls4.plot()
gls3.plot(gls4)
print(gls3.intersects(gls4))
print(gls3.intersection(gls4))
print(gls3.intersection(gls4,lonlat=True)) # intersection in X,Y coordinates<jupyter_output>[[-71.2  42.5 100. ]]<jupyter_text>3. Length of GeoLineStringThe length (in unit **meters**) of the GeoLineString is determined at construction and can be accessed by `.length`<jupyter_code>print(gls3.length)<jupyter_output>334503.82490403065<jupyter_text>If the initial coordinates are changed or modified, the length can be recalculated through the `.geolinestring_length()` function<jupyter_code>gls3.geolinestring_length()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11796982167352538, 'fraction_numerical': 0.06412894375857339, 'mean_word_length': 6.366161616161616, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '520559', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1030, 'n_words': 322, 'path': 'Examples/Example - GeoLineStrings.ipynb', 'repo_name': 'marcbrittain/PyGeoShape', 'size': '2916'}