Hmm.

I reread in my shapeFile using readOGR() and when I summary(), I get this:

> summary(barabay)
Object of class SpatialPolygonsDataFrame
Coordinates:
        min       max
x -90.15208 -89.73317
y  29.18969  29.49023
Is projected: FALSE
proj4string :
[+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0]
Data attributes:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
    1.0     1.5     2.0     2.0     2.5     3.0

My coordinates are

> summary(sightcoords)
Object of class SpatialPoints
Coordinates:
                min       max
coords.x1  29.19043  29.41972
coords.x2 -90.11623 -89.83532
Is projected: TRUE
proj4string :
[+proj=latlong +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0]
Number of points: 858

so it looks like my projection is close, but not identical.

When I try to spTransform() the proj4string in barabay,

spTransform(barabay, CRS("+proj=latlong +datum=WGS84 +ellps=WGS84
+towgs84=0,0,0"))

R prints out the object of barabay, including all of the lat/long values
associated with the polygons.  I noticed that in the Slot "proj4string" of
the barabay that my CRS arguments match those of my sightcoords, but when I
ask for

over(sightcoords, barabay)

I get the following error message:

Error: identicalCRS(x, y) is not TRUE

A summary(barabay) gives me:

Object of class SpatialPolygonsDataFrame
Coordinates:
        min       max
x -90.15208 -89.73317
y  29.18969  29.49023
Is projected: FALSE
proj4string :
[+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0]
Data attributes:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
    1.0     1.5     2.0     2.0     2.5     3.0

In the proj4string associated with barabay, what does the +no_defs mean?

Thanks for your guidance -

SR

Steven H. Ranney


On Tue, Apr 9, 2013 at 7:28 AM, Samuel Turgeon <sturgeo...@gmail.com> wrote:

> Hi Steven,
>
> You should check the projections of your datasets (summary()).
>
> When I do the same kind of analyses, I use:
>
> readOGR(), to read the shp
> proj4string(), to assign a projection
> overlay(), to make spatial overlay analysis
> spplot(), to plot more than one spatial layer
>
> hope this help
>
> Sam
>
>
> On Tue, Apr 9, 2013 at 9:10 AM, Steven Ranney <steven.ran...@gmail.com>wrote:
>
>> All -
>>
>> My apologies for what is likely a neophyte questions but I'm new to
>> spatial
>> plotting in R and to .shp files in general.  I don't know all the
>> terminology which makes reading the help files that much more difficult.
>>
>> I've been asked to do a "point.in.polygon" analysis of some dolphin
>> resighting data.  I have recapture coordinates for these sightings and can
>> convert them into SpatialPoints() objects.  I have a .shp file (along with
>> all of the ancillary files that go with a .shp: .prj, .dbf, .sbn, .sbx,
>> .shx, .xml) with three different polygons.  I read in the .shp file with
>> readShapePoly().  I can plot the .shp and the coordinates independently
>> but
>> when I ask for an over() of the coordinates and polygons, I get "NA" for
>> each of my resighting events.
>>
>> I'm sure my inability to do what I thought was a simply analyses has to do
>> with my lack of familiarity with the spatial side of R.  Can anyone give
>> me
>> a hand with this?  I'd like to be able to share data but unfortunately
>> it's
>> rather sensitive and will be part of a litigation.
>>
>> Thanks in advance for your assistance.
>>
>> SR
>> Steven H. Ranney
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>

        [[alternative HTML version deleted]]

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

Reply via email to