quinta-feira, 24 de agosto de 2017

osgeo4w

Cada programa que usa gdal acaba instalando uma instância do programa pra si. O osgeo4w tenta criar uma unica instancia para todos os programas que utilizam da biblioteca.

http://www.gisinternals.com/release.php

Escolhi: release-1500-gdal-2-2-1-mapserver-7-0-6

Instalado python 2.7.13 - já vem com pip
instalado vcpython27 2014 - Visual C++ for Python 2.7
Instalado numpy via pip install numpy
Instalado gdal-202-1500-core.msi - python 2.7.13 no caso, tem compilação 1500
Instalado GDAL-2.2.1.win32-py27.msi

Adicionado paths:
Novo: 
Nome da variável: GDAL_DATA
Valor da variável: C:\Program Files (x86)\GDAL\gdal-data

Novo:
Nome da variável: GDAL_DRIVER_PATH
Valor da variável: C:\Program Files (x86)\GDAL\gdalplugins

Edit:
Nome da variável: Path
Valor da variavel: adicionar -->    C:\Program Files (x86)\GDAL\
Se colocar no final da linha, tem que ter um ; no inicio: ;C:\Program Files (x86)\GDAL\

Reiniciar a máquina

Testando, ir no prompt de comando e rodar gdalinfo
Aqui deu erro:

ERROR 1: Can't load requested DLL: c:\Program Files\GDAL\gdalplugins\ogr_MSSQLSpatial.dll

Solução: Pode apagar o arquivo ogr_MSSQLSpatial.dll
Mas eu criei uma pasta e coloquei a dll lá dentro, só por precaução, caso precise da dll mais pra frente. Outra opção é instalar o SQL Server Native Client




I find OSGEO4W a poor solution because it creates a whole parallel universe, almost like a virtual machine. I was able to install GDAL and use it in python following the steps outlined here (this is the link provided by @sys49152).
It sends you to gisinternals.com. Take the link to "stable releases" to get to:http://www.gisinternals.com/release.php
Now you have to choose between 32 and 64 bits and different Microsoft Visual C++ compiler versions. Note that this has to match your python version, not your OS. In my case I have a 64 bit windows, but a 32 bit python 2.7 (that shipped with ArcGIS).
To see what you have you can run python on the command line and a message like this:
C:\>python
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
So I need to use "release-1500"
I selected: MSVC 2013/win32 release-1500-gdal-1-11-3-mapserver-6-4-2
(the build version numbers will change over time)
I first downloaded and installed the "Generic installer for the GDAL core components": gdal-111-1500-core.msi
And added the path and other variables as described here.
Add to path: C:\Program Files (x86)\GDAL Create environmental variables: GDAL_DATA = C:\Program Files (x86)\GDAL\gdal-data GDAL_DRIVER_PATH = C:\Program Files (x86)\GDAL\gdalplugins
Then, I downloaded and installed the python module for python 2.7 GDAL-1.11.3.win32-py2.7.msi
And after that, in python I was able to do
from osgeo import gdal
ds = gdal.Open('file.tif')
etc.

Nenhum comentário: