Home arrow GIS Data & Resources arrow Scripts and Code
GIS-Related Scripts and Programming Code

This section provides a venue for sharing GIS-related programming code and custom scripts in a variety of languages. Posts can be viewed by category or as a whole in blog format (below).

Category Links:

GIS Scripts and Code (Weblog format, All Posts):




Python! Raw LiDAR XYZI to First/Last Return Grid PDF Print E-mail

Written by Kevin Bell,

Have you ever needed to convert raw LiDAR xyzi files to first/last return grids?  Me too, so I hacked up a routine to git 'er done.  I'll write out the idea below and see if you can follow along in the code.

-make a list of all the xyz files in a directory
-the points are dense, but random, so eliminate the decimals which gives you concrete x y pairs
-don't drop the z decimals
-concatenate the x and y
-for each xy pair, make a list of z's (we can have multiple laser strikes per meter)
-sort each xy pair list
-write out the new x,y,z's to a csv file, but keep only the highest or lowest z
-make an event layer
-point to grid
-FocalMean to fill in the wholes (i'm making a 1 meter grid from 1.25 meter postings)

-delete your temp data.

To follow this, you'll need to understand python "lists", "dictionaries", "slicing", and built in commands.  Realize that the paths are hard coded, although its only a few lines.

 

REALIZE THAT THIS IS MY OWN INVENTION, AND COULD BE COMPLETELY SILLY.

 

 

Comment on this Article
23, Mar. 2009
Last Updated ( 25, Mar. 2009 )
Read more...
 
VBA: Check for Non-Linear Geometry PDF Print E-mail

Written by Bert Granberg,

The ArcGIS Geodatabase model allows for the storage of true curves in the form of Bezier, Circular, and Eliptical Arcs. Some software (including the spatial query in ESRI's own ArcGIS Server 9.2 doesn't work well with these departures from the basic linear features described as a list of x,y coordinate pair vertices.

This script can be used to detect non-linear segments in a geodatabase feature class. Object ID's are output to a text file. Run it from ArcMap, it will work on the first layer (position 0 in the TOC).

The fastest way to bulk convert these curves to line-based segments is to export to a shapefile, although it is possible to operate on the geometry programatically so you can avoid exporting and reloading your data.

User Comments (1)
10, Mar. 2009
Read more...
 
Scripts: KML Conversions PDF Print E-mail

Written by James Wingate,

With an ArcInfo license for ArcGIS, you can use ArcToolbox to export from .shp to .kml and vice versa. But this can't be done with an ArcView license using standard tools.

However, there appear to be many scripts out there to do conversions to and from KML. These particular two have good documentation that can be followed by a lay GIS user like me. That being said, here are the URL's:

Convert KML to shapefile:
http://arcscripts.esri.com/details.asp?dbid=15603

Export ArcGIS to KML:
http://arcscripts.esri.com/details.asp?dbid=14273

Comment on this Article
02, Mar. 2009
Last Updated ( 02, Mar. 2009 )
 
ArcMap .CAL Script: Generate Radial Polygons PDF Print E-mail

Written by Bert Granberg,


This ArcMap field calculator script will populate the SHAPE geometry field in an ArcGIS polygon feature class from basic radial attributes used in FCC ULS radio transmission data, including mobile phones.The ULS data is freely downloadable from the FCC ULS site.

The FCC license requires eight radials at specifed azimuths (0,45,90,135,180,225,270,& 315 degrees) be provided by for each proposed location. A radial is a pizza-shaped wedge of geographic space that roughly represents the service area boundary of an antenna by factoring in height, terrain, and atmosphere. An obvious next step would be using a elevation model dataset to better analyze the impact of terrain.

This script requires four input values stored in attribute fields (you need these values in a existing polygon feature class with empty geometries):

  1. The x coordinate for the center point (usually a tower)
  2. The y coordinate for the center point (usually a tower)
  3. The distance to the service area boundary (in meters)
  4. The radial's azimuth measured in degrees (again, these need to be in increments of 45 degrees starting with 0

Use within an edit session is recommended.

TO USE:  

  • define an empty geodatabase or shapefile polygon feature class with at least the required x,y,distance, and radius azimuth fields(the curves will be converted to line segments with shapefile format)
  • load the tabular data from the FCC ULS radial tables into this polygon feature class
  • open the attribute table for this polygon feature class and select the SHAPE field
  • then hit CTRL + SHIFT + F to open the field calculator.
  • In the field calculator, check the Advanced Option and paste this script in the Pre-Logic VBS Script Code text box.
  • Make sure that the four input field names in the script correspond to the names of your fields containg these values
  • Type the word pSegmentCollection into the bottom text box and hit OK

Note: Input data should look something like this before running the script:


Comment on this Article
16, Feb. 2009
Last Updated ( 16, Feb. 2009 )
Read more...
 
<< Start < Prev 1 2 3 4 5 6 7 8 9 10 Next > End >>

Results 25 - 32 of 130

AGRC Contacts | UGIC Contacts

feed image feed image

Utah GIS Portal © 2009 AGRC

Optimized for