Category Archives: Tip

Make map tiles with GDAL2Tiles

GDAL and GDAL2Tiles

GDAL (Geospatial Data Abstraction Layer) includes GDAL2Tiles that can generate map tiles for OpenLayers, Google Maps, Google Earth, and similar web maps. GDAL can be installed from OSGeo4W for Windows. We can find OSGeo4W at http://trac.osgeo.org/osgeo4w/. Unfortunately this only works for 32bit Windows as of now I am writing this article.

OSGeo4W is a package from Open Source Geospatial Foundation for Win32 environments. According to the OSGeo website,

OSGeo4W is a binary distribution of a broad set of open source geospatial software for Win32 environments (Windows XP, Vista, etc). OSGeo4W includes GDAL/OGR GRASSMapServer OpenEV uDig QGIS as well as many other packages (about 150 as of fall 2009).

OSGeo4W Setup for 32bit Windows

Caution: Do not follow the instructions at http://trac.osgeo.org/osgeo4w/ or http://help.maptiler.org/betatest/ for GDAL2Tiles. Especially there is a specific instruction at http://help.maptiler.org/betatest/ that you should not follow. That instruction only worked for GDAL 1.6 beta. Here is a new instruction for installation of GDAL for using GDAL2Tiles.

  1. Download the OSGeo4W installer from here.
  2. Run the installer.
  3. Select Advanced install.
  4. Select Libs and select gdal and gdal-python in the Select packages. Caution: do not select any other packages. Some dependent packages will be selected automatically upon your two selections: gdal and gdal-python.
  5. Finish the installation
  6. You can see OSGeo4W icon ion your desktop. That is a batch file invoking the command line prompt.
  7. That’s it.

This only works on Windows 32bit machines. For 64bit Windows machines, we need to follow quite different instructions.

GDAL and GDAL2Tiles Setup for 64bit Windows

OSGeo4W cannot be used for 64bit Windows machines. We have to install GDAL and Python manually.

  1. Install Python from x86-64 Installer at http://www.python.org/getit/.
  2. Run python.exe. We have to find out the compiler version that built the python. In my case, the Python version is 2.7.3 and it was compiled and built with MSC v.1500.Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32
  3. GDAL binary packages for 64bit machines can be found at http://vbkto.dyndns.org/sdk/. Select a corresponding version in the table. In my case, release-1500-x64-gdal-1-9-mapserver-6-0 is the right version in the”MSVC2008 (Win64) -stable” row because the Python was built by 1500.
  4. Download
    1. Generic installer for the GDAL core components – gdal-19-1500-x64-core.msi
    2. Installer for the GDAL python bindings (requires to install the GDAL core) – GDAL-1.9.1.win-amd64-py2.7.msi. I chose this because 1.9.3 is the latest and my Python is 2.7.3.
  5. Install the GDAL core components. There is no option to choose the destination folder for GDAL core. It will be installed into the “C:Program FilesGDAL” folder.
  6. Install the GDAL python bindings.
  7. After the binding, you may move GDAL folder in C:Program Files into wherever you want to.
  8. Add two batch files; gdal.bat and gdal2tiles.bat into GDAL folder. You can find these two bat files below.

gdal.bat

@echo off
 rem ---
 @echo Setting environment for using the GDAL Utilities.
 set GDAL_PATH=<full path of your GDAL installation>
 @echo GDAL path is %GDAL_PATH%.
 set PATH=%GDAL_PATH%;%PATH%
 set GDAL_DATA=%GDAL_PATH%gdal-data
 set GDAL_DRIVER_PATH=%GDAL_PATH%gdalplugins
 set PROJ_LIB=%GDAL_PATH%projlib
 rem ---
 @echo Setting environment for using the Python.
 set PYTHON_PATH=<full path of your Python installation>
 @echo Python path is %PYTHON_PATH%.
 set PATH=%PYTHON_PATH%;%PATH%
 @echo on @if [%1]==[] (cmd.exe /k) else (cmd /c "%*")

gdal2tiles.bat

python %GDAL_PATH%gdal2tiles.py %*

Now, you are ready to use GDAL2Tiles.

  1. Just double click gdal.bat.
  2. Type gdal2tiles with proper options.

You may combine these two into a single command.

  1. Open a command prompt window.
  2. Type gdal gdal2tiles with proper options.

Good luck and have fun.

AT&T U-Verse Wireless Connection Problem with Apple Devices

I have been using AT&T U-verse since last year. It has been better than AT&T DSL service which I used prior to U-verse. But sometimes the internet connection was not successful from only my Apple devices. Actually the fact that the problem is only from Apple devices was known to me quite lately. My son is using a Windows laptop. I found out that he never complained about his connection. I am not sure that my wired connection was also problematic since I didn’t check it because most of my networked devices are wireless.

I asked AT&T technical support to help me. They  were very kind and eager to solve my problem. After listening to my problem, the technical support changed my modem settings. I believed it helped since I didn’t have the disconnection problem anymore. But another problem, maybe more serious one arose. Network speed got seriously slow down. I called again AT&T technical support. All they said was that my modem and wire were OK. The technical support asked me to cold-reset my modem. So I did. The speed came back to normal. I believed that it helped and solved the problem. But it was not. The network speed got slow down again after a while.

I had decided to solve this problem by myself and checked out some relevant articles from the Internet. Many complaints existed here and there. But there were not many clear answers for the problem. So, my second approach was to check out my son’s Windows laptop which was getting network connection even though all my Apple devices weren’t. I found out the laptop’s wireless setting was using WPA-Personal as the wireless security. So I changed the security setting of my MacBook Pro’s AirPort. It didn’t solve the problem. I googled one more time. And I found an interesting answer for this disconnection problem. The guy said that the modem’s wireless setting should be changed.

I figured out that Apple’s AirPort Security settings have missing compared to Windows wireless settings. Among authentication types of WPA and WPA2, we can choose either TKIP or AES in the Windows settings but not in the AirPort settings. I suspected that Apple devices do not support one of types. The default setting of the U-verse modem is  “WPA-PSK (TKIP) and WPA2-PSK (AES).” I selected “WPA2-PSK (AES)” “WPA-PSK(TKIP)” instead of the default setting and clicked the ‘save’ button. This solved my wireless connection problem of my Apple devices without sacrificing network speed.

Here is a short version of what I did to solve my problem.

  1. Start a web browser. Go http://192.168.1.254
  2. Click the “Wireless” icon on the “Home” screen or select the “Settings” tab –> LAN –> Wireless. Either can bring you to the same setting page.
  3. Scroll down to the Security section.
  4. Select “WPA2-PSK (AES)” “WPA-PSK(TKIP)” in the Authentication Type.
Then, you may change your Windows Wireless settings to use WPA2-PSK (AES) WPA-PSK(TKIP) on your Windows machines if it is selected with (TKIP) something else.
Follow

Get every new post delivered to your Inbox.

Join 147 other followers