gpsmap: Routine for verifying and returning the attributable ...

gpsmap: Routine for verifying and returning the attributable ...

gpsmap: Routine for verifying and returning the attributable table of given decimal GPS coordinates from a user provided Shapefile Tim Brophy Stata Conference July 1819, 2013 New Orleans Overview What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled gments

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? What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled gments Geographic data Latitude and longitude coordinates Accompanying attribute data. What is spatial data? What is spatial data?

How is it useful? Spatial Data Structure Identifies geographic locations, features and boundaries. gpsmap Graphically Syntax Demo How it works Acknowled gments 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

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

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

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

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

.shp contains all the geo location data. Latitude Longitude gpsmap Graphically Index Y X Syntax 1 31.5867 -32.6729 Demo 1 31.8769 -33.8394 1

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

Acknowled gments Index Y X 1 31.5867 -32.6729 1 31.8769 -33.8394 1 31.1762 -31.8617 1 31.3846 -31.2675

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

1 31.5867 -32.6729 1 31.8769 -33.8394 1 31.1762 -31.8617 1 31.3846 -31.2675 1 31.9825 -32.3578

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

1 31.5867 -32.6729 1 31.8769 -33.8394 1 31.1762 -31.8617 1 31.3846 -31.2675 1 31.9825 -32.3578 1

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

Country 1 .dbf in more detail What is spatial data? How is it useful? Spatial Data Structure .dbf records merge to .shp file with a one to many relationship. gpsmap Graphically Syntax Demo How it works Acknowled gments Attribute1 Province Index Y X

1 31.5867 -32.6729 Attribute2 Index 1 31.8769 -33.8394 Country 1 1 31.1762 -31.8617 1 31.3846 -31.2675

1 31.9825 -32.3578 1 31.6112 -32.3698 gpsmap: Introduction What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled gments 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 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 Graphically Syntax Demo How it works Acknowled gments

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

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

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

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

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

1 0 gpsmap: Demonstration What is spatial data? Input: GPS coordinates How is it useful? ID Latitude Longitude Expected valid Spatial Data Structure 1 -27.776030 18.552530 0 2

-30.682771 22.600851 1 Graphically 3 -29.715901 27.930595 0 Syntax 4 -24.407324 29.751723 1 gpsmap Demo How it works

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

-30.682771 22.600851 1 Graphically 3 -29.715901 27.930595 0 Syntax 4 -24.407324 29.751723 1 Demo 5 -30.429434

29.463932 1 gpsmap How it works Acknowled gments gpsmap: Demonstration What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled gments 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 using C:\Users\Tim\Desktop\geo_coding\ SOU_outline_SHP\SOU_outline.shp, latitude(Latitude) longitude(Longitude) valid(demo_valid) gpsmap Graphically Syntax Demo How it works Acknowled gments Run time 0.11 seconds gpsmap: Demonstration What is spatial data? How is it useful? Spatial Data Structure gpsmap using C:\Users\Tim\Desktop\geo_coding\ SOU_outline_SHP\SOU_outline.shp, latitude(Latitude) longitude(Longitude) valid(demo_valid) gpsmap

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

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

Graphically Syntax Demo How it works Acknowled gments 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. .shp header reader What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled gments 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. .shp polygon reader What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax 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. Demo How it works Acknowled gments 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 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 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 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 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. How it works Acknowled gments Point in polygon routine What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically

Syntax Demo 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. How it works Acknowled gments 1 Odd # intersections inside Point in polygon routine What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo

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. How it works Acknowled gments 1 2 Even # intersections Outside Point in polygon routine What is spatial data? How is it useful? Spatial Data Structure gpsmap Graphically Syntax Demo How it works Acknowled gments

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 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: [email protected] Nids: http://www.nids.uct.ac.za

Recently Viewed Presentations

  • Lecture 11 - University of Arizona

    Lecture 11 - University of Arizona

    Lecture 11 Introduction to ANOVA ... Uses an F-ratio to test any 2 treatments The numerator for MS between treatment is recalculated comparing only the 2 treatments you want to look at - denominator stays the same The denominator for...
  • Chapter 1 Structure and Bonding - faculty.swosu.edu

    Chapter 1 Structure and Bonding - faculty.swosu.edu

    Alkanes Structure (Carbon always has four bonds) Hydrocarbons = molecules containing only hydrogen and carbon atoms Saturated = hydrocarbon containing all of the hydrogen possible (all single bonds) Unsaturated = hydrocarbon with less than maximum H's (double/triple bonds) Normal Alkanes...
  • Diapositiva 1

    Diapositiva 1

    y causan menos del 1% de los CM. La combinación de todos ellos supone aproximadamenteel 20% del componente genético del riesgo de CM.
  • Presentation by Noel Davis Dance is a way

    Presentation by Noel Davis Dance is a way

    * Dance is the art form in which human movement becomes the medium for sensing, understanding, and communicating ideas, feelings, and experiences. * Dance is universal, that means that it can be identified by all people of the world…dance is...
  • Red Flag, Yellow Flag - Wiley

    Red Flag, Yellow Flag - Wiley

    Red Flag, Yellow Flag Numberless Financial ... is worried that it is in such bad financial condition that it might not survive for the next 12 months. ... It's hard to imagine a good reason for taking such a long...
  • Anticoagulants - University of Saskatchewan

    Anticoagulants - University of Saskatchewan

    Increased plasma clearance of LDL Four Groups of Antihyperlipidemic Drugs - all reduce the risk of coronary heart disease. Statins Resins Nicotinic acid (niacin) Fibrates Statins Most effective and best-tolerated agents for treating dyslipidemia Derived from Penicillium or Aspergillus species...
  • CENSUS 2011 The use of registers in the german census model

    CENSUS 2011 The use of registers in the german census model

    Register ofaddresses in the German Census. Covered all addresses with housingspace and occupied living quarters. 2 administrative data sources -> outer join
  • Phylum Arthropoda - Weebly

    Phylum Arthropoda - Weebly

    The phylum Arthropoda includes lobsters, spiders, scorpions, millipedes, & insects; it encompasses over one million species. They are the most abundant of all the visible animals.Arthropods live virtually everywhere, and their influence on man & the environment is great.