Tiler tools, an alternative scripts to Gdal2tiles.py for creating raster tiles from digital maps

Other day I was working to generate the Google Map based raster tiles using Gdal2tiles for a large raster file, 30GB in size. Gdal2tiels complains about the following error, which I had no clue.

Then fiddling with others tilers available I played with the Tilers-tools, python Scripts for raster tile sets from digital maps with GDAL dependency. After spending few days hit and trial, finally I am able to generate raster tiles compatible with Google Maps. Here I am sharing the steps that I follow to produce tiles using the Tiler tool. Hope it will help some of the OSGeo users. I have divided tile generation steps into two groups, dependency installation and data preparation with a presumption that you are already familiar with GDAL.

A] DEPENDENCY INSTALLATION

STEP 1. Install Python geospatial packages

Install the dependencies as described-

For my project, I used 32 bit installers and Python 2.7. Strictly follow the python Geospatial package dependency installation orders and do not mix the 64 bit and 32 bit dependencies

STEP 2. Install the Tiler tools

Download and unzip the Tiler tool from: http://sourceforge.net/p/tilers-tools/wiki/WinInstall/

STEP 3. Set Python and Gdal path in Tiler’s bat file

Open : tilers-tools.bat from unzipped Tiler tool
         set PYTHON=C:\Python27 ( As you assigned the path in Step 1)
         set GDAL=C:\Program Files (x86)\GDAL ( As you assigned the path in Step 1)

STEP 4. Environmental variable setting on your machine

Set GDAL_DATA & path in your environmental variable setting.

                   Variable          Value

       GDAL_DATA = C:\Program Files (x86)\GDAL\gdal-data

        path = C:\Program Files (x86)\GDAL

Easy 5 steps to get thumbnails out of Pdf using Python

1) Install Ghost script before python dependencies installation from: http://www.a-pdf.com/convert-to-pdf/gs.exe

2) Make yourself familier with Wand, a ctypes-based simple ImageMagick binding for Python.

3) Install Wand - pip install wand

4) Use the following script..
 #Install Ghost script before python package's installation   
 #from: http://www.a-pdf.com/convert-to-pdf/gs.exe  

 from wand.image import Image  
 from wand.display import display  
 fileDirectory = "D:/files/"  
 inFileName="myInputfile.pdf"  
 outFileName="myOutputfile.png"  
 imageFromPdf = Image(filename=fileDirectory+inFileName)  
 pages = len(imageFromPdf.sequence)  
 print(pages)  
 image = Image(  
   width=imageFromPdf.width,  
   height=imageFromPdf.height * pages  
 )  
 for i in range(pages):  
   image.composite(  
     imageFromPdf.sequence[i],  
     top=imageFromPdf.height * i,  
     left=0  
   )  
 image.format="png"  
 image.save(filename=fileDirectory+outFileName)  
 display(image)  



5) Let me know if you have any trouble.

Plan for Future Landsat Program: NASA, USGS Begin Work on Landsat 9 to Continue Land Imaging Legacy

NASA and the U.S. Geological Survey (USGS) have started work on Landsat 9, planned to launch in 2023, which will extend the Earth-observing program’s record of land images to half a century. The year 2023 seems like a long way off, however.  
The Landsat program has provided accurate measurements of Earth’s land cover since 1972. With data from Landsat satellites, ecologists have tracked deforestation in South America, water managers have monitored irrigation of farmland in the American West, and researchers have watched the growth of cities worldwide. With the help of the program’s open archive, firefighters have assessed the severity of wildfires and scientists have mapped the retreat of mountain glaciers.
The President’s fiscal year 2016 budget calls for initiation of a Landsat 9 spacecraft as an upgraded rebuild of Landsat 8, as well as development of a low-cost thermal infrared (TIR) free-flying satellite for launch in 2019 to reduce the risk of a data gap in this important measurement. The TIR free flyer will ensure data continuity by flying in formation with Landsat 8. The budget also calls for the exploration of technology and systems innovations to provide more cost effective and advanced capabilities in future land-imaging missions beyond Landsat 9, such as finding ways to miniaturize instruments to be launched on smaller, less expensive satellites.
“Moving out on Landsat 9 is a high priority for NASA and USGS as part of a sustainable land imaging program that will serve the nation into the future as the current Landsat program has done for decades,” said John Grunsfeld, associate administrator for science at NASA Headquarters, Washington. “Continuing the critical observations made by the Landsat satellites is important now and their value will only grow in the future, given the long term environmental changes we are seeing on planet Earth.”
Because an important part of the land imaging program is to provide consistent long-term observations, this mission will largely replicate its predecessor Landsat 8. The mission will carry two instruments, one that captures views of the planet in visible, near infrared and shortwave-infrared light, and another that measures the thermal infrared radiation, or heat, of Earth’s surfaces. These instruments have sensors with moderate resolution and the ability to detect more variation in intensity than the first seven satellites in the Landsat program. Source

