0

I have two layer, shapefile and raster. I need to re project shape-file into EPSG:32633 - WGS 84 / UTM zone 33N . I did it using this python code:

import geopandas as gpd

# Path to the original shapefile
shapefile = r'2019_ID69.shp'
gdf = gpd.read_file(shapefile)

print("Original CRS: ", gdf.crs)
if gdf.crs != 'EPSG:32633':
    gdf = gdf.to_crs('EPSG:32633')
    print("Reprojected CRS: ", gdf.crs)
else:
    print("No reprojection needed.")

# Define the output path for the new shapefile
output_shapefile_path = r'reprojected_2019.shp'

# Save the GeoDataFrame as a shapefile
gdf.to_file(output_shapefile_path)

I also reproject it through data management in QGIS . However in both cases my shapefile is not in the correct place (based on base map) and not aligned with my raster layer (EPSG:32633 - WGS 84 / UTM zone 33N)

3
  • 3
    what projection is your shapefile in to start with?
    – Ian Turton
    Commented Jan 14 at 12:31
  • What projection is your vector layer in and what projection is set for the QGIS project? Is the vector layer aligned with the raster layer before the reprojection? Commented Jan 14 at 17:51
  • when I use EPSG 4326/WGS84 for the shapefile and EPSG:32633 - WGS 84 / UTM zone 33N for my raster file they are aligned. but when I reproject my shapefile to the same one with raster it doesnt aligned. I know theses two layesr are in different project system but I need to extract information from tif layer and they should be in the same projection for it.
    – Sahar
    Commented Jan 14 at 22:57

1 Answer 1

0

I would like to add the solution to my question here, it was very basic but I did not know and it might be useful for another beginner person, I changed the name of my files and it affected the projection. otherwise the above code could help to reproject.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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