这个网站上有多少程序员使用GIS?
你使用什么中间件?ESRI?MapGuide的?谷歌?
你在做什么样的项目?您是专注于Web工作,制作桌面应用程序还是Intranet项目?你在哪个行业工作?
澄清:我在某种程度上忽略了关键方面:不使用os.system或subprocess - 只是python API.
我正在尝试转换NOAA GTX偏移网格的一部分以进行垂直基准转换,而不是完全遵循如何在GDAL中使用python执行此操作.我想采用一个网格(在这种情况下是一个Bathymetry归属网格,但它可能是一个geotif)并将其用作我想要做的模板.如果我能做到这一点,我觉得它将极大地帮助人们使用这种类型的数据.
这就是我所拥有的绝对无效的东西.当我在生成的目标数据集(dst_ds)上运行gdalinfo时,它与源网格BAG不匹配.
from osgeo import gdal, osr
bag = gdal.Open(bag_filename)
gtx = gdal.Open(gtx_filename)
bag_srs = osr.SpatialReference()
bag_srs.ImportFromWkt(bag.GetProjection())
vrt = gdal.AutoCreateWarpedVRT(gtx, None, bag_srs.ExportToWkt(), gdal.GRA_Bilinear, 0.125)
dst_ds = gdal.GetDriverByName('GTiff').Create(out_filename, bag.RasterXSize, bag.RasterYSize,
1, gdalconst.GDT_Float32)
dst_ds.SetProjection(bag_srs.ExportToWkt())
dst_ds.SetGeoTransform(vrt.GetGeoTransform())
def warp_progress(pct, message, user_data):
return 1
gdal.ReprojectImage(gtx, dst_ds, None, None, gdal.GRA_NearestNeighbour, 0, 0.125, warp_progress, None)
Run Code Online (Sandbox Code Playgroud)
示例文件(但它们重叠的任何两个网格,但在不同的投影中都会这样做):
命令行等同于我正在尝试做的事情:
gdalwarp -tr 2 -2 -te 369179 4773093 372861 4775259 -of VRT -t_srs EPSG:2960 \
MENHMAgome01_8301/mllw.gtx mllw-2960-crop-resample.vrt
gdal_translate mllw-2960-crop-resample.{vrt,tif}
Run Code Online (Sandbox Code Playgroud) 他们的文件简单而专业.但他们并没有过多提及这些开源项目之间的关系.我什么时候应该使用哪一个?哪一个适合什么情况?
如果您是熟悉这些项目的GIS开发人员,您能解释一下吗?
我正在寻找一种方法来获取一个功能集为200个国家的现有ESRI Shapefile.每个国家/地区要素都具有"NAME"属性.我的目标是创建一个Python脚本,添加一个任意(现在)的附加属性,比如"POPULATION".
当然我安装了OSGeo和GeoDjango模块.我到目前为止:
from osgeo import ogr
infile = ogr.Open('sample.shp', 1) #'sample.shp' is a pre-existing ESRI shapefile described above
inlyr = infile.GetLayerByIndex(0)
Run Code Online (Sandbox Code Playgroud)
我错过了一个OGR函数,它允许我将Feature属性字段插入现有的Shapefile中吗?
使用fiona和使用Python处理坐标系时osgeo,似乎有很多方法可以通过导入/导出不同的crs格式来定义坐标系,例如:
FIONA:
from fiona.crs import from_epsg,from_string,to_string
# Import crs from different formats:
wgs = from_epsg(4326)
wgs = from_string("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ")
# Export crs as proj4 string
wgs_proj4_string = to_string(wgs)
Run Code Online (Sandbox Code Playgroud)
OSGEO:
from osgeo import osr
srs = osr.SpatialReference()
srs.ImportFromESRI(['GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]'])
srs.ImportFromProj4("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
srs.ImportFromEPSG(4326)
#the import options are very rich
# Export to different formats
srs.ExportToProj4()
srs.ExportToWkt()
srs.ExportToXML()
#... many export options!
Run Code Online (Sandbox Code Playgroud)
但是,我注意到,这两个库都允许通过其EPSG代码轻松定义crs,但是它们都缺少逆函数(将crs导出为ESPG代码)。
我最接近EPSG代码的方式是:
srs.AutoIdentifyEPSG()
epsg = srs.GetAuthorityCode(None)
Run Code Online (Sandbox Code Playgroud)
但是它似乎并不那么可靠,而且其他提议的解决方案似乎也包括大量的调整或至少与Web服务相关。
问题: …
目前我已经安装了anaconda。我试图在我的脚本中调用 osgeo.ogr 模块来打开 shapefile,但出现以下错误:
导入错误:dlopen(/Applications/anaconda3/lib/python3.6/site-packages/osgeo/_gdal.cpython-36m-darwin.so, 2):库未加载:@rpath/libpoppler.71.dylib 引用自:/ Applications/anaconda3/lib/libgdal.20.dylib 原因:找不到图像
我通过 conda 安装了 gdal。
这是 conda 包的列表:
Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py36h2fc01ae_0
_r-mutex 1.0.0 anacondar_1
alabaster 0.7.10 py36h174008c_0
anaconda-client 1.6.14 py36_0
anaconda-navigator 1.8.4 py36_0
anaconda-project 0.8.2 py36h9ee5d53_0
appnope 0.1.0 py36hf537a9a_0
appscript 1.0.1 py36h9e71e49_1
asn1crypto 0.24.0 py36_0
astroid 1.6.3 <pip>
astroid 1.6.1 py36_0
astropy 2.0.3 py36h1de35cc_0
attrs 17.4.0 py36_0
babel 2.5.3 py36_0
backports 1.0 py36ha3c1827_1
backports.shutil_get_terminal_size 1.0.0 py36hd7a2ee4_2
beautifulsoup4 4.6.0 py36h72d3c9f_1
bitarray 0.8.1 py36h1de35cc_1
bkcharts 0.2 py36h073222e_0
blaze 0.11.3 py36h02e7a37_0 …Run Code Online (Sandbox Code Playgroud) 我尝试在 CentOS 8 上安装最新的 PostGIS 3.0.x,但没有成功。
我认为没有人在 RHEL 8 或 CentOS 8 上运行 PostGIS,我不明白为什么不这样做。貌似无法安装。
我已通过禁用 RHEL AppStream 成功安装了 Postgres 12.0
我在 CentOS 8 上安装 postgres 12 所采取的步骤:
1)
#dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Run Code Online (Sandbox Code Playgroud)
2)
#dnf --disablerepo AppStream install postgresql12
#dnf --disablerepo AppStream install postgresql12-server
Run Code Online (Sandbox Code Playgroud)
我现在正在尝试安装 PostGIS。
#dnf list --available | grep postgis30
Run Code Online (Sandbox Code Playgroud)
我看到 postgis30_96 是最新提供的(如下所列):
postgis30_96.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-client.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-client-debuginfo.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-debuginfo.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-devel.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-docs.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-gui.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-gui-debuginfo.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-utils.x86_64 3.0.0alpha4-6.rhel8 pgdg96 …Run Code Online (Sandbox Code Playgroud) 警告:忽略无效的分发 -yproj (c:\users\space_junk\appdata\local\programs\python\python310\lib\site-packages) 警告:忽略无效的分发 -yproj (c:\users\space_junk\appdata\local\程序\python\python310\lib\site-packages)警告:忽略无效的分发-yproj(c:\users\space_junk\appdata\local\programs\python\python310\lib\site-packages)
我在安装过程中遇到了很多问题,尤其是各种未满足的依赖项。这些是我的系统信息:
Linux
Python
我在安装gdal时经历了残酷的时光。我尝试在安装了GDAL的虚拟环境Python 3.6环境中重新安装Ubuntu Mint。在完成所有依赖项要求之后,我现在在运行后得到以下错误pip install gdal:
Collecting gdal
Using cached https://files.pythonhosted.org/packages/99/31/2e05c1be3196126fa04028aed51489f40ceea77e8361a80bc8b00fc463db/GDAL-2.3.1.tar.gz
Building wheels for collected packages: gdal
Running setup.py bdist_wheel for gdal ... error
Complete output from command /home/mnewman/pyenvs/py36/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-sxbz7tcv/gdal/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp00t__5p7pip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
copying gdal.py -> build/lib.linux-x86_64-3.6
copying ogr.py -> build/lib.linux-x86_64-3.6
copying osr.py -> build/lib.linux-x86_64-3.6
copying gdalconst.py -> build/lib.linux-x86_64-3.6
copying gnm.py -> build/lib.linux-x86_64-3.6
copying gdalnumeric.py -> build/lib.linux-x86_64-3.6
creating …Run Code Online (Sandbox Code Playgroud) osgeo ×10
gdal ×5
gis ×3
python ×3
esri ×2
fiona ×2
ogr ×2
python-3.x ×2
anaconda ×1
conda ×1
epsg ×1
geodjango ×1
geopandas ×1
geospatial ×1
google-maps ×1
hdf5 ×1
installation ×1
pip ×1
postgresql ×1
python-3.6 ×1
raster ×1
shapefile ×1
survey ×1
torch ×1
ubuntu-20.04 ×1
xerces-c ×1