[R-sig-Geo] readOGR -- Dropping null geometries -- Possible issue with path as a point

Roger Bivand Roger.Bivand at nhh.no
Wed Jul 31 21:16:38 CEST 2013


The data you link to are not those you refer to:

> tornados.rg <- readOGR(".", "tornado")
OGR data source with driver: ESRI Shapefile 
Source: ".", layer: "tornado"
with 56221 features and 28 fields
Feature type: wkbPoint with 2 dimensions

that source does not provide any called "tornado_tracks". I do see similar behaviour in:

http://www.spc.noaa.gov/gis/svrgis/zipped/prelim_2012_tornado_tracks.zip

but have no idea whether your analysis applies to this data. Please check and report back. If it does, I can try to see why, but NULL geometries are defined in the OGR shapefile driver, and so by definition have no position data. What you may be seeing as first and last equal coordinates are the entries in the data.frame returned when dropNULLGeometries=FALSE, and may be single point events, which have not been given a geometry. You would need to find out from the data provider what they meant by this. It is not permitted to mix geometry types in a shapefile, so the problem may arise if they try to do so; the shapefile contains invalid geometry types for the NULL geometries, suggesting that they are not read or set correctly. The event_id values should permit them to be identified.

Hope this helps,

Roger


--
Roger Bivand
NHH Norwegian School of Economics
Helleveien 30, 5045 Bergen, Norway
Roger.Bivand at nhh.no


________________________________________
Fra: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org] på vegne av Mark Gibbas [mark at weather-source.com]
Sendt: 31. juli 2013 7:17
Til: r-sig-geo at r-project.org
Emne: [R-sig-Geo] readOGR -- Dropping null geometries -- Possible issue with path as a point

Greetings!

I am attempting to read a shapefile with readOGR and I'm getting the
message 'Dropping null geometries'. From what I have been able to
discern the null geometries seem to be associated with lines where the
begin and end lat/lon are the same. So effectively the line is really
just a point. Should such a case cause readOGR to treat this as a null
geometry? Or is it possible something else is happening? Any insight
into this is _very_ appreciated. Thanks!

###############
# DATA DOWNLOAD

    http://www.spc.noaa.gov/gis/svrgis/zipped/tornado.zip

###############
# SAMPLE CODE

    setwd("C:/Users/mark/Downloads/GIS_Data")
    library(rgdal)
    tornados.rg <- readOGR("./SPC_Data/tornado_tracks", "tornado_tracks")

###############
# RESULTS

    OGR data source with driver: ESRI Shapefile
    Source: "./SPC_Data/tornado_tracks", layer: "tornado_tracks"
    with 29806 features and 28 fields
    Feature type: wkbLineString with 2 dimensions
    Warning message:
    In readOGR("./SPC_Data/tornado_tracks", "tornado_tracks") :
       Dropping null geometries: 147, 427, 542, 730, 739, 851, 859, ...

###############
# INVESTIGATION

    By comparing the elements of what was read by readOGR to a CSV file
    of the same data, I find that the ones skipped by readOGR are
    elements where the begin and end lat/lon are the same.

###############
# SESSION INFO

     > sessionInfo()
    R version 2.15.3 (2013-03-01)
    Platform: x86_64-w64-mingw32/x64 (64-bit)

    locale:
    [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
    States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C
    [5] LC_TIME=English_United States.1252

    attached base packages:
    [1] grid      stats     graphics  grDevices utils     datasets
    methods   base

    other attached packages:
    [1] PBSmapping_2.66.53 maptools_0.8-25    lattice_0.20-13
    foreign_0.8-52     rgeos_0.2-19       rgdal_0.8-10 sp_1.0-11

    loaded via a namespace (and not attached):
    [1] tools_2.15.3




        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list