1

I create a GeoJSON but the merged values are null. The length of the datasets do not match -- is this a potential issue? If so, how do I merge for all covid matches. (FYI this isnt Covid19 related COV is short for covenant- housing).

I have tried the method suggested here. https://gis.stackexchange.com/a/359055/177082

import pandas
import geopandas
import fiona

gdf = geopandas.read_file(r'.\\UL1.geojson') # geojson file
df = pandas.read_csv(r'D:\ATMS\data\Blank.csv') #CSVfile

hvista=gdf.merge(df, on='Covid', how='left')


hvista.to_file("Hvista.geojson", driver="GeoJSON")

print(hvista)

and assuming it is a data type issue i have tried the following:

    import pandas
import geopandas 
import shapely
from geopandas import GeoDataFrame

gdf = geopandas.read_file(r'.\\UL1.geojson') # geojson file
df = pandas.read_csv(r'.\data\Blank.csv') #CSVfile



gdfa=gdf.merge(df.astype(str), on='Covid', how='left')
gdfa=GeoDataFrame(gdfa, crs="urn:ogc:def:crs:EPSG::3857")
gdfa.to_file("Hvista.geojson", driver="GeoJSON")

print(gdfa)
0

yikes, so the above is fine. the code was throwing "NaN" due to inconsistencies (capitalisation) in the 'covid' field in df. Sorry if I have wasted anyone's time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.