How to remove twitter headers and footer from twitter widget?

There are two ways to remove twitter headers and footer from the widget:

Method 1: Add data-chrome attribute to anchor tag

<a class="twitter-timeline" href="https://twitter.com/TWITTER_ID" data-widget-id="YOUR_WIDGET_ID" data-chrome="nofooter noborders transparent">Tweets by @TWITTER_ID </a>

Method 2: Using CSS

.timeline-header, .timeline-footer
{
          display:none ;
}

More customization on Embedded timelines : Customization Options

Conference: FOSS4G Seoul 2015, FOSS4G First Time in Asia

The annual FOSS4G conference is the largest global gathering focused on open source geospatial solution. FOSS4G brings together developers, users, decision-makers and businessmen from a broad spectrum of organizations and fields of operation. Through six days of workshops, presentations, discussions and code sprint, FOSS4G participants create effective and relevant geospatial products, standards, human networks and business opportunities.

FOSS4G Seoul team is very pleased to announce that FOSS4G Seoul conference is now open for registration. http://2015.foss4g.org/attending/registration/  This year’s International FOSS4G will be held in The-K Hotel, Seoul, 14-19 September, for the first time in Asia.  

How to update R to a new version?

A R update method proposed by Dr. Jeffrey S. Evans, University of Wyoming. Here is the method background and details:

Updating R to a new version can be difficult so, I thought that R users out there would find these R version management and configuration approaches useful. There is an R package “installr” that allows one, at the command line, to check the current R version and optionally: 1) download the new version, 2) launch the install, 3) move installed libraries to the new R install, 4) update libraries and 5) uninstall the previous R version. I also attached an “Rprofile.site” R GUI configuration file that will set the path for the R library and changes some other settings.

Following is the code that will install and require the “installr” package and run the “updateR” function with the appropriate flags. To run in Windows, right click the R icon and select "Run as administrator". This script will automatically: 1) check and download the current version of R, 2) execute the install, 3) move current packages to new install, 4) delete old packages, 5) update packages. Copy and paste the following highlighted code block and then answer the queries at the R commandline.

# set a CRAN mirror and library path
.Library.site <- file.path(chartr("\\", "/", R.home()), "library")
.libPaths(file.path(chartr("\\", "/", R.home()), "library"))
local({r <- getOption("repos")
       r["CRAN"] <- "http://cran.stat.ucla.edu/"
       options(repos=r)})
# If not installed, adds installr library and runs updateR function
if(!require(installr)) {
  install.packages("installr", repos = "http://cran.us.r-project.org")
  require(installr)
  }
updateR(install_R = TRUE, copy_packages = TRUE, keep_old_packages = FALSE,
        update_packages = TRUE, quit_R = FALSE, keep_install_file = FALSE)
                               
In the R install wizard choose:
                Go with install defaults until...
                Under "select components", uncheck 32-bit core files       NEXT>
                Under "startup options" select: Yes (customize startup)   NEXT>
                Under "Display Mode" select: SDI (separate windows)      NEXT>
                Then go with defaults.                                              

You can then uninstall the previous R version(s), with this command, by choosing the previous version in the popup-box, or just specifying the version.

uninstall.R() for interactive window or uninstall.R("3.1.2") to uninstall a specific version.  


The “Rprofile.site” R GUI configuration file configures the R GUI:
1) sets the default library path, so that it does not default to your windows users directory (as long as packages are installed with R running as administrator);
2) sets a few options so numbers are never displayed as scientific notation and strings are not automatically coerced into factors and;
3) adds two useful functions “ls.functions” and “unfactor”. The “ls.functions” will list all the functions, associated with the specified package, in the R namespace and the “unfactor” function will coerce factors in a data.frame into a character class.

#### example to list all available functions in the MASS package ####
require(MASS)
ls.functions(MASS)

#### coerce factor to character ####
( x <- data.frame( y=as.factor(c("1","3","5")),
          x=as.factor(c("yes","no","perhaps"))) )
str(x)

# Coerce single column
class(unfactor(x)$y)

# Coerce entire data.frame
x <- unfactor(x)
str(x)


Landsat Band combinations for highlighting Earth features

Following are the band combinations for highlighting earth features for Landsat Images.
  
 Agriculture: Highlights agriculture in bright green. Bands 6,5,2
 Natural Color: Sharpened with 25m panchromatic band. Bands 4,3,2+8
 Color Infrared: Healthy vegetation is bright red. Bands 5,4,3
 SWIR (Short Wave Infrared): Highlights rock formations. Bands 7,6,4
 Geology: Highlights geologic features. Bands 7,4,2
 Bathymetric: Highlights underwater features. Bands 4,3,1
 Panchromatic: Panchromatic image at 15m. Band 8
 Vegetation Index: Normalized Difference Vegetation Index (NDVI). (Band5-Band4)/(Band5+Band4)
 Moisture Index: Normalized Difference Moisture Index (NDMI). (Band5-Band6)/(Band5+Band6)

