I have two point shapefile representing towns within a state and I want find the distance between them. Since the points are in different shapefiles, should I merge them so they would be in the same shapefile before computing the linestring or is it possible to compute the linestring without merging both point shapefiles using shapely and Fiona function not GeoPandas.
ValueError: Record does not match collection schema:
import shapely
import fiona
from shapely.geometry import MultiPoint, Point, shape
POL = ".cache/merbin.shp"
POI = ".cache/merert.shp"
with fiona.open(POI) as src:
for elem in src:
if elem['id'] == '0':
geom = shape(elem['geometry'])
elem['geometry'] = mapping(geom.centroid)
with fiona.open(POL) as salt:
for tea in salt:
if tea['id'] == '0':
geom = shape(tea['geometry'])
tea['geometry'] = mapping(geom.centroid)
schema = {'geometry': 'Point',
'properties': {} }
with fiona.open('mew.shp', 'w', 'ESRI Shapefile', schema, crs=from_epsg(4326)) as output:
prop = {}
print(tea)
output.write(tea)
output.write(elem)