Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

outputs.stitch_crowns is registering the same CRS as being different #88

Open
rjstack266 opened this issue Feb 9, 2023 · 4 comments
Open

Comments

@rjstack266
Copy link

Hi there, am trying to stitch predictions together and am getting the following error:

ValueError: Cannot determine common CRS for concatenation inputs, got ['WGS 84 / UTM zone 30N', 'WGS 84 / UTM zone 30N']. Use to_crs() to transform geometries to the same CRS before merging.

I have attempted to force a different crs onto the predictions using a for_loop (shown below but error persists). The two "different" crs's shown are identical!

specify the input and output folders

input_folder = tiles_path + "predictions_geo/"
output_folder = tiles_path + "predictions_geo_crs32630/"

specify the target CRS

target_crs = 'EPSG:32630'

loop through all files in the input folder

for filename in os.listdir(input_folder):
# construct the full file path for the input and output files
input_filepath = os.path.join(input_folder, filename)
output_filepath = os.path.join(output_folder, filename)

# read the file using geopandas
gdf = gpd.read_file(input_filepath)

# apply the to_crs() function to the file
gdf_reprojected = gdf.to_crs(target_crs)

# write the reprojected file to the output folder
gdf_reprojected.to_file(output_filepath)
@zeppehpt1
Copy link

Did you follow the "Generating landscape predictions" steps from the documentation?

@rjstack266
Copy link
Author

Not completely - the tutorial does not actually define the variable crowns that is referenced.

Tutorial says:
project_to_geojson(data, tiles_path + "predictions_geo/", tiles_path + "predictions/")
crowns = crowns[crowns.is_valid]
crowns = clean_crowns(crowns, 0.6)

I am using

outputs.project_to_geojson(data, tiles_path + "predictions_geo/", tiles_path + "predictions/")
crowns = outputs.stitch_crowns(tiles_path + "/predictions_geo/",1)

The predictions themselves are made just fine, I can take the crowns and drop them over an orthographic photo in QGIS. There is just massive overlap thanks to tiling.

@PatBall1
Copy link
Owner

Hi @rjstack266 sorry you are having some issues. I am away in the field this week but I will have a look at correcting the bug or updating the tutorial as soon as I am back.

@rjstack266
Copy link
Author

rjstack266 commented Feb 13, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants