1 / 26

Introduction to GIS Programming

Introduction to GIS Programming . By Jun Liang Department of Geography UNC-CH. 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

ulf
Download Presentation

Introduction to GIS Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 Spatial Analysis Spatial Modeling Spatial Information Management Mapping/GeoVisualization Education/Research Business/Industry Government

  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 Data manage, Mapping Query, Measurement Basic spatial analysis Advanced spatial analysis Integrated expert systems Simple Complex 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 - Within an hour Issues you may need to decide: hardware and algorithm

  11. CensusTracts (Input Features) Clip (Analysis Tools/Proximity Toolset) CensusTractsClip (in TransformScratch.mdb) StreamBuffer (Clip Features) Data Flow – Program Flow Chart 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 – • Downloading data routinely from a website and use them for your model. • 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 Coding spatial models, or other non-spatial models with GIS macro languages, scripts. Your GIS Program

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

  18. Tightly Coupled Applications Data GIS Software – Provides basic commands, macros, etc. Pre-compiled Programs 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. Geo-processing GUI-Interface

  20. * * MxDocument FeatureLayer RasterLayerr Application Layer Map Changing A Layer’s Name

  21. PolygonElement MarkerElement TextElement LineElement Geometry Element Color Symbol GraphicElement FrameElement 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”)

More Related