Tuesday, December 15, 2015

Conference: FOSS4G North America (FOSS4GNA) 2016, Raleigh, North Carolina

Be The First To Comment
Dear Everyone,
On behalf of the Organizing Team, we would like to invite you to submit talk & workshop proposals for FOSS4G North America 2016. The conference will run May 2-5, 2016 at the Raleigh Convention Center in Raleigh, North Carolina, U.S.A.. 
Like last year, we will be offering a free full access pass to speakers who have their talk or workshop accepted. The 2016 conference will be noticeably bigger than 2015. The list of topics include a number of mature areas as well as emerging ones. Please see the call for proposals for details and to submit a proposal. 
Also, public community voting on submissions has been enabled. Cast your vote for the presentations and workshops you would like to see! 
We wish you a safe and happy holiday season! 
The FOSS4G NA 2016 Team

Wednesday, December 9, 2015

Leaflet WMS layer custom projection on fly

Be The First To Comment
For most of the WMS mapping applications the Google Web Mercator (GWM) projection is sufficient. The GWM is default standard for web mapping and widley accepted by Bing, Google, OSM, OpenLayers(default), and Leaflets(default). However some mapping application required custom projection other than Google Mercator projection to display data. Then, how to project/re-project the data other than wms's default projection, GWM.

The following snippet shows the WMS layer custom projection in LEAFLET for  Albers equal area and UTM zone 13.

Step 1.

First of all include -
         leaflet.js
         proj4.js
         proj4leaflet.js  in following order.    

     <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />  
     <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>  
     <script src="//cdnjs.cloudflare.com/ajax/libs/proj4js/2.0.0/proj4.js"></script>  
     <script src="http://mapserv.utah.gov/cdn/examples/proj4leaflet.js"></script>  

Step 2: Create new Proj4Leaflet CRS

Find your desired custom projection type in http://spatialreference.org/ and punch the the projection variable in the following code snippet.









    

Friday, November 6, 2015

Passing R variables dynamically to JavaScript for data visualization

Be The First To Comment
For a random project, I was interested to see if there a way to pass data between R and JavaScript. My purpose was to populate a Highcharts graph dynamically using preprocessed data from R. Of course, my first look was rCharts, an R package to create and publish interactive JavaScript visualizations, which also support the Highcharts for building interactive graphs and plots. The rCharts is a great package and widely popular among R users to create interactive charts without knowing the underlying JavaScript.

My requirement was not only the interactive chart but also dynamic that can create chart on near real time as shown in Highcharts demo. It seems to me that rCharts neither provide a straightforward way to add-point on series nor a way to customize the JavaScript to create such dynamic charts. As far as I know, it has limitations (or out of context of rCharts philosophy) for doing sophisticated jobs that requires JavaScript customization. At this moment it only supports the 24 functions from Highcharts API through R interface.

Wednesday, October 14, 2015

Read ESRI File Gdodatabase (FileGDB) using GDAL & C#

Be The First To Comment
If you are creating a new project- set up GDAL & C# environment as described here

Code snippet to read ESRI File Geo-database (FileGDB) using GDAL and C#. By default it uses GDAL's 'OpenFileGDB' (read only) driver with out any external dependencies. If you are interested in editing GDB feature class you should use 'FileGDB' (read-write) driver, which had dependency on ESRI's FGDB API SDK. The UCLA's internal testing showed that ESRI's FileGDB driver drags the performance than OpenFileGDB for read-only operation. So choose the driver according to your needs.

However, both GDAL drivers and ESRI's API do not support the raster dataset inside the GDB till date.

 public static void ReadEsriGdb(string gdbPath, string featureLayerName)  
     {  
       //Register the vector drivers  
       Ogr.RegisterAll();  
   
       //Reading the vector data  
       DataSource dataSource = Ogr.Open(gdbPath, 0);  
       Layer layer = dataSource.GetLayerByName(featureLayerName);  
          
     }  
   
     //call  
      ReadEsriGdb("gdbPath.gdb", "counties");  

