gdal

Launching python subprocess has different behavior depending on launcher

孤街浪徒 提交于 2019-12-04 03:56:38
问题 I'm attempting to launch Python 2.5 from Python 2.6. The reason for this is a compiled library I'm trying to use (GDAL) isn't supported for the version of Python distributed with another program (ArcGIS). Here's what I'm attempting to do. The main.py file in Python 2.6: import subprocess p = subprocess.Popen(['C:\OSGeo4W\gdal_python_exec.bat', 'X:\\local\\import_tests.py']) gdal_python_exec.bat is a windows batch script that fires up the 2.5 version of Python I want while also setting up some

GDAL GDALRATSetValueAsString() how to save Chinese characters (c#)?

こ雲淡風輕ζ 提交于 2019-12-04 01:58:15
I need help with GDAL. The string value with Chinese symbols is not readed/saved correctly (C#). For SAVING grid value we using: private static extern void GDALRATSetValueAsString(IntPtr handle, int row, int field, [In][MarshalAs(UnmanagedType.LPStr)] string value); method (c#) to save string value, it seems that this method saves string as ANSI string . For READING: private static extern IntPtr GDALRATGetValueAsString(IntPtr handle, int row, int field); In. Example my string "银行Flamwood C2" There is for methods to get value by pointer (use in GDALRATGetValueAsString metho): var pointer =

Exception while using GDAL in C#

痞子三分冷 提交于 2019-12-04 00:17:15
问题 I started to use gdal_csharp dll in my application and read a geotiff file. but it says: The type initializer for 'OSGeo.GDAL.GdalPINVOKE' threw an exception. it's my code string fileName = @"/path to geotiff file"; OSGeo.GDAL.Dataset DS = OSGeo.GDAL.Gdal.Open(fileName, OSGeo.GDAL.Access.GA_ReadOnly); can anyone help? Edit: I have these dlls This is the full error message: It says that cannot load gdal_wrap . But when I'm going to add that dll to my application the below message is shown: 回答1

GeoDjango - GDAL library giving error

纵然是瞬间 提交于 2019-12-03 23:08:21
I am trying to get GeoDjango running on ubuntu and have hit a problem with GDAL. I have downloaded and installed GDAL without problem. I had to add the following line to my project settings: GDAL_LIBRARY_PATH = '/usr/local/lib/libgdal.so.1.15.1' When I check in the shell all is good: In [1]: from django.contrib.gis import gdal In [2]: gdal.HAS_GDAL Out[2]: True However when I try and run ogrinfo as in the official tutorial I get the following error: $ ogrinfo world/data/TM_WORLD_BORDERS-0.3.shp ogrinfo: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No such

Packaging GDAL with Java

有些话、适合烂在心里 提交于 2019-12-03 21:21:49
I have a Java project that uses GDAL bindings on Win7. The problem is that due to the nature of the bindings, it requires setting environment variables to work, specially PATH , GDAL_DATA , GDAL_DRIVER_PATH , and PROJ_LIB . I mean they're easy enough for me to create and point to the GDAL directory. However if I ever want to distribute this, this is going to be an unwieldy step for the average user. I need some way to configure the GDAL bindings in a way that the user can copy the program wherever they like, which has the jar and GDAL libraries, and the bootstrap code will automatically set

Install GDAL on Python 2.7 on a Amazon Linux virtual server

╄→尐↘猪︶ㄣ 提交于 2019-12-03 21:13:44
I have a t2.micro Amazon Linux instance running. Python 2.7.12 is pre-installed already. I would like to install GDAL with the Python. I have got gcc c++ and numpy installed. None of the following commands worked for me: sudo yum install gdal-devel sudo yum install gdal sudo yum install python-gdal They all resulted in a following message saying. No package {PACKAGE_NAME} available. Error: Nothing to do I cannot run apt-get on a Amazon Linux instance. Also none of the relevant SO posts worked for me either. I also ran sudo easy_install GDAL and this gave a MemoryError as below: Searching for

GDAL WriteArray issue

蹲街弑〆低调 提交于 2019-12-03 14:10:55
I'm utilizing python GDAL to write a raster data into a .tif file. Here's the code: import numpy, sys from osgeo import gdal, utils from osgeo.gdalconst import * # register all of the GDAL drivers gdal.AllRegister() # open the image inDs = gdal.Open("C:\\Documents and Settings\\patrick\\Desktop\\tiff elevation\\EBK1KM\\color_a1.tif",GDT_UInt16) if inDs is None: print "couldn't open input dataset" sys.exit(1) else: print "opening was successful!" cols = inDs.RasterXSize rows = inDs.RasterYSize bands = inDs.RasterCount driver = inDs.GetDriver() driver.Create("C:\\Documents and Settings\\patrick\

GTiff mask with shapefile in python with gdal, ogr, etc

僤鯓⒐⒋嵵緔 提交于 2019-12-03 13:40:36
问题 OK, After a bit of fiddling, I've tweaked a script from the site hyperlink in the second comment line. The purpose of the script is to clip/mask a LARGE raster (i.e. that cannot fit into a 32-bit Python 2.7.5 application) in GTiff format with a shapefile with multiple polygons (each with a "Name" record) and save the clipped rasters into a "clip" sub-directory, where each masked grid is named after each polygon's "Name". Like the original script, it assumes that the GTiff and shapefile are in

Coding and Paper Letter(十七)

允我心安 提交于 2019-12-03 13:18:28
资源整理。 1 Coding: 1.数据科学课程。课程、实验、教程以及code。 datascience box 2.自动根据github生成你的程序员简历。只需要输入github账户名即可生成。 resume.github.com 3.R语言包av,可以结合animation或者gganimate生成mp4视频。 av 4.Python开源项目PointProcesses,Python里点过程的简单模拟,点过程、时间点过程、时空过程,包括核密度估计。 PointProcesses 5.用GDAL/QGIS/WebGL制作3维地图,以DEM为主。 making 3d map 6.R语言开源项目,使用.stl文件中的R生成以3D打印。 impresion3D 7.机器学习研讨会。 ml workshop 1 ml workshop 2 ml workshop 3 ml workshop 4 8.基于R和QGIS的英国房价3维可视化。 datavis3d 9.R语言包ggcorrplot,ggplot2的拓展包, ggcorrplot 10.R语言周报,R语言社区的重要部分之一。更新R语言相关的各项资讯。 rweekly.org 11.美国环保署EPAR语言用户研讨会议程。 2018 12.Python机器学习书第二版代码和在线资源。 python machine learning

【opencv图像处理】图片的读取——cv2.imgread各种读取方式对比

家住魔仙堡 提交于 2019-12-03 09:35:16
以下实验基于python==3.6、opencv-python==4.1.0.25、imutils==0.5.2 图片的读取 cv2.imread 该方法第一个参数为文件名filename(文件路径+文件名) 第二个为读取方式flags,可选参数 IMREAD_ANYCOLOR = 4 IMREAD_ANYDEPTH = 2 IMREAD_COLOR = 1 IMREAD_GRAYSCALE = 0 IMREAD_IGNORE_ORIENTATION = 128 IMREAD_LOAD_GDAL = 8 IMREAD_REDUCED_COLOR_2 = 17 IMREAD_REDUCED_COLOR_4 = 33 IMREAD_REDUCED_COLOR_8 = 65 IMREAD_REDUCED_GRAYSCALE_2 = 16 IMREAD_REDUCED_GRAYSCALE_4 = 32 IMREAD_REDUCED_GRAYSCALE_8 = 64 IMREAD_UNCHANGED = -1 前4中读取方式的shape和显示效果如下 可见 IMREAD_GRAYSCALE 和 IMREAD_ANYDEPTH 都只读取了一层灰度图像 而 IMREAD_COLOR 和 IMREAD_ANYCOLOR 读取了3层彩色图像 因为这里只测试了jpeg图片