[gdal-dev] Issues with bipolar conic western hemisphere projection (+proj=bipc +ns)

btjakes briantjacobs at gmail.com
Mon Oct 30 13:56:17 PDT 2017


Hi, I've brought up this issue on stackoverflow but thought I'd get better
visibility here.
https://stackoverflow.com/questions/47019616/gdal-doesnt-recognize-bipolar-conic-western-hemisphere-projection

I'm having trouble with a particular projection. It seems supported within
proj4 (http://proj4.org/usage/operations/projections/bipc.html) But when I
use it within gdal it's as if it doesnt exist:

gdalsrsinfo:
```
gdalsrsinfo -o proj4 "+proj=bipc +ns"
```
yields
```
failed to load SRS definition
```
gdalwarp:
```
gdalwarp -overwrite -s_srs EPSG:4326 -t_srs "+proj=bipc +ns" -of GTiff
in.tiff out.tiff
```
yields
```
ERROR 1: Translating source or target SRS failed: +proj=bipc +ns
```

Also, running `proj -lp` lists it bipc : Bipolar conic of western
hemisphere.

These commands work fine for me with more common (re)projections, and I've
tried this on GDAL 1.11.5 and 2.2.2.

I was able to get this sort of to work within a mapbox rasterio script (not
sure what the difference is, given that it is GDAL powered). There's a
different problem. I'm doing a reprojection from WGS84 raster data to
"+proj=bipc +ns" and it blots out a bunch of the data through the center of
the image. 

Before:
<http://osgeo-org.1560.x6.nabble.com/file/t382003/Screen_Shot_1.png> 

After:
<http://osgeo-org.1560.x6.nabble.com/file/t382003/Screen_Shot_2.png> 
(NODATA is black)

This seems like some sort of artifact from the hybrid nature of the
projection (http://www.quadibloc.com/maps/images/bocc.gif). But I'm not sure
how to remedy this.

I can put `SOURCE_EXTRA=1000 SAMPLE_GRID=YES SAMPLE_STEPS=100` gdalwarp
flags in the rasterio script (a la
http://osgeo-org.1560.x6.nabble.com/gdalwarp-cutting-off-projected-image-td3756390.html)
but they dont seem to have an effect.

The relevant rasterio code is here

```
destCrs = rasterio.crs.CRS.from_string("+proj=bipc +ns")
width = 3142 
height = 4788
bounds = rasterio.coords.BoundingBox(left=-8140886.583,
bottom=-11629369.004, right=6276024.286, top=10340131.073)
affine = rasterio.transform.from_bounds(bounds.left, bounds.bottom,
bounds.right, bounds.top, width, height)

bandIn = src.read(1)

np.putmask(bandIn, bandIn < 0, 0)
bandOut = np.empty((height, width), np.float32)

reproject(
	source=bandIn,
	destination=bandOut,
	src_transform=src.affine,
	src_crs=src.crs,
	dst_transform=affine,
	dst_crs=destCrs,
	resampling=RESAMPLING.nearest,
	# Commented out GDAL flags for now: 
	# SOURCE_EXTRA=1000, SAMPLE_GRID="YES", SAMPLE_STEPS=100
)
```

Thanks for any help on either route.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list