Thursday, October 8, 2015

Clip a raster from feature shape file using C# and ArcObject's geoprocessor

Be The First To Comment
Code snippet in clipping a raster from feature shape file using C# and ArcObject's geoprocessor -

 public static void ClipRaster(string inRaster, string inClipFeature, string outTempRaster)  
     {  
       Clip clipTool = new Clip();  
   
       //set clip parameters  
       clipTool.in_raster = inRaster;  
       clipTool.out_raster = outTempRaster;  
   
       //clip extent  
       clipTool.in_template_dataset = inClipFeature;  
   
       Geoprocessor gp = new Geoprocessor();  
       gp.OverwriteOutput = true;  
       gp.AddOutputsToMap = false;  
         
       try  
       {  
         IGeoProcessorResult result = (IGeoProcessorResult)gp.ExecuteAsync(clipTool);  
         while(result.Status != esriJobStatus.esriJobSucceeded)  
         {  
           //Console.WriteLine(result.Status.ToString());  
           System.Threading.Thread.Sleep(100);  
         }  
       }  
       catch (Exception ex)  
       {  
         object level = 0;  
         Console.WriteLine(gp.GetMessages(ref level));  
         Console.WriteLine(" Failed to clip raster using ESRI clip tool " + ex.Message);  
       }  
   
     }  

Enable ESRI ArcGIS extension licence from C#

Be The First To Comment
Code snippet on enabling ESRI ArcGIS extension licence for spatial analysis using C#

   
       ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);  
       ESRI.ArcGIS.RuntimeManager.BindLicense(ESRI.ArcGIS.ProductCode.Desktop);  
   
       UID pUid = new UIDClass();  
       pUid.Value = "esriSpatialAnalystUI.SAExtension";  
   
       // Add Spatial Analyst extension to the license manager.  
       object v = null;  
       IExtensionManagerAdmin extensionManagerAdmin = new ExtensionManagerClass();  
       extensionManagerAdmin.AddExtension(pUid, ref v);  
   
       // Enable the license.  
       IExtensionManager extensionManager = (IExtensionManager)extensionManagerAdmin;  
       IExtension extension = extensionManager.FindExtension(pUid);  
       IExtensionConfig extensionConfig = (IExtensionConfig)extension;  
   
       if (extensionConfig.State != esriExtensionState.esriESUnavailable)  
       {  
         extensionConfig.State = esriExtensionState.esriESEnabled;  
       }  
       else  
       {  
         Console.WriteLine("No Spatial Analyst License available");  
       }  
   
   

Thursday, September 24, 2015

Calculate zonal-statistics using ESRI ArcObjects and C#

Be The First To Comment
Import the following references in the project.

using ESRI.ArcGIS.Geoprocessor;
using ESRI.ArcGIS.SpatialAnalystTools;
using ESRI.ArcGIS.esriSystem;

This solution is only works for single band raster. For multi-band raster zonal statistics I will make a separate post soon.

 public static void ComputeZonalStatisticsFromEsri(string feature, string zoneField, string valueRaster, string outputTable)  
     {  
   
       ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);  
       ESRI.ArcGIS.RuntimeManager.BindLicense(ESRI.ArcGIS.ProductCode.Desktop);  
   
       UID pUid = new UIDClass();  
       pUid.Value = "esriSpatialAnalystUI.SAExtension";  
   
       // Add Spatial Analyst extension to the license manager.  
       object v = null;  
       IExtensionManagerAdmin extensionManagerAdmin = new ExtensionManagerClass();  
       extensionManagerAdmin.AddExtension(pUid, ref v);  
   
       // Enable the license.  
       IExtensionManager extensionManager = (IExtensionManager)extensionManagerAdmin;  
       IExtension extension = extensionManager.FindExtension(pUid);  
       IExtensionConfig extensionConfig = (IExtensionConfig)extension;   
   

Tuesday, September 22, 2015

Read raster block by block or row by row using GDAL and C#