Further Details:  Identifying land use and land cover(LULC) features using band rationing technique

ArcMap tool for Panning and Zooming while editing using C#

Draw features in ArcMap using ArcGIS Addin tool (Arcobject's IRubberband Interface) doesn't provide ways to zoom and pan while editing. In order to implement pan and zoom functionality during edit use IDisplayFeedback Interface. Following is  the code snippets using IDisplayFeedback Interface using C#. Then, you can use ArcMap standard keys to pan (arrows-left, right, top, bottom) and zoom (mouse-scroll or Z & X).
     protected override void OnUpdate()  
     {  
       Enabled = ArcMap.Application != null;  
     }  
     protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)  
     {  
       DrawGeometryOnMousedown(ArcMap.Document, arg);  
     }  
     protected override void OnMouseMove(MouseEventArgs arg)  
     {  
       DrawGeometryOnMouseMove(ArcMap.Document, arg);  
     }  
     protected override void OnDoubleClick()  
     {  
       FinishGeometryDrawOnDblClick(ArcMap.Document);  
     }  
     protected override void OnRefresh(int hDC)  
     {  
       if (newPolygonFeedback != null)  
       {  
         newPolygonFeedback.Refresh(hDC);  
       }  
     }  
     #region private helpers  
     //Polygon geometry object  
     private INewPolygonFeedback newPolygonFeedback;  
     private void DrawGeometryOnMousedown(IMxDocument doc, ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)  
     {  
       // Get the ScreenDisplay for the the ActiveView  
       IDisplay display = doc.ActiveView.ScreenDisplay;  
       // Get the current mouse location in Map Units  
       IPoint point = display.DisplayTransformation.ToMapPoint(arg.X, arg.Y);  
       // Check that user is not using an existing feedback  
       if ((newPolygonFeedback == null))  
       {  
         // Create a new Feedback  
         newPolygonFeedback = new NewPolygonFeedback();  
         // Get the Feedback's Symbol by reference (IDisplayFeedback::Symbol)  
         var simpleLineSymbol = newPolygonFeedback.Symbol as ISimpleLineSymbol;  
         // Create a new RGBColor and set it up  
         IRgbColor rgbColor = new RgbColor();  
         rgbColor.Green = 255;  
         rgbColor.Red = 0;  
         rgbColor.Blue = 255;  
         // Set the Color and Style for the Feedback's Symbol  
         if (simpleLineSymbol != null)  
         {  
           simpleLineSymbol.Color = rgbColor;  
           simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;  
         }  
         // Set the new Feedback's DISPLAY property (IDisplayFeedback::DISPLAY)  
         newPolygonFeedback.Display = (IScreenDisplay)display;  
         // Start the Feedback at the current mouse location  
         newPolygonFeedback.Start(point);  
       }  
       else  
       {  
         // Otherwise use the current mouse location to add a vertex to the current feedback  
         newPolygonFeedback.AddPoint(point);  
       }  
     }  
     private void DrawGeometryOnMouseMove(IMxDocument doc, ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)  
     {  
       // Get the ScreenDisplay for the the ActiveView  
       IMxDocument pMXDoc = doc;  
       IDisplay pDisp = pMXDoc.ActiveView.ScreenDisplay;  
       // Check if the user is currently using the feedback  
       if (newPolygonFeedback != null)  
       {  
         // Get the current mouse location in map units  
         IPoint pPnt = pDisp.DisplayTransformation.ToMapPoint(arg.X, arg.Y);  
         // Move the Feedback to the current mouse location (IDisplayFeedback::MoveTo)  
         newPolygonFeedback.MoveTo(pPnt);  
       }  
     }  
     private void FinishGeometryDrawOnDblClick(IMxDocument doc)  
     {  
       // Check if the user is currently using the feedback  
       if (newPolygonFeedback != null)  
       {  
         // Stop the feedback and set it to Nothing  
         IGeometry geometry = newPolygonFeedback.Stop();  
         newPolygonFeedback = null;  
         //check for valid geometery  
         if (geometry != null)  
         {  
           IScreenDisplay screenDisplay = doc.ActiveView.ScreenDisplay;  
           // Constants  
           screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)esriScreenCache.esriNoScreenCache);  
           // Explicit Cast  
           IRgbColor rgbColor = new RgbColorClass();  
           rgbColor.Red = 255;  
           rgbColor.Transparency = 75;  
           IColor color = rgbColor; // Implicit Cast  
           ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();  
           simpleFillSymbol.Color = color;  
           //Draw geometry  
           ISymbol symbol = simpleFillSymbol as ISymbol; // Dynamic Cast  
           screenDisplay.SetSymbol(symbol);  
           screenDisplay.DrawPolygon(geometry);  
           screenDisplay.FinishDrawing();  
         }  
       }  
       ArcMap.Document.ActiveView.Refresh();  
     }  
     #endregion private helpers  

Recent Posts

Powered by Blogger.

Follow by Email

Total Pageviews