Welcome to 2012. I'm about 26 days late.
Anyway, I thought I'd use my blog (that I barely post to anymore because of twitter) to mark some of my goals for 2012. 2011 started slow, but this fall I delved deeper into my Python work and web mapping work with Google Maps.
1. Become more proficient with Python, especially the other modules, iters, calendar, etc.
2. Learn GeoDjango, learn it.
3. Learn even more about the Google Maps API and Fusion tables.
4. Utilize Dropbox more for non-sensitive GIS data.
It was hard to not automatically #hashtag every other word, weird. Anyway, good luck to everyone in 2012 and I hope your GIS wishes come true.
Thursday, January 26, 2012
Tuesday, November 29, 2011
Shapefile to KML from OGR GDAL
Over the last few years there have been quite a few tools developed, including from Esri, that generate .kml files from your Shapefiles. They can be tough to use at times or easy but none are as satisfying as running from OGR GDAL at the command line. Why? Who cares, its just cool to be able to run things from the command line. Go here to follow Google's how-to:http://code.google.com/apis/kml/articles/vector.html
If you download and install GDAL OGRhttp://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
Go here at Google Code http://code.google.com/apis/kml/articles/vector.html and follow the easy steps. And then open up your new .kml in Google Earth.
Even later on you can customize more with libkml. http://code.google.com/p/libkml/
Tuesday, October 25, 2011
My first Stata command, summing two fields into a new field, why its easier than ArcGIS
So I barely use any software that's not GIS-related. Anyway, without making a list of the silly things that take forever in ArcGIS - at modelbuilder and even at python - (aka, deleting multiple fields for large datasets, took 8 hours last night!!!!), I've known I need to learn Stata to better manage my output files, so I requested Stata 12 and figured I'd share a little of my learning experience for my own reference but also in case anyone else is just starting out.
I'd like to start generating some calculated variables outside of ArcGIS. Some of my variables such as percent (PCT) of a population or densities could more efficiently be calculated outside of ArcGIS.
Here's how I've been adding a new field and calculating in ArcGIS:
I created model that has input parameters and allows the user to input everything they need to add a new field and calculate. It saves me just a little time by not having to add both models or type out all of these lengthy commands.
Here's the Python code:
Granted, there's Parameters instead of real values, but you get the idea, each of those parameters need to be filled out and all this code needs to run.
Here's the Stata code:
That was easy!
Granted, this was only a numeric calculation, I still feel super confident about my Python/VBScript string 'skillz'[:5] + 's', but just saying, Stata is super fast and at the end of the day, those last numeric calc's might be best served in Stata.
I'd like to start generating some calculated variables outside of ArcGIS. Some of my variables such as percent (PCT) of a population or densities could more efficiently be calculated outside of ArcGIS.
Here's how I've been adding a new field and calculating in ArcGIS:
I created model that has input parameters and allows the user to input everything they need to add a new field and calculate. It saves me just a little time by not having to add both models or type out all of these lengthy commands.
Here's the Python code:
# Import arcpy module
import arcpy
# Script arguments
Input_Table = arcpy.GetParameterAsText(0)
New_Field_Name = arcpy.GetParameterAsText(1)
Field_Type = arcpy.GetParameterAsText(2)
if Field_Type == '#' or not Field_Type:
Field_Type = "LONG" # provide a default value if unspecified
Calculate_Field_Name = arcpy.GetParameterAsText(3)
Calc_Expression = arcpy.GetParameterAsText(4)
Field_Expression_Type = arcpy.GetParameterAsText(5)
if Field_Expression_Type == '#' or not Field_Expression_Type:
Field_Expression_Type = "PYTHON_9.3" # provide a default value if unspecified
# Local variables:
Output_Feature_Class = Input_Table
Output_Feature_Class__2_ = Output_Feature_Class
# Process: Add Field
arcpy.AddField_management(Input_Table, New_Field_Name, Field_Type, "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
# Process: Calculate Field
arcpy.CalculateField_management(Output_Feature_Class, Calculate_Field_Name, Calc_Expression, Field_Expression_Type, "")
Granted, there's Parameters instead of real values, but you get the idea, each of those parameters need to be filled out and all this code needs to run.
Here's the Stata code:
gen SUM_M11M12 = TRT_POPM11 + TRT_POPM12
That was easy!
Granted, this was only a numeric calculation, I still feel super confident about my Python/VBScript string 'skillz'[:5] + 's', but just saying, Stata is super fast and at the end of the day, those last numeric calc's might be best served in Stata.
Monday, September 26, 2011
Calculating Geometry Measurements in Python
Calculating Geometry Measurements in Python
All below from Esri:
Python expressions can use the geometry Area and Length properties with an areal or linear unit to convert the value to a different unit of measure.
!shape.area@acres!Areal unit of measure keywords: Unit of measure keywords: ACRES | ARES | HECTARES | SQUARECENTIMETERS | SQUAREDECIMETERS | SQUAREINCHES | SQUAREFEET | SQUAREKILOMETERS | SQUAREMETERS | SQUAREMILES | SQUAREMILLIMETERS | SQUAREYARDS | SQUAREMAPUNITSLinear unit of measure keywords: CENTIMETERS | DECIMALDEGREES | DECIMETERS | FEET | INCHES | KILOMETERS | METERS | MILES | MILLIMETERS | NAUTICALMILES | POINTS | YARDS
Monday, September 12, 2011
Split Layer By Attributes for ArcGIS 10
This is an update to a tool I used a lot before migrating over to 10. I just needed something similar recently - for some zonal stats stuff and saw it was updated for 10. Thanks Dan Patterson.
http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=37AEB018-1422-2418-A036-CA6D9920F808
Thursday, September 8, 2011
VBA: Link From ArcMap to Google Maps
The link below has a tool to link ArcMap to Google Maps and Streetview;
http://gis.utah.gov/code-visual-basic/vba-link-from-arcmap-to-google-maps
I've used this tool for a while at 9.3.1 but just started to use it again at ArcGIS 10.
http://gis.utah.gov/code-visual-basic/vba-link-from-arcmap-to-google-maps
I've used this tool for a while at 9.3.1 but just started to use it again at ArcGIS 10.
Thursday, August 4, 2011
Removing or Flattening Z and M values from a point Feature Class
I've had to flatten a Z value-laden point file before, or for whatever reason seen CAD data with M-awareness. For the life of me though I couldn't recall how the heck I did it in the past. It's like those tasks in GIS you do only once in a blue moon and cannot remember the name of the tool or what terms to search (see lattice dem).
Anyway, its actually a very simple process of exporting your data in ArcCatalog and just setting the environments.
http://support.esri.com/en/knowledgebase/techarticles/detail/35818
from Esri:
Anyway, its actually a very simple process of exporting your data in ArcCatalog and just setting the environments.
http://support.esri.com/en/knowledgebase/techarticles/detail/35818
from Esri:
Summary
Instructions provided describe how to create a copy of a feature class and disable M- and Z-value associations for the output feature class. These associations cannot be removed from an existing feature class.
M-values are routing values.
Z-values are elevation values.
M-values are routing values.
Z-values are elevation values.
Procedure
- Browse to ArcToolbox > Conversion Tools > To Geodatabase.
- Open the Feature Class to Geodatabase (multiple) tool.
- Add all the feature classes into the Input Feature Class parameter.
- Select an Output Geodatabase.
- Click the Environments button at the bottom of the tool dialog box.
- Expand the General Settings.
- For the parameter, Output has Z Values, change the value to Disabled.
- For the parameter, Output has M Values, change the value to Disabled.
- Click OK in the Environments dialog box.
- Click OK to execute the geoprocessing tool.
Subscribe to:
Posts (Atom)