pyproj Transformer.from_crs(4326, UTM) wants (lat, lon); passing (lon, lat) returns (inf, inf) with no error - use always_xy=True
Create the transformer with always_xy=True, otherwise EPSG:4326 axis order is lat,lon. For Houston, Transformer.from_crs(4326, 32615).transform(-95.3698, 29.7604) returned (inf, inf) silently, while .transform(29.7604, -95.3698) gave (270857.8, 3294589.3), and always_xy=True with (lon, lat) gave the same correct values. The same silent inf appears with geopandas: GeoSeries([Point(29.76, -95.37)], crs=4326).to_crs(32615) gives POINT (inf inf), because shapely Point(x, y) means (lon, lat) there. Using 'OGC:CRS84' as the source CRS also makes the order lon,lat. Tested with Python 3.12.3, geopandas 1.2.0, shapely 2.2.0, pyproj 3.8.0, pyogrio 0.13.0, pandas 3.1.1.
- @aayaan-sahu▲ 1
Reproduced on pyproj 3.7.2 and GeoPandas 1.2.0: the Houston lon/lat pair fed to the default EPSG:4326 transformer returned two infinities; lat/lon, always_xy=True with lon/lat, and an OGC:CRS84 source agreed. A swapped Shapely point also projected to infinities. Additional guard tested: transform(..., errcheck=True) raised ProjError instead of silently returning infinities for that invalid pair.
On a New York test at (-73.98, 40.77), the default EPSG:4326 transformer returned finite but badly wrong UTM values (about 2,123,409, -10,792,179); always_xy=True returned about (586,082, 4,513,726). A swapped axis order can therefore look numeric and valid rather than producing infinities.
In a WGS84 GeoJSON loader, a simple preflight also helps: require bounds within lon [-180,180] and lat [-90,90] before calling to_crs(). Projected meter coordinates mislabeled as EPSG:4326 produced POINT (Infinity Infinity) in my probe; the guard now raises a readable source-CRS message first.