Tim Brophy Stata Conference July 18–19, 2013 New Orleans

Slides:



Advertisements
Similar presentations
Polygon Scan Conversion – 11b
Advertisements

What are Geographical Information Systems (GIS) & ArcView GIS software? What is a Geographical Information System (GIS)? Introduction to ESRI ArcView 3.x.
Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the.
Suite Suite 2 TPF Software – Overview Binary Editor Remote Scripts zTREX Add-Ins & Project Integration with Source Control Manager.
Database Design Process
School of Geography FACULTY OF ENVIRONMENT Working with Tables 1.
Creating Tables in a Web Site
Vanderbilt Business Objects Users Group 1 Reporting Techniques & Formatting Beginning & Advanced.
Introduction to ArcInfo (Workstation)
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 12 – Security Panel Application Introducing.
Benchmark Series Microsoft Excel 2013 Level 2
GIS Lecture 8 Spatial Data Processing.
Introduction to GRCP Boualem RABTA Center for World Food Studies (SOW-VU) Vrije Universiteit - Amsterdam.
Preview Warm Up California Standards Lesson Presentation.
Copyright © 2003 by Prentice Hall Computers: Tools for an Information Age Chapter 15 Programming and Languages: Telling the Computer What to Do.
Page 1 of 34 The Search Agreements functionality in Transfers enables you to find existing agreements pertaining to registered interests. Using the search.
Frank DeSimone Senior MicroStation Application Engineer
Benchmark Series Microsoft Excel 2013 Level 2
GUS: 0262 Fundamentals of GIS
Indiemapper tools.
WFM 6202: Remote Sensing and GIS in Water Management © Dr. Akm Saiful IslamDr. Akm Saiful Islam WFM 6202: Remote Sensing and GIS in Water Management Akm.
ESRM 250 & CFR 520: Introduction to GIS © Phil Hurvitz, KEEP THIS TEXT BOX this slide includes some ESRI fonts. when you save this presentation,
Map Analysis with Feature Datasets Francisco Olivera, Ph.D., P.E. Department of Civil Engineering Texas A&M University.
Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins.
Unit One: GIS Concepts In this unit… ► What is GIS? ► Types of GIS data ► What can you do with GIS? ► ArcGIS 9 license levels ► Basics of the ArcGIS 9.
19 th Advanced Summer School in Regional Science An introduction to GIS using ArcGIS.
ModelBuilder In ArcGIS 9.x By Tim Weigel GEOG 407/607 April 3 rd, 2006.
Basic Concepts of GIS January 29, What is GIS? “A powerful set of tools for collecting, storing, retrieving, transforming and displaying spatial.
@ 2007 Austin Troy. Geoprocessing Introduction to GIS Geoprocessing is the processing of geographic information. Perform spatial analysis and modeling.
Add a File with X, Y coordinates to MapWindow
NR 322: Organizing Data Jim Graham Fall GIS Data Flow Project, resample Processing Processed Data Original Data Final data And maps.
Parcel Data Models for the Geodatabase
Preparing Data for Analysis and Analyzing Spatial Data/ Geoprocessing Class 11 GISG 110.
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 SPATSIM is a system that makes use of shapefiles
Introduction In ArcGIS, there are three basic data structures:
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
School of Geography FACULTY OF ENVIRONMENT Introduction to ArcToolbox and Geoprocessing.
How do we represent the world in a GIS database?
Copyright © 2006 by Maribeth H. Price 7-1 Lesson 7 Spatial Joins.
Tables tables are rows (across) and columns (down) common format in spreadsheets multiple tables linked together create a relational database entity equals.
Geographical Information Systems. Software which can be used in GIS ArcGIS Desktop Map Window Quantum GIS uDig.
GUS: 0265 Applications in GIS Lecture Presentation 1: Vector Data Model and Operations Jeremy Mennis Department of Geography and Urban Studies Temple University.
John Pickford IBM H11 Wednesday, October 4, :30. – 14:30. Platform: Informix Practical Applications of IDS Extensibility (Part 2 of 2)
NR 143 Study Overview: part 1 By Austin Troy University of Vermont Using GIS-- Introduction to GIS.
Geographic Data in GIS. Components of geographic data Three general components to geographic information Three general components to geographic information.
Introduction of Geoprocessing Lecture 9. Geoprocessing  Geoprocessing is any GIS operation used to manipulate data. A typical geoprocessing operation.
Lecture 7 Basic GIS Analysis Operations
Introduction to Geographic Information Systems Fall 2013 (INF 385T-28620) Dr. David Arctur Research Fellow, Adjunct Faculty University of Texas at Austin.
GIS Data Models III GEOG 370 Instructor: Christine Erlien.
What is GIS? “A powerful set of tools for collecting, storing, retrieving, transforming and displaying spatial data”
William Perry U.S. Geological Survey Western Ecological Research Center Geography 375 Final Project May 22, 2013.
GIS Project1 Physical Structure of GDB Geodatabase Feature datasets Object classes, subtypes Features classes, subtypes Relationship classes Geometric.
Lesson 3 GIS Fundamentals MEASURE Evaluation PHFI Training of Trainers May 2011.
Geocoding Chapter 16 GISV431 &GEN405 Dr W Britz. Georeferencing, Transformations and Geocoding Georeferencing is the aligning of geographic data to a.
Chapter 6 Spatial Joins.
A Look at Creating & Updating Point Files
JTLS-GO GIS Tool Updates
Big Data Analytics: HW#3
Spatial Queries & Analysis in GIS
Spatial Analysis and Functions
Maps 1 EPID 799C Fall 2017.
Raster and Vector Data.
Geographic Information Systems
Feature Classes, Data File Formats in ArcGIS
MSFD training 04. July 2012 Jon Maidens.
Maps 1 EPID 799C Fall 2018.
Learn R! GIS.
> Introduction to Nelson Rios, Tulane University
Presentation transcript:

