我遇到特定投影的问题。它似乎在proj4(http://proj4.org/usage/operations/projections/bipc.html)内得到支持但是当我在gdal中使用它时,就好像它不存在一样:
gdalsrsinfo:
gdalsrsinfo -o proj4 "+proj=bipc +ns"
产量
failed to load SRS definition
gdalwarp:
gdalwarp -overwrite -s_srs EPSG:4326 -t_srs "+proj=bipc +ns" -of GTiff in.tiff out.tiff
产量
ERROR 1: Translating source or target SRS failed: +proj=bipc +ns
此外,正在运行proj -lp
会将其列为bipc : Bipolar conic of western hemisphere
。
这些命令对我来说很好用,有更常见的(重新)投影,我在GDAL 1.11.5和2.2.2上试过这个。
为什么这个预测不起作用/如何识别它?
答案 0 :(得分:4)
GDAL不支持所有预测。你可以用Python列出这些:
#!/usr/bin/env python
from osgeo import osr
from subprocess import Popen, PIPE
osr.UseExceptions()
# Get the list of PROJ.4 projections
proj = {}
p = Popen(['proj', '-lp'], stdout=PIPE)
for line in p.communicate()[0].split('\n'):
if ':' in line:
a, b = line.split(':')
proj[a.strip()] = b.strip()
# Brute force method of testing GDAL's OSR module
supported = set()
not_supported = set()
for k in proj.keys():
sr = osr.SpatialReference()
try:
_ = sr.ImportFromProj4('+proj=' + k)
supported.add(k)
except RuntimeError as e:
not_supported.add(k)
print('{0} total projections, {1} supported, {2} not supported'
.format(len(proj), len(supported), len(not_supported)))
print('Supported: ' + ', '.join(sorted(supported)))
print('Not supported: ' + ', '.join(sorted(not_supported)))
总共134个预测,47个支持,87个不支持
支持:aea,aeqd,bonne,cass,cea,eck1,eck2,eck3,eck4,eck5,eck6,eqc,eqdc,etmerc,gall,geos,gnom,goode,gstmerc,igh,krovak,laea,lcc ,merc,mill,moll,nzmg,omerc,ortho,poly,qsc,robin,sinu,somerc,stere,sterea,tmerc,tpeqd,utm,vandg,wag1,wag2,wag3,wag4,wag5,wag6,wag7
不支持:通风,aitoff,alsk,apian,august,bacon,bipc,boggs,calcofi,cc,chamb,collg,crast,denoy,euler,fahey,fouc,fouc_s,gins8,gn_sinu,gs48,gs50,锤子,hatano,healpix,imw_p,isea,kav5,kav7,labrd,lagrng,larr,lask,latlon,lcca,leac,lee_os,lonlat,loxim,lsat,mbt_fps,mbt_s,mbtfpp,mbtfpq,mbtfps,mil_os,murd1, murd2,murd3,natearth,nell,nell_h,nicol,nsper,ob_tran,ocea,oea,ortel,pconic,putp1,putp2,putp3,putp3p,putp4p,putp5,putp5p,putp6,putp6p,qua_aut,rhealpix,rouss,rpoly, tcc,tcea,tissot,tpers,ups,urm5,urmfps,vandg2,vandg3,vandg4,vitk1,weren,wink1,wink2,wintri