The line
shpSavedLayer.setCrs(projectCrs)
overrides your layers' CRSs regardless of their coordinates' actual CRS. Don't doFor that andto work properly you must know the actual CRS of your map should lookdata.
The data you are using https://data.cityofnewyork.us/Housing-Development/Public-Use-Microdata-Areas-PUMA-/cwiz-gcty comes with a PRJ file of
GEOGCS[
"WGS84(DD)",
DATUM["WGS84", SPHEROID["WGS84", 6378137.0, 298.257223563]],
PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295],
AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH]
]
While this is actually a definition for WGS84 (EPSG:4326, at least the parameter values are the same), QGIS fails to properly process this as expectedyou must have noticed. But most importantly: That data is not in EPSG:3395.
You onlyTo fix this, you need to set the layer's CRS separately:
layerCrs = QgsCoordinateReferenceSystem.fromEpsgId(4326)
shpSavedLayer.setCrs(layerCrs)
For the project/canvas you can use that method ifwhatever CRS you want to fixlike, EPSG:3395 8WGS 84 / World Mercator) would be a wrongly detected or missing CRS. You must not use it if your data is valid and correctdistorted view as well, I would recommend EPSG:26918 (NAD83 / UTM zone 18N) for optimal results.