Tim Brophy Stata Conference July 18–19, 2013 New Orleans gpsmap: Routine for verifying and returning the attributable table of given decimal GPS coordinates from a user provided Shapefile Tim Brophy Stata Conference July 18–19, 2013 New Orleans

Overview What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments Overview What is spatial data? How is spatial data useful to researchers? Spatial Data Structure gpsmap introduction gpsmap graphically gpsmap syntax gpsmap demonstration gpsmap how it works Acknowledgments

What is spatial data? Geographic data How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments What is spatial data? Geographic data Latitude and longitude coordinates Accompanying attribute data.

What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments What is spatial data? Identifies geographic locations, features and boundaries. Spatial data is often accessed, manipulated or analysed through Geographic Information Systems (GIS).

How is spatial data useful to researchers? What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments How is spatial data useful to researchers? Allows researcher to analyse data within or across geographical locations. In order for this to happen the locations need to be known Provides data regarding the given geographical locations. Such as: population density geo type (i.e. urban or formal )

Spatial Data Structure What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments Spatial Data Structure Spatial data is normally stored in the ESRI Shapefile format. Shapefiles data is a relational dataset Thus there are multiple tables connected by a primary key. Each of these table come as a separate file extension. At a minimum there are three mandatory file extensions. .shp — shape format; the geometry itself. .dbf — attribute format; columnar attributes for each shape .shx — shape index format; a positional index of the feature geometry

.shp contains all the geo location data. What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .shp in more detail .shp contains all the geo location data.

.shp contains all the geo location data. What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .shp in more detail .shp contains all the geo location data. Latitude Longitude Index Y X 1 31.5867 -32.6729

.shp contains all the geo location data. What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .shp in more detail .shp contains all the geo location data. Latitude Longitude Index Y X 1 31.5867 -32.6729 31.8769 -33.8394

.shp contains all the geo location data. What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .shp in more detail .shp contains all the geo location data. Latitude Longitude Index Y X 1 31.5867 -32.6729 31.8769 -33.8394 31.1762 -31.8617

.shp contains all the geo location data. What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .shp in more detail .shp contains all the geo location data. Latitude Longitude Index Y X 1 31.5867 -32.6729 31.8769 -33.8394 31.1762 -31.8617 31.3846 -31.2675

.shp contains all the geo location data. What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .shp in more detail .shp contains all the geo location data. Latitude Longitude Index Y X 1 31.5867 -32.6729 31.8769 -33.8394 31.1762 -31.8617 31.3846 -31.2675 31.9825 -32.3578

.shp contains all the geo location data. What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .shp in more detail .shp contains all the geo location data. Latitude Longitude Index Y X 1 31.5867 -32.6729 31.8769 -33.8394 31.1762 -31.8617 31.3846 -31.2675 31.9825 -32.3578 31.6112 -32.3698

.shp contains all the geo location data. What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .shp in more detail .shp contains all the geo location data. Latitude Longitude Index Y X 1 31.5867 -32.6729 31.8769 -33.8394 31.1762 -31.8617 31.3846 -31.2675 31.9825 -32.3578 31.6112 -32.3698 Polygon

What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .dbf in more detail .dbf contains the attributes of the Shapefile. These are user defined attributes. Attribute1 Attribute2 Index Province Country 1

.dbf records merge to .shp file with a one to many relationship. What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .dbf in more detail .dbf records merge to .shp file with a one to many relationship. Index Y X 1 31.5867 -32.6729 31.8769 -33.8394 31.1762 -31.8617 31.3846 -31.2675 31.9825 -32.3578 31.6112 -32.3698 Attribute1 Attribute2 Index Province Country 1

What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Introduction gpsmap; a user written Stata command to map a gps coordinates onto a Shapefile. It produces two main outputs: Output 1 Binary variable indicating whether the GPS coordinates were mapped to the .shp Output 2 Where the coordinates were mapped, gpsmap returns the attribute table from the .dbf file.

gpsmap: Explained graphically What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Explained graphically Map GPS coordinates: (Latitude 31.58769, Longitude -32.34962) Output 1: Determine if the given GPS coordinates fall within the bounds of the polygon OUTSIDE INSIDE Valid = 0 Valid = 1

gpsmap: Explained graphically What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Explained graphically Map GPS coordinates: (Latitude 31.58769, Longitude -32.34962) Output 2: Where points map to polygon attribute table is returned. Attribute1 Attribute2 Index Province Country 1

What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Syntax Syntax gpsmap using shapefilename [if] , latitude(variable) longitude(variable) [options] Options valid(newvar) prefix(string) keepusing(varlist)

gpsmap: Demonstration What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Demonstration Input: Shapefile of South Africa’s boundary

gpsmap: Demonstration What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Demonstration Input: GPS coordinates ID Latitude Longitude Expected valid 1 -27.776030° 18.552530°

gpsmap: Demonstration What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Demonstration Input: GPS coordinates ID Latitude Longitude Expected valid 1 -27.776030° 18.552530° 2 -30.682771° 22.600851°

gpsmap: Demonstration What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Demonstration Input: GPS coordinates ID Latitude Longitude Expected valid 1 -27.776030° 18.552530° 2 -30.682771° 22.600851° 3 -29.715901° 27.930595°

gpsmap: Demonstration What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Demonstration Input: GPS coordinates ID Latitude Longitude Expected valid 1 -27.776030° 18.552530° 2 -30.682771° 22.600851° 3 -29.715901° 27.930595° 4 -24.407324° 29.751723°

gpsmap: Demonstration What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Demonstration Input: GPS coordinates ID Latitude Longitude Expected valid 1 -27.776030° 18.552530° 2 -30.682771° 22.600851° 3 -29.715901° 27.930595° 4 -24.407324° 29.751723° 5 -30.429434° 29.463932°

gpsmap: Demonstration What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Demonstration gpsmap using “C:\Users\Tim\Desktop\geo_coding\SOU_outline_SHP\SOU_outline.shp”, latitude(Latitude) longitude(Longitude) valid(demo_valid)

gpsmap: Demonstration What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Demonstration gpsmap using “C:\Users\Tim\Desktop\geo_coding\SOU_outline_SHP\SOU_outline.shp”, latitude(Latitude) longitude(Longitude) valid(demo_valid) Run time 0.11 seconds Running time depends on both the number of gps coords from Stata and the size of the shapefile. Larger shape files will t

