Shapely question: Given a list of linestrings (as coordinate arrays) to be reprojected - what is best way to reproject just using pyproj and shapely?
If I cast as an array of linestrings, and apply the transform on each in a list, I seem to be getting slightly better performance (~7-8%) than if I cast all linestrings into one parent MultiLineString and apply the transform once.
from pyproj import CRS, Transformer
from shapely.ops import transform
project_to_meter = Transformer.from_crs(
CRS.from_epsg(4326),
CRS.from_epsg(2163),
always_xy=True)
option_1 = [LineString(path) for path in example_linestring_list]
option_2 = MultiLineString(mls_alt)
# method 2 seems to be ~7-8% faster - why? Is that the preferred pattern?
method_1 = transform(project_to_meter.transform, mls)
method_2 = [transform(project_to_meter.transform, x) for x in mls_alt]