Be The First To Comment
If you are creating a new project- set up GDAL & C# environment as described here

Code Snippet: Read raster block by block using GDAL and C#
 private static void ReadRasterBlocks(ref Dataset valueRaster)  
 {  
   Band bandValueRaster = valueRaster.GetRasterBand(1);  
     
   int rasterRows = valueRaster.RasterYSize;  
   int rasterCols = valueRaster.RasterXSize;  
     
   const int blockSize = 1024;  
   
   for(int row=0; row<rasterRows; row += blockSize)  
   {  
      int rowProcess;  
      if(row + blockSize < rasterRows)  
      {  
        rowProcess = blockSize;  
      }  
      else  
      {  
        rowProcess = rasterRows - row;  
      }  
   

Thursday, September 17, 2015

Tutorial: Getting started with ArcGIS Application Development using ArcObjects and Vb.NET

Be The First To Comment
This will be a series of videos on Programming with ArcObjects by Hussein Nasser where he features a fictional project called Bestaurants and gradually added functions to the project from scratch using ArcObjects and Vb.NET programming on top of ArcGIS. An excellent tutorial for beginners to learn how to use ArcObjects to build an ArcGIS application.

Wednesday, September 16, 2015

Read a raster file into an Array using C# and GDAL

Be The First To Comment
If you are creating a new project- set up GDAL & C# environment as described here

Code snippet: Read raster into an Array using GDAL and C#

 //Register all drivers  
 Gdal.AllRegister();  
   
 //Read dataset  
 Dataset rasterDataset = Gdal.Open("rasterName.tif", Access.GA_ReadOnly);  
 if (rasterDataset == null)  
 {  
      Console.WriteLine("Unable to read input raster..");  
      System.Environment.Exit(-1);  
 }  
   
 //raster bands  
 int bandCount = rasterDataset.RasterCount;  
 if (bandCount > 1)  
 {  
      Console.WriteLine("Input error, please provide single band raster image only..");  
      System.Environment.Exit(-1);  
 }  
   

Feature to Raster Conversion Using C# and ArcGIS

Be The First To Comment
Import ArcGIS.ConversionTools and ArcGIS.Geoprocessor then pass the file paths as param into following function you will get the resulting raster out of shapefile.

 using ESRI.ArcGIS.ConversionTools;  
 using ESRI.ArcGIS.Geoprocessor;  
   
 public static void Rasterize(string inputFeature, string outRaster, string fieldName, int cellSize)  
     {      
         //Runtime manager to find the ESRI product installed in the system  
         ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);  
   
         Geoprocessor geoprocessor = new Geoprocessor();  
         geoprocessor.OverwriteOutput = true;  
   
         FeatureToRaster featureToRaster = new FeatureToRaster();  
         featureToRaster.cell_size = cellSize;  
         featureToRaster.in_features = inputFeature;  
         featureToRaster.out_raster = outRaster;  
         featureToRaster.field = fieldName;  
   
         geoprocessor.Execute(featureToRaster, null);  
     }  

Tuesday, September 15, 2015

Clip a raster with shapefile using C# and Gdal

Be The First To Comment



Over the week, I stumbled on problem clipping raster with feature using C# and Gdal and come up with following solution, which clips the features and fills no data value for missing raster  values inside the extent. If you are creating a new project- set up GDAL & C# environment as described here

Saturday, September 12, 2015

FIXED: Shape file import error in Postgis AddGeometry column doesn't exist

2 Comments
Last week I have installed PostgreSql/PostGis and PgAdmin. Once I have tired to import shape file from PgAdmin using "PostGIS Shape file and DBF Loader 2.1" as below.


But it throws an error complaining "File import error in PostGis AddGeometry column doesn't exist" as shown in figure below 

Then, I found out that the spatial extension is not enabled in my database. The following image shows the steps to enabled the spatial extension in the database. 

Open new extension and name it postgis.

 



Then import the shape file again... Voila it works

Friday, September 11, 2015

Fetching environmental data from Meso West API version 2

Be The First To Comment
In few months the MesoWest group will depreciated their MesoWest data API version 1 and fully moving over version 2. The Meso West data API 2 have been in the production for most of this year. The API v2 has significantly faster and more useful than version 1 and well as increased response time and availability including accumulated precipitation, simple station statistics, and climatological data requests.

Here is the code snippet to extract data variables using jQuery in JSON format. 
 $.getJSON('http://api.mesowest.net/v2/stations/nearesttime?callback=?',  
      {  
           state:'ca',  
           county:'Los Angeles,San Diego,',  
           latestobs:1,  
           status:'active',  
           token:'API_TOKEN_PROVIDED_BY_MESOWEST_GROUP',  
           within:15, //Observations with in past 15 min  
           vars:'air_temp,relative_humidity,wind_speed,wind_direction',  
           obtimezone:'local'  
      },  
      function (data)  
      {                       
        for(var i=0;i<data.STATION.length;i++)  
           {       
                //check if all stations contain all the observation we need  
                if((data.STATION[i].OBSERVATIONS.hasOwnProperty("air_temp_value_1"))&& (data.STATION[i].OBSERVATIONS.hasOwnProperty("wind_speed_value_1"))&&  
                     (data.STATION[i].OBSERVATIONS.hasOwnProperty("wind_direction_value_1"))&&(data.STATION[i].OBSERVATIONS.hasOwnProperty("relative_humidity_value_1")))  
                {  
                     var stn = data.STATION[i];  
                     var dat = stn.OBSERVATIONS;  
                     var stnInfo =stn.NAME.toUpperCase();  
                     var elev=parseInt(stn.ELEVATION);                                                         
                     //displaying air temperature from all stations   
                     console.log(Math.round(dat.air_temp_value_1.value));                          
                }  
           }  
  })  
 .done(function()  
 {  
 })  
 .fail(function()  
 {  
      alert("Could not access the MesoWest Data!");  
 });  

Vector to Raster Conversion using GDAL & C#

Be The First To Comment
I have been working on a .Net based project that requires feature to raster conversion without using ESRI ArcObjects. The GDAL seem's an obvious solution to us and wrote a small snippet for rasterize layer using Gdal and C#. Hope it will help someone someday...

Step 1: Setup the environmental variables for GDAL 
OR 
(Copied here for future reference - )

The Geospatial Data Abstraction Library (GDAL) is great if you want to process raster data, especially regarding format conversion. I want to use GDAL for a biodiversity modelling project, so I had a look at the C#-bindings of GDAL. The described steps work both with VS 2010 as well as VS 2012, what you need to do is:
  • Download the latest version of the precompiled GDAL binaries from here. Choose the ones that suit your system (32bit or 64bit). Extract the contents from the zip file to a location on your hard disk e.g. C:\Program Files\GDAL (I ran into a number of AccessViolationExceptions when I used the binaries from FWTools 2.4.7).
  • Include both the path to C:\Program Files\GDAL\bin\gdal\csharp as well as C:\Program Files\GDAL\bin in your PATH system variable.
Setting of the PATH variable
Creating a Console Application (VS 2010)
  • Add four of.the dll-files that can can be found at C:\Program Files\GDAL\bin\gdal\csharp (or wherever your installation path of the current binaries is) to your project references: gdal_csharp.dllgdalconst_csharp.dllogr_csharp.dll and osr_csharp.
Adding necessary references (VS 2010)
  • Build the solution. If you are on a 64bit system and you are using the 64bit GDAL binaries you have to make sure you actually build for 64bit (you will get errors otherwise when you try to run the program).
Setting of the platform target for 64bit (VS 2012)
  • Now you can run the program with some data. Include a reference to one of the raster files in the Command line arguments field of your Debug options (in the properties of your GDALInfo project; don't forget to put the path inside double quotes of it includes blanks).
  • Run the program (Ctrl-F5). It should show you something similar to the following:
Output of GDALInfo
That's it. Now you can use the other example C#-programs to open, copy, manipulate raster data in variety of file formats. For some of the other example files it is necessary to add some additional references (e.g. System.Drawing).
(End copy)

Step 2: Open visual studio and create C# console project

Import references 
  • gdal_csharp
  • gdalconst_csharp
  • ogr_csharp
  • osr_csharp
Import Namespaces

using OSGeo.GDAL;
using OSGeo.OGR;
using OSGeo.OSR;

Thursday, August 20, 2015

Capitalize each word after forward slash in Java Script : Code snippet

Be The First To Comment
 function getFormattedText() {  
   var formattedString= capitalizedTextAfterBackslash("Red spruce / balsam fir/tamarack");    
   alert(formattedString);  
 };  
 function capitalizedTextAfterBackslash(str){  
    var temp= str.split("\/");       
    for(var i=0; i<temp.length; i++) {  
     temp[i] = temp[i].trim();  
     temp[i] = temp[i].substr(0,1).toUpperCase() + temp[i].substr(1,temp[i].length-1);  
    }  
    return temp.join(' / ');   
 }  

Thursday, July 2, 2015

Building ArcMap’s Add-in using command line

Be The First To Comment
Couple of days I have been spending on creating a build automation for ArcMap’s Add-in using Jenkins . In order to accomplish that I need to able to build my visual studio add-in solution using MSBuild.exe.

When I try to build the solution using via command line –
msbuild.exe MyArcMapAddin.sln /t:Clean,Build



The console throws the following error- 
 
(PrePackageArcGISAddIn target) -> 
  C:\Program Files (x86)\MSBuild\ESRI\ESRI.ArcGIS.AddIns.targets(37,5): error MSB4062: The "ValidateAddInXMLTask" task could not be loaded from the assembly ESRI.ArcGIS.AddIns.SDK, Version=10.0.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86. Could not load file or assembly 'Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [SOLVED]

Friday, May 29, 2015

[SOLVED] Vagrant & Virtualbox - The guest machine entered an invalid state while waiting for it to boot....

2 Comments
Last couple of days I was running a Virtualbox issue "The guest machine entered an invalid state while waiting for it to boot. Valid states are 'starting, running'. The machine is in the 'poweroff' state. Please verify everything is configured properly and try again."

I had not clue how to fixed that and I have tried several versions and several installation. Then, then installation of Virtualbox 4.3.12 is working fine so far. If you are running into similar issue get  rid of all new Virtualbox versions and try with version 4.3.12, VirtualBox-4.3.12-93733-Win.exe, that might helps you solve the problem.

This version can be downloaded from:
                                              http://dlc-cdn.sun.com/virtualbox/4.3.12/

Similarly, if you are using vagrant I recommend to use Vagrant 1.7.2. Please note that not all versions of vagrant and virtual box are compatible with each other.

Updated environment for Vagrant and Virtual box in Windows 7 -
http://www.gisremotesensing.com/2016/09/solution-vagrant-stopped-working-open.html

Update
Working version as of 1/27/2017:
OS: Windows 7 Enterprise
Vagrant 1.9.1
Oracle VM Virtualbox - Version 5.1.14 r112924 (Qt5.6.2)

Friday, May 15, 2015

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

Be The First To Comment
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

Tuesday, May 12, 2015

Easy 5 steps to get thumbnails out of Pdf using Python

Be The First To Comment
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.

Wednesday, April 22, 2015

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

Be The First To Comment
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

Monday, April 20, 2015

How to remove twitter headers and footer from twitter widget?

4 Comments
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

Wednesday, April 15, 2015

Conference: FOSS4G Seoul 2015, FOSS4G First Time in Asia

Be The First To Comment
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.  

Thursday, April 9, 2015

How to update R to a new version?

Be The First To Comment
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)


Tuesday, April 7, 2015

Landsat Band combinations for highlighting Earth features

Be The First To Comment
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

Tuesday, March 10, 2015

ArcMap tool for Panning and Zooming while editing using C#

Be The First To Comment
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  

Draw features in ArcMap using ArcGIS Addin tool (Arcobject's IRubberband Interface)

Be The First To Comment
 protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)  
 {  
      //create geometery  
      if (ArcMap.Document != null)  
      {  
           IScreenDisplay screenDisplay = ArcMap.Document.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  
           IRubberBand rubberBand = new RubberPolygonClass();  
           IGeometry geometry = rubberBand.TrackNew(screenDisplay, symbol);  
           //check for valid geometery  
           if (geometry != null)  
           {  
                screenDisplay.SetSymbol(symbol);  
                screenDisplay.DrawPolygon(geometry);  
                screenDisplay.FinishDrawing();  
                //Open addattributes wpf form  
                AddAtrributesView addAtrributesView = new AddAtrributesView(geometry);  
                addAtrributesView.ShowInTaskbar = false;  
                addAtrributesView.ShowDialog();  
                ArcMap.Document.ActivatedView.Refresh();  
           }  
      }       
 }  

Wednesday, February 25, 2015

Conference : Unmanned Aircraft Systems Technical Demonstration and Symposium 2015

Be The First To Comment
The second annual technical UAS symposium sponsored by the American Society for Photogrammetry and Remote Sensing (ASPRS) is scheduled for September 29-30, 2015 in Reno, Nevada. Expanding on the highly successful format and events of last year’s symposium this year’s event will include test flights, UAS data processing, and workshops.

Technical Demonstration and Symposium for Unmanned Aircraft Systems hosted by the American Society for Photogrammetry and Remote Sensing

Call for Speakers and Call for Workshops has also been announced! Details: http://uasreno.org/ 

Purpose: To assemble UAS developers and researchers, along with geospatial service providers and users of geospatial map data, to share information, showcase new technologies and demonstrate UAS systems in action (in flight). 
Mission: To advance knowledge and improve the understanding of UAS technologies and their safe and efficient introduction into our national airspace, government programs and business.

30 cm imagery from Digital Globe

Be The First To Comment
As the global leader in satellite imagery, DigitalGlobe is proud to once again push the boundaries of innovation by being the first company to delivery 30 cm resolution imagery.

This 5x improvement in resolution represents the definition of very-high resolution imagery.
30 cm imagery delivers clearer, richer images that empower better decision making through improved situational awareness. - See more at: Digital Globe 30 cm resolution imagery

Monday, February 2, 2015

Getting into ESRI ArcGIS Add-in Development in .Net and ArcObjects

1 Comment
Recently, I landed into a project for ArcGIS/ArcMap Desktop add-in development using ArcObjects in C#. I am a newbie in both ArcObjects and add-in development. Googling through I got tons of snippets on the ArcMap add-in development, but I was not familiar with tailoring them to make a working application.

Then, I started to look after Youtube and Amazon to see if any good basic books or tutorials that gives me basic concepts on tailoring the  ArcObjects/.Net snippets. On youtube, I came across a video tutorials series on “.Net programming with ArcOjects”, an excellent tutorial on ArcObjects and .Net development with sample Gis data and codes to download  by Hussein Nasser. I watched all 15 episodes on add-in development using VB.Net.

From the Amazon, I bought a book entitled, “Beginning ArcGIS for Desktop Development using .NET ” by Pouria Amirian, with a blind believe on the reviewers, but it turned out the 
The book is wonderful! The author does an excellent job of explaining basic .NET concepts and tying them into ArcObjects.This book was long overdue and it seems like the author really took his time to ensure the content was organized in a logical way and concepts are thoroughly explained.

I would recommend this book and Youtube video to anyone who is interested in learning ArcObjects in .NET. The both author includes .NET code samples as well as the solutions in C#/VB. Lots of useful stuff in there and I think when you finished you will have a good starting point to ArcGIS Desktop development.
 

© 2011 GIS and Remote Sensing Tools, Tips and more .. ToS | Privacy Policy | Sitemap

About Me