Adding shapefiles as feature layers Adding coverages as feature layers Adding grids as raster layers Adding tables as table windows Adding text files as.

Slides:



Advertisements
Similar presentations
Geo GIS Practicuum Introduction to ArcGIS 8 Exercise 5 - ESRI Virtual Campus Chapters 1-2, ArcGIS Methods …
Advertisements

ESRI Software ArcGIS –ArcMap –ArcEdit –ArcInfo –ArcView.
Introducing ArcGIS Desktop
ArcGIS Geodatabase Miles Logsdon Spatial Information Technologies, UW Garry Trudeau - Doonesbury.
NR 322: Editing Spatial Data Jim Graham Fall 2008 Chapter 6.
EAS781 Practical Geophysics: The Tools and How to Use Them ArcGis Introduction ArcView ArcInfo ArcGis ?
Creating and Editing Feature Data Francisco Olivera, Ph.D., P.E. Srikanth Koka Department of Civil Engineering Texas A&M University.
So What is GIS??? “A collection of computer hardware, software and procedures that are used to organize, manage, analyze and display.
19 th Advanced Summer School in Regional Science An introduction to GIS using ArcGIS.
ArcCatalog and Geodatabases
Introduction to ArcView ArcView_module_2 May 12, 10:40 AM.
ESRM 250 & CFR 520: Introduction to GIS © Phil Hurvitz, KEEP THIS TEXT BOX this slide includes some ESRI fonts. when you save this presentation,
GIS Data Models Components of a GIS Map Common Data Models.
ESRM 250 & CFR 520: Introduction to GIS © Phil Hurvitz, KEEP THIS TEXT BOX this slide includes some ESRI fonts. when you save this presentation,
Introduction to the Architecture of ArcGIS
Introduction to ArcGIS for Environmental Scientists Module 2 – Fundamentals Lecture 6 – Table Functions.
Lecture 4 Data. Why GIS? Ask questions Solve a problem Support a decision Make Maps Involve others, share data, procedures, ideas.
NR 322: Organizing Data Jim Graham Fall GIS Data Flow Project, resample Processing Processed Data Original Data Final data And maps.
Data Structures & GeoDatabase. GeoDatabase Implemented in a relational database Comes in two flavors – Personal & Enterprise (Access & Sys. Like Oracle)
Mid-Semester Lecture Exam Vocabulary Obvious steps within GIS –Selection and query processes –Working with tables –Classification concepts Projections.
Introduction to ArcPy. Topics What is ArcPy? Accessing geoprocessing tools using ArcPy Writing scripts using ArcPy.
Introduction to ArcGIS for Environmental Scientists Module 1 – Data Visualization Chapter 1 – GIS Basics.
Major parts of ArcGIS ArcView -Basic mapping, editing and Analysis tools ArcEditor -all of ArcView plus Adds ability to deal with topological and network.
Unit Two: Attribute Tables In this unit… ► Features & properties  Basic features  Rearranging columns  Freezing & Sorting columns  Field Labels & Hiding.
Automatic Turntable Calculation Tool Melissa J Rura CE 508 Dr. Shan 10/29/2004.
How do we represent the world in a GIS database?
Attributes in ArcGIS. ArcGIS Attributes FID – ESRI’s internal identifier Shape – Actual spatial data.
ATN GIS Support ArcGIS: ArcMap Data View.
Copyright © 2006 by Maribeth H. Price 2-1 Chapter 2 Working with ArcMap.
Chapter 12 Making Tools Week 7 Fall Tools (events) besides Click MouseDown, MouseUp, MouseMove CursorID defines mouse appearance Eabled to disable.
Introduction to ArcGIS
Data Queries Selecting features in ArcMap Data queries  Important part of a GIS project Can be a part of your data preparation or final analysis  Data.
ArcCatalog and Geodatabases Francisco Olivera, Ph.D., P.E. Srikanth Koka Department of Civil Engineering Texas A&M University.
Arch: 383 Introduction to GIS Week 2 Introduction to GEOGRAPHIC INFORMATION SYSTEMS Can Kara Faculty of Architecture 2011 ARC 383.
GIS Data Structures How do we represent the world in a GIS database?
Working with ArcGIS Data Data Management and Tips Your friend…..ArcCatalog.
CFR 250/590 Introduction to GIS, Autumn 1999 View Basics © Phil Hurvitz, intro.ppt 1 Overview Getting data into ArcView Displaying themes Theme.
Intro to GIS | Summer 2012 Attribute Tables – Part 1.
A Quick Introduction to GIS
Geographic Data in GIS. Components of geographic data Three general components to geographic information Three general components to geographic information.
Project 5 : programming ArcObject with VBA Part I Vector data Sherry Fu CE 697V Nov. 30, 2006.
O LLIVIER & C O New Zealand Projections Projections Workshop Basic Projection Steps NZ Transverse Mercator Projections in ArcGIS 8.2 Reprojecting Images.
Chapter 11 Navigating Object Model Diagrams Week 6, 2008 Spring.
Table formats ArcGIS reads table in many formats: dBase format (shapefile) INFO format (workstation ArcInfo) Geodatabase table (MS Access in case of personal.
Selecting features in ArcMap
CFR 250/590 Introduction to GIS, Autumn 1999 Raster Analysis I © Phil Hurvitz, raster1.ppt 1  Overview Grid themes Setting grid theme and analysis.
Co-sponsored by the MIT Libraries and IS&T GIS Lab website: Advanced ArcGIS.
DEM TRAINING (DIGITAL ELEVATION MODEL). STEP 1 OPEN GIS.
Programming for Geographical Information Analysis: Advanced Skills Lecture 3: Arc Data Framework Dr Andy Evans.
@2007 Austin Troy Lecture 2: Introduction to the Architecture of ArcGIS By Weiqi Zhou University of Vermont Thanks are due to Prof. Troy, upon whose lecture.
Creating and Editing Feature Data Francisco Olivera, Ph.D., P.E. Srikanth Koka Department of Civil Engineering Texas A&M University.
NR 322: Editing Attributes Jim Graham Fall 2008 Chapter 6.
Arc: Editing Data Dr Andy Evans. Editing Data Putting Arc into an editing session. Adding a new field/column. Changing a value.
Adding a Picture in ArcGIS. Getting Started Open ArcMap in ArcGIS Add shape files Find pictures on the web save in folder with shape files you added to.
Key Terms Attribute join Target table Join table Spatial join.
Improving Georeferencing Workflow with Python
ArcGIS Topology Shapefiles, Coverages, Geodatabases
Development of Linear Measure Tool using Application Framework
Introduction to ArcGIS
Hazards Planning and Risk Management
Lecture 4 An example for changing a layer’s Name
ArcCatalog and Geodatabases
Feature Classes, Data File Formats in ArcGIS
Working Spatial Data File Geodatabase
Lecture 05 Organizing Geographic Data
Hazards Planning and Risk Management
Hazards Planning and Risk Management
ArcCatalog and Geodatabases
ESRM 250/CFR 520 Autumn 2009 Phil Hurvitz
ArcCatalog and Geodatabases
Presentation transcript:

Adding shapefiles as feature layers Adding coverages as feature layers Adding grids as raster layers Adding tables as table windows Adding text files as table windows Getting projection information Getting statistics about a field Creating a new shapefile theme

SpatialQuery Filter

IWorkspaceFactory To create a new workspace To connect to an existing workspace To find information about a workspace

Sub add_shapefile() Dim pmxdoc As IMxDocument Set pmxdoc = ThisDocument Dim pmap As IMap Set pmap = pmxdoc.FocusMap 'Objects for getting data from disk: Dim pworkspacefactory As IWorkspaceFactory Set pworkspacefactory = New ShapefileWorkspaceFactory Dim pworkspace As IFeatureWorkspace Set pworkspace = pworkspacefactory.OpenFromFile("C:\test", 0) 'Get shapefile from feature workspace: Dim pFeatureClass As IFeatureClass Set pFeatureClass = pworkspace.OpenFeatureClass("towns ")

'Set the feature class to the arcmap Feature Layer Dim pFeatureLayer As IFeatureLayer Set pFeatureLayer = New FeatureLayer Set pFeatureLayer.FeatureClass = pFeatureClass 'Name the theme for table of contents, add it to pmap and refresh: pFeatureLayer.Name = "Alaska Villages and Towns" pmap.AddLayer pFeatureLayer pmxdoc.ActiveView.Refresh pmxdoc.UpdateContents

Sub add_arcinfo_polygon_coverage() Dim pmxdoc As IMxDocument Set pmxdoc = ThisDocument Dim pmap As IMap Set pmap = pmxdoc.FocusMap 'Objects for getting data from disk: Dim pworkspacefactory As IWorkspaceFactory Set pworkspacefactory = New ArcInfo WorkspaceFactory Dim pworkspace As IFeatureWorkspace Set pworkspace = pworkspacefactory.OpenFromFile("C:\test", 0) 'Get polygons in quad_polys coverage from feature workspace: Dim pFeatureClass As IFeatureClass Set pFeatureClass = pworkspace.OpenFeatureClass("quad_polys:polygon")

'Set the feature class to the arcmap Feature Layer Dim pFeatureLayer As IFeatureLayer Set pFeatureLayer = New FeatureLayer Set pFeatureLayer.FeatureClass = pFeatureClass 'Name the theme for table of contents, add it to pmap and refresh: pFeatureLayer.Name = "Alaska 1:63360 Quadrangles" pmap.AddLayer pFeatureLayer pmxdoc.ActiveView.Refresh pmxdoc.UpdateContents

Sub add_grid() Dim pmxdoc As IMxDocument Set pmxdoc = ThisDocument Dim pmap As IMap Set pmap = pmxdoc.FocusMap 'Objects for getting data from disk: Dim pworkspacefactory As IWorkspaceFactory Set pworkspacefactory = New RasterWorkspaceFactory Dim pRasterFolder As IRasterWorkspace Set pRasterFolder = pworkspacefactory.OpenFromFile("C:\test\", 0) 'Get raster grid from raster workspace: Dim pRDataSet As IRasterDataset Set pRDataSet = pRasterFolder.OpenRasterDataset("elevation")

'Set raster data set to Arcmap raster layer: Dim pRasterLayer As IRasterLayer Set pRasterLayer = New RasterLayer pRasterLayer.CreateFromDataset pRDataSet 'Name the grid layer for table of contents, add it to pmap and refresh: pRasterLayer.Name = "Alaska Elevation Grid" pmap.AddLayer pRasterLayer pmxdoc.ActiveView.Refresh pmxdoc.UpdateContents End Sub

Adding A Table Create new workspace name Specify pathname Specify workspace factory program ID

Sub add_table() Dim pmxdoc As IMxDocument Set pmxdoc = ThisDocument Dim pmap As IMap Set pmap = pmxdoc.FocusMap 'Set workspacename object: Dim pWorkspacename As IWorkspaceName Set pWorkspacename = New WorkspaceName pWorkspacename.WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory" pWorkspacename.PathName = "c:\test"

Adding A Table(continued..) Create new workspace name Specify pathname Specify workspace factory program ID

'Set Dataset name workspace and name Dim pDatasetname As IDatasetName Set pDatasetname = New TableName Set pDatasetname.WorkspaceName = pWorkspacename pDatasetname.Name = "salmon.dbf" ‘Open table: Dim pTable As ITable Dim pname As IName Set pname = pDatasetname ‘QueryInterface Set pTable = pname.Open

'Add table to collection of pmap tables... Dim ptablecollection As ITableCollection Set ptablecollection = pmap ptablecollection.AddTable pTable 'Open the table in a arcmap table-window: Dim ptablewindow As ITableWindow Set ptablewindow = New TableWindow Set ptablewindow.Table = pTable Set ptablewindow.Application = Application ptablewindow.Show True End Sub

Adding A Text Table Create new workspace name Specify pathname Specify workspace factory program ID

Sub add_text table() Dim pmxdoc As IMxDocument Set pmxdoc = ThisDocument Dim pmap As IMap Set pmap = pmxdoc.FocusMap 'Set workspacename object: Dim pWorkspacename As IWorkspaceName Set pWorkspacename = New WorkspaceName pWorkspacename.WorkspaceFactoryProgID = "esriDataSourcesOleDB.TextFileWorkspaceFactory " pWorkspacename.PathName = "c:\test"

'Set table object and open table.. Dim pDatasetname As IDatasetName Set pDatasetname = New TableName Set pDatasetname.WorkspaceName = pWorkspacename pDatasetname.Name = "salmon.txt" Dim pTable As ITable Dim pname As IName Set pname = pDatasetname 'query interface Set pTable = pname.Open 'Open the table in a arcmap table-window: Dim ptablewindow As ITableWindow Set ptablewindow = New TableWindow Set ptablewindow.Table = pTable Set ptablewindow.Application = Application ptablewindow.Show True 'Add table to collection of pmap tables... Dim ptablecollection As ITableCollection Set ptablecollection = pmap ptablecollection.AddTable pTable End sub

Getting Projection Information

Sub projection_info() Dim pmxdoc As IMxDocument Set pmxdoc = ThisDocument Dim pstatusbar As IStatusBar Set pstatusbar = Application.StatusBar Dim pmap As IMap Set pmap = pmxdoc.FocusMap Dim pflayer As IFeatureLayer Set pflayer = pmap.Layer(0) 'Get spatial reference info: Dim pGeoDataset As IGeoDataset Set pGeoDataset = pflayer Dim pSpatialRef As ISpatialReference Set pSpatialRef = pGeoDataset.SpatialReference

'Get projected coordinate system information: Dim pprojection As IProjectedCoordinateSystem Set pprojection = pSpatialRef Dim p_xyunit As ILinearUnit Set p_xyunit = pprojection.CoordinateUnit Dim p_spheroid As IGeographicCoordinateSystem Set p_spheroid = pprojection.GeographicCoordinateSystem Dim pDatum As IDatum Set pDatum = p_spheroid.Datum ‘Display projection information on status bar pane#0 pstatusbar.Message(0) = "Projection: " & pSpatialRef.Name & _ " Datum: " & pDatum.Name & _ " X,Y units: " & p_xyunit.Name End Sub

Sub TEST_STATS() Dim pMxDoc As IMxDocument, pFLayer As IFeatureLayer Set pMxDoc = ThisDocument Set pFLayer = pMxDoc.FocusMap.Layer(0) ‘Set cursor to all feature layer rows: Dim pCursor As ICursor Set pCursor = pFLayer.Search(Nothing, False) ‘Specify field and rows for statisitics: Dim pData As IDataStatistics, pStatResults As IStatisticsResults Set pData = New DataStatistics pData.Field = "hectares" 'field to get statistics from Set pData.Cursor = pCursor 'all rows in feature layer ‘Get the statistics results and output to statusbar the mean, count properties: Set pStatResults = pData.Statistics Dim pstatusbar As IStatusBar Set pstatusbar = Application.StatusBar pstatusbar.Message(0) = "Hectares stats...Mean = " & pStatResults.Mean & " N = " & pStatResults.Count End Sub

Sub CreateShapefile() Const strFolder As String = "c:\test" Const strName As String = "polygon_theme" ' Dont include.shp extension Const strShapeFieldName As String = "Shape" ' Open the folder to contain the shapefile as a workspace Dim pFWS As IFeatureWorkspace Dim pWorkspaceFactory As IWorkspaceFactory Set pWorkspaceFactory = New ShapefileWorkspaceFactory Set pFWS = pWorkspaceFactory.OpenFromFile(strFolder, 0) ' Set up a fields collection that will contain the three attribute fields Dim pFields As IFields Dim pFieldsEdit As IFieldsEdit Set pFields = New Fields Set pFieldsEdit = pFields Creating a New Shapefile With 3 Fields

'Create three attribute fields: a shape field, a character string field, a double field Dim pField As IField Dim pFieldEdit As IFieldEdit ' Make the shape field ' it will need a geometry definition, with a spatial reference Set pField = New Field Set pFieldEdit = pField pFieldEdit.Name = strShapeFieldName pFieldEdit.Type = esriFieldTypeGeometry Dim pGeomDef As IGeometryDef Dim pGeomDefEdit As IGeometryDefEdit Set pGeomDef = New GeometryDef Set pGeomDefEdit = pGeomDef With pGeomDefEdit.GeometryType = esriGeometryPolygon Set.SpatialReference = New UnknownCoordinateSystem End With Set pFieldEdit.GeometryDef = pGeomDef pFieldsEdit.AddField pField

' Add a character string field that could hold up to 4 characters: Set pField = New Field Set pFieldEdit = pField With pFieldEdit.Length = 4.Name = "Char_Field".Type = esriFieldTypeString End With pFieldsEdit.AddField pField ' Add a double field that could hold area: Set pField = New Field Set pFieldEdit = pField With pFieldEdit.Length = 8 '8 bytes.Name = "Area".Type = esriFieldTypeDouble.Precision = 16 'Total number of digits.Scale = 3 'Number of digits beyond decimal point End With pFieldsEdit.AddField pField ' Create the shapefile (some parameters apply to geodatabase ---coded to Nothing) Dim pFeatClass As IFeatureClass Set pFeatClass = pFWS.CreateFeatureClass(strName, pFields, Nothing, Nothing, _ esriFTSimple, strShapeFieldName, "") End Sub