Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to GIS Programming By Jun Liang Department of Geography UNC-CH.

Similar presentations


Presentation on theme: "Introduction to GIS Programming By Jun Liang Department of Geography UNC-CH."— Presentation transcript:

1 Introduction to GIS Programming By Jun Liang Department of Geography UNC-CH

2 Audiences Who might be interested in this topic? -Bored with repeating GIS operations -Do not like the default look (GUI) of Commercial software -Has difficulties in standardizing map output -Functions you need are not available in your GIS software

3 Preparing for GIS Programming - GIS software operations: know what are you doing - Spatial Data Models: Understand what are dealing with - Basic Spatial Analytical Functions: Have a GIS brain - Knowledge on Programming: Integer? Binary? Loops? Logical operators?

4 Can I do it? Question – can I write programs for GIS applications? Is it difficult to do? Answer – It depends on what do you want to do. At most time, you can, at least I believe. It is just another language – easier than most foreign languages.

5 Where to start?  It may already exist somewhere. If you are looking a tool, a function, which you could not find in your GIS software, you may google it first, or try to find it in a community website, such as arcscripts.esri.com.  Write your own.

6 GIS Interests are Growing Mapping/GeoVisualization Spatial Information Management Spatial Analysis Spatial Modeling Government Education/Research Business/Industry

7 Application Examples -Public Health -Environmental Studies -Urban Planning -Water Resources Management -Crime Mapping / Crime Pattern Analysis -Store Location Optimization -Internet Mapping / Routing -Transportation/Logistics

8 Complexity of GIS Applications Simple Complex Data manage, Mapping Query, Measurement Basic spatial analysis Advanced spatial analysis Integrated expert systems GIS programming could be used for different level applications.

9 Data Volume Before proceed to write programs for your GIS applications, you may already have finished data collection. The size of your data collection will affect the way you are going to code. -Large volume: multiple Gig bites -Intermediate volume: 100Mb – 1 Gig -Small volume: ~100Mb

10 Geo-Computation Complexity/CPU time is another factor you need to estimate, before you design your program. -Several days + -Within a day - Several hours - Several hours - Within an hour - Within an hour Issues you may need to decide: hardware and algorithm Issues you may need to decide: hardware and algorithm

11 Data Flow – Program Flow Chart CensusTracts (Input Features) Clip (Analysis Tools/Proximity Toolset) CensusTractsClip (in TransformScratch.mdb) StreamBuffer (Clip Features) The flow chart will explain: Spatial functions/tools you need to use Parameters for functions Output definitions Program Logic Structure/Work flow

12 Implementation Structures There are different ways you can implement your GIS programs, based on: -GIS software you used -Availability of tools/functions -The nature of your application (share with other people? Going to used by other people who have limited GIS experiences? Etc.)

13 First Approach – Write your own code without help from existing GIS software Your Research Project/Application/Model GIS functions – needed by your model Do not need spatial visualization; data management; hard to be shared or reused by other people; one time application.

14 Programming – on your own Some examples of the first approaches – (1)Downloading data routinely from a website and use them for your model. (2)Analyzing the average transportation cost from one point to a set of points. (location optimization.) You can use any programming languages you are familiar with, such as Java, C, etc.

15 Approach 2 – Customizing existing GIS software - Using macro language to customize existing GIS software: GUI focused application. Providing service to general public.

16 Approach 3 – Creating new functions using GIS macro/scripts GIS Software Your GIS Program Coding spatial models, or other non-spatial models with GIS macro languages, scripts.

17 Approach 4 – Loosely and tightly coupled integration GIS Software – Provides basic commands, macros, etc. External Program Module Loosely-Couple Architecture for integrating your Models (scripts, codes, etc) with GIS software Data

18 Tightly Coupled Applications GIS Software – Provides basic commands, macros, etc. Pre-compiled Programs Data GIS software can talk to some pre-compiled programs during execution – the integration usually looks seamless. It is just like that you can edit Excel object in your Word document.

19 ArcGIS Programming   The most recent release of ESRI’s ArcGIS® suite incorporates both Visual Basic and Python scripts. However, Python is well- suited to geoprocessing and much of the code in ArcGIS 9 that performs these types of functions is written in Python. GUI-Interface Geo-processing

20 Changing A Layer’s Name MxDocumentMap * Layer * ApplicationFeatureLayerRasterLayerr

21 LineElement ElementGeometry ColorSymbolGraphicElementFrameElement TextElementMarkerElementPolygonElement To make graphics on a map, you create objects out of the coclass under GraphicElement.

22 Class Diagram to help programming

23 Using Python for Geoprocessing ESRI chose Python as the support language for geoprocessing because: Python is easy to learn because of its clean syntax and simple, clear concepts. Python supports object-oriented programming in an easy- to-understand manner. Documenting Python is easier because it has readable code. Complicated data structures are easy to work with in Python. Python is simple to integrate with C++ and Fortran. Python can be seamlessly integrated with Java. Python is free from the Web and has a widespread community.

24 Scripting Functionalities

25 An simple python example   import arcgisscripting   gp = arcgisscripting.create()   gp.Workspace = “c :\\Data\\Canada.mdb”   gp.Buffer(”Streams”, “NoBuildZone”, 100)   gp.Erase(”LandUse”, “NoBuildone”, “BuildZone”)

26


Download ppt "Introduction to GIS Programming By Jun Liang Department of Geography UNC-CH."

Similar presentations


Ads by Google