When conducting analyses with National Elevation Dataset DEMs, projecting the raster correctly is key, otherwise you could end up with slopes greater than 1,000,000% or slope/aspect/hillshade outputs that look like this:
Using the "Project Raster" tool, the first important piece is to output the raster to a projected coordinate system. NED DEMs come from The National Map with a geographic coordinate system, and the linear unit is undefined. If you do an analysis on a raster that requires the use of a z-factor, outputs can look molten or overdone and the resulting cell values can be extreme. Projecting to a projected coordinate system defines a linear unit, avoiding this problem. See this blog post from ESRI for more information.
The next important piece for projecting the DEM is to use a Bilinear interpolation for the "Resampling Technique". ArcMap defaults to a nearest neighbor resampling, but if you do this and subsequently do a slope analysis on this raster, you often see strange grid lines show up in your output (as in the photo above). Selecting BILINEAR instead of NEAREST should avoid the grid-like artifacts that stem from resampling patterns.
Wednesday, April 1, 2015
Friday, November 14, 2014
Convert Multi-band Raster Images Into Single Band Classified Rasters
During the process of classifying imagery in ENVI for use in ArcGIS, you might come across the problem of having your classified .tif image displayed only in RGB format with no attribute table in ArcMap. This format is not useful if you are trying to analyze the unique land cover classifications in your image, so in order to convert the image into a raster with an attribute table that enables you to use the classified renderer in ArcMap, use the following steps:
1. Using the identifier tool in ArcMap, find out which two (out of the three) bands in your image give you a unique signature for each land cover class when added together. For example, an area classified as cropland may have the following RGB values: R=255 G=255 B=0. If the red and green bands added together give unique values for each class, then those two bands will be used in the next step.
2. In ArcCatalog, expand the raster image with three bands in order to be able to load in the bands separately. In this step you will only load in the two bands that when summed together give you a unique number for each land class in your classified image.
3. Once those two bands have been loaded into ArcMap, use the raster calculator tool to sum the two bands. Your output will be a single raster with unique numbers for each land cover class. This raster should contain an attribute table and should allow you to render the image as classified.
4. (Optional) In order to display the unique classes with a different set of numbers, you can use the reclassify tool and change the land class numbers (the result of summing two bands together) to your desired new values.
Wednesday, March 5, 2014
Expand polygon to many features in ArcMap
Use the Explode button in Advanced Editing toolbar after selecting all features in Layer!
Thursday, May 30, 2013
Geotagging photos
If you don't have a camera with GPS for geotagging photos, you can match the time stamp from the photos to that of GPS waypoints. Record a tracklog on your GPS while taking photos. Once the photos and tracklogs have been uploaded, download the EasyGPS software and open the track in the software. Under the Tools menu, select Add Photos. Photos with matching timestamps will be added to the map in the correct location. Geotag is another free software, which is open source and has more flexibility (edit time stamps, export to Google Earth). For this, you will also need to download ExifTool in order to edit and save photo metadata.
Friday, May 10, 2013
Tuesday, March 19, 2013
WGS84 to Web Mercator Transforms
Handy:
private void ToGeographic(ref double x, ref double y)
{
if (Math.Abs(x) < 180 && Math.Abs(y) < 90)
return;
if ((Math.Abs(x) > 20037508.3427892) || (Math.Abs(y) > 20037508.3427892))
return;
double x = x;
double y = y;
double num3 = x / 6378137.0;
double num4 = num3 * 57.295779513082323;
double num5 = Math.Floor((double)((num4 + 180.0) / 360.0));
double num6 = num4 - (num5 * 360.0);
double num7 = 1.5707963267948966 - (2.0 * Math.Atan(Math.Exp((-1.0 * y) / 6378137.0)));
x= num6;
y= num7 * 57.295779513082323;
}
private void ToWebMercator(ref double lon, ref double lat)
{
if ((Math.Abs(lon) > 180 || Math.Abs(lat) > 90))
return;
double num = lon* 0.017453292519943295;
double x = 6378137.0 * num;
double a = lat* 0.017453292519943295;
lon= x;
lat= 3189068.5 * Math.Log((1.0 + Math.Sin(a)) / (1.0 - Math.Sin(a)));
}
private void ToGeographic(ref double x, ref double y)
{
if (Math.Abs(x) < 180 && Math.Abs(y) < 90)
return;
if ((Math.Abs(x) > 20037508.3427892) || (Math.Abs(y) > 20037508.3427892))
return;
double x = x;
double y = y;
double num3 = x / 6378137.0;
double num4 = num3 * 57.295779513082323;
double num5 = Math.Floor((double)((num4 + 180.0) / 360.0));
double num6 = num4 - (num5 * 360.0);
double num7 = 1.5707963267948966 - (2.0 * Math.Atan(Math.Exp((-1.0 * y) / 6378137.0)));
x= num6;
y= num7 * 57.295779513082323;
}
private void ToWebMercator(ref double lon, ref double lat)
{
if ((Math.Abs(lon) > 180 || Math.Abs(lat) > 90))
return;
double num = lon* 0.017453292519943295;
double x = 6378137.0 * num;
double a = lat* 0.017453292519943295;
lon= x;
lat= 3189068.5 * Math.Log((1.0 + Math.Sin(a)) / (1.0 - Math.Sin(a)));
}
Tuesday, March 12, 2013
Geocoding
batchgeo.com provides easy batch geocoding.
- Copy and paste entries from an Excel document containing addresses (city and state is good enough).
- Click "Validate & Set Options" and select the desired settings.
- Click "Make Map."
- Once the map has been made, complete the fields and proceed.
- When the finalized map is displayed, scroll to the bottom and click "Download as KML."
- In ArcMap, import the KML as a point file.
- Add X,Y coordinates using XTools.
- Export to Excel using XTools.
Monday, March 11, 2013
Picking in OpenGL
A great reference to object picking and selection in OpenGL:
http://web.engr.oregonstate.edu/~mjb/cs553/Handouts/Picking/picking.pdf
http://web.engr.oregonstate.edu/~mjb/cs553/Handouts/Picking/picking.pdf
Friday, March 8, 2013
Setting up 3D Vision Pro glasses
After installing drivers for 3D Vision Pro glasses, right click on the desktop and select NVIDIA Control Panel.
Under 3D Settings, select Manage 3D settings. Make sure that "Stereo - Display mode" is set to "Generic active stereo (with NVIDIA 3D Vision)".
Under Stereoscopic 3D, select Manage 3D Vision Pro and add the glasses.
Right click on the desktop again and select Screen resolution. Make sure that the 3D Vision ready display is set to 120 Hz.
In the NVIDIA Control Panel, launch the test application to ensure the glasses have been successfully paired.
Under 3D Settings, select Manage 3D settings. Make sure that "Stereo - Display mode" is set to "Generic active stereo (with NVIDIA 3D Vision)".
Under Stereoscopic 3D, select Manage 3D Vision Pro and add the glasses.
Right click on the desktop again and select Screen resolution. Make sure that the 3D Vision ready display is set to 120 Hz.
In the NVIDIA Control Panel, launch the test application to ensure the glasses have been successfully paired.
Wednesday, February 27, 2013
Landsat 8 bands
Landsat 8 data bands will differ from those of Landsat 5 or Landsat 7. Here are the new band designations (resolution of 30 meters unless otherwise noted):
For color infrared, use combination 5,4,3.
For false color, use combinations 6,5,4; 7,6,4; or 7,5,3.
http://landsat.usgs.gov/L8_band_combos.php
- Band 1 - Coastal aerosol (ultra-blue)
- Band 2 - Blue
- Band 3 - Green
- Band 4 - Red
- Band 5 - Near Infrared (NIR)
- Band 6 - SWIR 1
- Band 7 - SWIR 2
- Band 8 - Panchromatic (15 meter resolution)
- Band 9 - Cirrus
- Band 10 - Thermal Infrared (TIRS) 1 (100 meter resolution)
- Band 11 - Thermal Infrared (TIRS) 2 (100 meter resolution)
For color infrared, use combination 5,4,3.
For false color, use combinations 6,5,4; 7,6,4; or 7,5,3.
http://landsat.usgs.gov/L8_band_combos.php
Tuesday, February 5, 2013
Safaricom in Kenya
To activate data you need to download apn settings. Call ussd *544# and in options select 98 for more options. Then select 10 for internet settings. Your phone will download the apn settings. Send an SMS to 450 with the text "Balance" to get prepayed data balance.
Friday, December 28, 2012
Bayes Ball!
A good illustration of Bayesian conditional networks:
http://www.cs.ubc.ca/~murphyk/Bayes/Figures/bayes_ball_no_det.gif
http://www.cs.ubc.ca/~murphyk/Bayes/Figures/bayes_ball_no_det.gif
Monday, December 3, 2012
Using ArcGIS to document work products
When using ArcGIS, it's not always possible to name a given piece of data in a way that retains all the information on how it was generated--what the inputs were, how raster values were calculated, etc. Ideally, a log would be kept to document this sort of information.
Another option is embedded right in Arc: the Results pane. If you save the .mxd after every process you run, all the information you need is retained there.
(It's probably still good to keep a log for important data, especially if files might be moved or renamed.)
Another option is embedded right in Arc: the Results pane. If you save the .mxd after every process you run, all the information you need is retained there.
(It's probably still good to keep a log for important data, especially if files might be moved or renamed.)
Tuesday, November 27, 2012
Autosave on Notepad++
Notepad++ is a great open-source programmers' text editor; behavior of its suit of plugins is not uniformly supported for x64 platforms. Auto-save is a particularly useful one if you have a computer that locks up an crashes when running memory-intensive processes. A simple workaround for getting it to work on x64 platforms is posted here.
Wednesday, November 21, 2012
R wrapper function to aid reading in .xlsx worksheets and writing to original position in the workbook
read.csv, part of the base package in R, provides native support to read in .csv and .txt documents, with the column in a dataframe assigned with high accuracy to the "true" class. The XLConnect package allows the user to read in sheets from .xls and .xlsx workbooks, but the column classes are typically all assigned as factor, or must be manually re-assigned by the user. The below is a wrapper function to allow the user to quickly read in a .xlsx file to R, while leveraging the strengths of read.csv.
xlsx.out allows the user to take data (the intention is data read in from xlsx.in) and overwrite a worksheet in a workbook with that data.
## this is a wrapper function to aid reading in xlsx sheets with a better approximation of the correct column class than is natively provided by XLConnect. Allows the user to do this from a workbook without manual export to csv.
####with XLConnect
library(XLConnect)
file.names<-list.files(path='./', full.names=TRUE)
file.names
#load a file by the number in file.names
wb<-loadWorkbook(file.names[filenumber])
data.frame(getSheets(yoursheetnumber))
xlsx.in<-function(file, sheet = 1){
temp<-loadWorkbook(file, create=FALSE)
temp.test <-readWorksheet(temp, sheet)
write.csv(temp.test, "temp.csv")
out<-read.csv("temp.csv")
file.remove("temp.csv")
return(out)
}
#make sure your file is versioned first- this will overwrite the original
xlsx.out<-function(file, sheet = 1, datas){
temp<-loadWorkbook(file, create=FALSE)
clearSheet(temp, sheet)
datas<data.frame(datas)
writeWorksheet(temp,datas,sheet)
saveWorkbook(temp)
}
xlsx.out allows the user to take data (the intention is data read in from xlsx.in) and overwrite a worksheet in a workbook with that data.
## this is a wrapper function to aid reading in xlsx sheets with a better approximation of the correct column class than is natively provided by XLConnect. Allows the user to do this from a workbook without manual export to csv.
####with XLConnect
library(XLConnect)
file.names<-list.files(path='./', full.names=TRUE)
file.names
#load a file by the number in file.names
wb<-loadWorkbook(file.names[filenumber])
data.frame(getSheets(yoursheetnumber))
xlsx.in<-function(file, sheet = 1){
temp<-loadWorkbook(file, create=FALSE)
temp.test <-readWorksheet(temp, sheet)
write.csv(temp.test, "temp.csv")
out<-read.csv("temp.csv")
file.remove("temp.csv")
return(out)
}
#make sure your file is versioned first- this will overwrite the original
xlsx.out<-function(file, sheet = 1, datas){
temp<-loadWorkbook(file, create=FALSE)
clearSheet(temp, sheet)
datas<data.frame(datas)
writeWorksheet(temp,datas,sheet)
saveWorkbook(temp)
}
Tuesday, November 6, 2012
Data loss when exporting from ArcMap to Excel
When exporting records from an attribute table in ArcMap to Excel, be conscious of field types. For example, if a Double field is longer than 6 digits, it may get rounded to 6 significant figures in Excel. Check the output Excel file to ensure that your data has been fully retained, and if necessary transfer the data into a new text attribute.
Wednesday, October 10, 2012
High Resolution Imagery for the Brazilian Amazon
As part of its DETER program to detect illegal deforestation, INPE (National Institute for Space Research) of Brazil publicly provides imagery from the CBERS satellite program. You must first register before downloading imagery at this link. Then select imagery:
Satellite: CBERS 2B or CBERS 2
Instrument: CCD for multispectral 20-m resolution imagery, HRC for 2.7 m panchromatic band (CBERS 2B only)
You may select scenes with the (clunky) navigation pane, or based on coordinates, a city name, or path/row (recommended). To determine path/row, click on "Files and Documents" to the right (Item 5) and download "CBERS Reference Grid - WRS (Shape File)" (also stored in S:\Resources\CBERS_shp). Set the coordinate system to WGS 1984.
HRC imagery can be used to sharpen CCD. There are 25 HRC scenes per CCD: subpaths A-E from west to east, and subrows 1-5 from north to south (though a CCD scene's corresponding 25 HRC scenes don't occupy quite the same footprint). Note that scenes may require georeferencing.
Satellite: CBERS 2B or CBERS 2
Instrument: CCD for multispectral 20-m resolution imagery, HRC for 2.7 m panchromatic band (CBERS 2B only)
You may select scenes with the (clunky) navigation pane, or based on coordinates, a city name, or path/row (recommended). To determine path/row, click on "Files and Documents" to the right (Item 5) and download "CBERS Reference Grid - WRS (Shape File)" (also stored in S:\Resources\CBERS_shp). Set the coordinate system to WGS 1984.
HRC imagery can be used to sharpen CCD. There are 25 HRC scenes per CCD: subpaths A-E from west to east, and subrows 1-5 from north to south (though a CCD scene's corresponding 25 HRC scenes don't occupy quite the same footprint). Note that scenes may require georeferencing.
Friday, June 1, 2012
FBRI FPS Grow Model Accelerator
We have developed a parallel implementation of the Forest Biometrics Research Institute's growth model in the Forest Projection and Planning System. It reduces the time to grow stand records by a factor approximately equal to the number of CPU cores.
Please contact ecoPartners if you are interested in acquiring a copy of the software or if you are interested in supporting further parallel implementation of FPS routines.
Please contact ecoPartners if you are interested in acquiring a copy of the software or if you are interested in supporting further parallel implementation of FPS routines.
Monday, May 28, 2012
Connect to ESRI Shapefile DBF
You need to use OLE DB Provider for Visual FoxPro:
http://www.microsoft.com/en-us/download/details.aspx?id=14839
"Provider=VFPOLEDB;Data Source=C:\Temp;Exclusive=Yes;Collating Sequence=machine"
You must restart your computer after installing the provider.
http://www.microsoft.com/en-us/download/details.aspx?id=14839
"Provider=VFPOLEDB;Data Source=C:\Temp;Exclusive=Yes;Collating Sequence=machine"
You must restart your computer after installing the provider.
Friday, April 6, 2012
Extracting a subset of records in ArcMap 10
If you are looking to subsample your data by extracting a set number of records (i.e., every sixth record), use the script below in the field calculator of ArcMap 10.
Pre-Logic Script Code:
P=[ID]
i=Int(p/6)-Int((p-1)/6)
[name of field]=
i
The example above will extract every sixth record.
Subscribe to:
Posts (Atom)