gpsmap: Demonstration What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Demonstration gpsmap using “C:\Users\Tim\Desktop\geo_coding\SOU_outline_SHP\SOU_outline.shp”, latitude(Latitude) longitude(Longitude) valid(demo_valid) Run time 0.11 seconds Expected value and the actual value exactly the same.

gpsmap: Demonstration What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: Demonstration gpsmap using “C:\Users\Tim\Desktop\geo_coding\SOU_outline_SHP\SOU_outline.shp”, latitude(Latitude) longitude(Longitude) valid(demo_valid) Run time 0.11 seconds Caption demonstrates that the attribute table is being brought in. The attribute can be one or may variables and can contain all sorts of data, depends on the Shapefile author.

gpsmap: How it works Gpsmap is made up of four main sub-routines What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments gpsmap: How it works Gpsmap is made up of four main sub-routines .dbf reader .shp header reader .shp polygon reader Point in polygon ray casting routine

.dbf reader The .dbf reader reads the attribute table into Stata. What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .dbf reader The .dbf reader reads the attribute table into Stata. Controls for length of variable names 32 characters or less. Imports all data as string format into Stata and then gets Stata to convert to numeric where applicable. Due to this all variables are limited to 244 characters long.

What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .shp header reader The .shp reader reads the polygon headers into Mata. Each polygon shape has a header record in the Shapefile, the record contains: The polygon number in the shape file, i.e. record number. The bounding box Min X, Max X, Min Y, Min Y The start position of the polygon shape in the Shapefile.

What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments .shp polygon reader The .shp polygon reader reads a specific polygon from the Shapefile into Mata Each GPS point from Stata is compared with the Max and Min values in the polygon header tables, selecting the most likely polygon that it will fall into. Each selected polygon is then read in using the polygon reader. Done for both performance and memory efficiency.

Point in polygon routine What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments Point in polygon routine So far: Polygon headers have been read in. Most likely polygon have been identified and read in. Now determine which polygon out of the likely polygon the GPS point falls into.

Point in polygon routine What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments Point in polygon routine A ray casting routine is used making use of the odd even rule. Rule states: If a point lies within a polygon then the a ray cast from that point to infinity, will intersect the border of the polygon an odd number of times if it lies within the polygon.

Point in polygon routine What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments Point in polygon routine A ray casting routine is used making use of the odd even rule. Rule states: If a point lies within a polygon then the a ray cast from that point to infinity, will intersect the border of the polygon an odd number of times if it lies within the polygon.

Point in polygon routine What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments Point in polygon routine A ray casting routine is used making use of the odd even rule. Rule states: If a point lies within a polygon then the a ray cast from that point to infinity, will intersect the border of the polygon an odd number of times if it lies within the polygon. ∞

Point in polygon routine What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments Point in polygon routine A ray casting routine is used making use of the odd even rule. Rule states: If a point lies within a polygon then the a ray cast from that point to infinity, will intersect the border of the polygon an odd number of times if it lies within the polygon. Odd # intersections ∴ inside 1

Point in polygon routine What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments Point in polygon routine A ray casting routine is used making use of the odd even rule. Rule states: If a point lies within a polygon then the a ray cast from that point to infinity, will intersect the border of the polygon an odd number of times if it lies within the polygon. Even # intersections ∴ Outside 1 2

Point in polygon routine What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments Point in polygon routine Calculating the intersections. Calculated the X coordinate of the intersection given Y. Between a horizontal ray cast from point of interest and the borders of the polygon. Count number of determined X results that are greater than or equal to the X value for the point of interest. If count is Odd then inside, if count is even then outside

Acknowledgments and thanks What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled -gments Acknowledgments and thanks Kevin Crow shp2dta Reza C. Daniels and Sibongile Musundwa Co-authors and testing Louise De Villiers, Michelle Chinhema and the rest of the NIDS team. Support utilization and testing gpsmap. Email: tslbrophy@gmail.com Nids: http://www.nids.uct.ac.za