RGEOS ERROR

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

RGEOS ERROR

Girija Kalyani
working configuration:
R-3.1.1
WIN-64
goal: want to perfrom ploygon clipping, giving bounding box values of my
study area and extract the area from world map.
 I followed:

> clip.extent <- as(extent(76.3700, 31.7439, 78.6541, 33.2653), "SpatialPolygons")

> proj4string(clip.extent) <- CRS(proj4string(WorldMap))> LSMap <- gIntersection(WorldMap, clip.extent, byid = TRUE)

Error :

In RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_not_poly,
"rgeos_intersection") :
  spgeom1 and spgeom2 have different proj4 strings


Any help or assistance would be highly obliged

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: RGEOS ERROR

Pascal Oettli-2
What is WorldMap? From where does it come?

Regards,
Pascal

On Tue, Sep 2, 2014 at 2:37 PM, Girija Kalyani <[hidden email]> wrote:

> working configuration:
> R-3.1.1
> WIN-64
> goal: want to perfrom ploygon clipping, giving bounding box values of my
> study area and extract the area from world map.
>  I followed:
>
>> clip.extent <- as(extent(76.3700, 31.7439, 78.6541, 33.2653), "SpatialPolygons")
>
>> proj4string(clip.extent) <- CRS(proj4string(WorldMap))> LSMap <- gIntersection(WorldMap, clip.extent, byid = TRUE)
>
> Error :
>
> In RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_not_poly,
> "rgeos_intersection") :
>   spgeom1 and spgeom2 have different proj4 strings
>
>
> Any help or assistance would be highly obliged
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



--
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: RGEOS ERROR

Michael Sumner-2
In reply to this post by Girija Kalyani
I suspect you are seeing old code in rgeos. Please upgrade.  If you cannot
do that, try a few other things like

## since you obviously have raster loaded

projection(clip.extent) <- projection(WorldMap)

LSMap <- gIntersection(WorldMap, clip.extent, byid = TRUE)

Does that work? If not possibly

projection(clip.extent) <- as.character(NA)

projection(WorldMap) <- as.character(NA)

LSMap <- gIntersection(WorldMap, clip.extent, byid = TRUE)
I just cannot verify those because I am up to date.

Cheers, Mike

Here's what I can do with rgeos  0.3-6:

## please declare your environment btw

library(maptools)

library(raster)

library(rgeos)

data(wrld_simpl)

clip.extent <- as(extent(76.3700, 31.7439, 78.6541, 33.2653),
"SpatialPolygons")

## this works, albeit with a warning

amap <- gIntersection(wrld_simpl, clip.extent, byid = TRUE)

## this does also work

proj4string(clip.extent) <- CRS(proj4string(amap))

amap <- gIntersection(wrld_simpl, clip.extent, byid = TRUE)

sessionInfo()

R version 3.1.1 (2014-07-10)

Platform: x86_64-w64-mingw32/x64 (64-bit)


locale:

[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252

[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C

[5] LC_TIME=English_Australia.1252


attached base packages:

[1] stats     graphics  grDevices utils     datasets  compiler  methods

[8] base


other attached packages:

[1] rgeos_0.3-6     raster_2.2-31   maptools_0.8-30 sp_1.0-15


loaded via a namespace (and not attached):

[1] foreign_0.8-61  grid_3.1.1      lattice_0.20-29 tools_3.1.1


On 2 Sep 2014 16:09, "Girija Kalyani" <[hidden email]> wrote:

> working configuration:
> R-3.1.1
> WIN-64
> goal: want to perfrom ploygon clipping, giving bounding box values of my
> study area and extract the area from world map.
>  I followed:
>
> > clip.extent <- as(extent(76.3700, 31.7439, 78.6541, 33.2653),
> "SpatialPolygons")
>
> > proj4string(clip.extent) <- CRS(proj4string(WorldMap))> LSMap <-
> gIntersection(WorldMap, clip.extent, byid = TRUE)
>
> Error :
>
> In RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_not_poly,
> "rgeos_intersection") :
>   spgeom1 and spgeom2 have different proj4 strings
>
>
> Any help or assistance would be highly obliged
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: RGEOS ERROR

Pascal Oettli-2
In reply to this post by Pascal Oettli-2
Please keep your reply inside the thread. Anyway, it doesn't anwer the question.

Regards,
Pascal

On Tue, Sep 2, 2014 at 7:18 PM, Girija Kalyani <[hidden email]> wrote:

> Sir,
> The worldmap i here refer to is , the shape file of the complete world map
>
>
>
> On Tue, Sep 2, 2014 at 12:09 PM, Pascal Oettli <[hidden email]> wrote:
>>
>> What is WorldMap? From where does it come?
>>
>> Regards,
>> Pascal
>>
>> On Tue, Sep 2, 2014 at 2:37 PM, Girija Kalyani <[hidden email]>
>> wrote:
>> > working configuration:
>> > R-3.1.1
>> > WIN-64
>> > goal: want to perfrom ploygon clipping, giving bounding box values of my
>> > study area and extract the area from world map.
>> >  I followed:
>> >
>> >> clip.extent <- as(extent(76.3700, 31.7439, 78.6541, 33.2653),
>> >> "SpatialPolygons")
>> >
>> >> proj4string(clip.extent) <- CRS(proj4string(WorldMap))> LSMap <-
>> >> gIntersection(WorldMap, clip.extent, byid = TRUE)
>> >
>> > Error :
>> >
>> > In RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_not_poly,
>> > "rgeos_intersection") :
>> >   spgeom1 and spgeom2 have different proj4 strings
>> >
>> >
>> > Any help or assistance would be highly obliged
>> >
>> >         [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > [hidden email] mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide
>> > http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
>> --
>> Pascal Oettli
>> Project Scientist
>> JAMSTEC
>> Yokohama, Japan
>
>
>
>
> --
> :) Smile is my Style :)



--
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: RGEOS ERROR

Girija Kalyani
Thanx for the reply.
It is solved.
It is just a sample file whose dimensions are clipped.
Thanx


On Tue, Sep 2, 2014 at 4:19 PM, Pascal Oettli <[hidden email]> wrote:

> Please keep your reply inside the thread. Anyway, it doesn't anwer the
> question.
>
> Regards,
> Pascal
>
> On Tue, Sep 2, 2014 at 7:18 PM, Girija Kalyani <[hidden email]>
> wrote:
> > Sir,
> > The worldmap i here refer to is , the shape file of the complete world
> map
> >
> >
> >
> > On Tue, Sep 2, 2014 at 12:09 PM, Pascal Oettli <[hidden email]> wrote:
> >>
> >> What is WorldMap? From where does it come?
> >>
> >> Regards,
> >> Pascal
> >>
> >> On Tue, Sep 2, 2014 at 2:37 PM, Girija Kalyani <[hidden email]
> >
> >> wrote:
> >> > working configuration:
> >> > R-3.1.1
> >> > WIN-64
> >> > goal: want to perfrom ploygon clipping, giving bounding box values of
> my
> >> > study area and extract the area from world map.
> >> >  I followed:
> >> >
> >> >> clip.extent <- as(extent(76.3700, 31.7439, 78.6541, 33.2653),
> >> >> "SpatialPolygons")
> >> >
> >> >> proj4string(clip.extent) <- CRS(proj4string(WorldMap))> LSMap <-
> >> >> gIntersection(WorldMap, clip.extent, byid = TRUE)
> >> >
> >> > Error :
> >> >
> >> > In RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_not_poly,
> >> > "rgeos_intersection") :
> >> >   spgeom1 and spgeom2 have different proj4 strings
> >> >
> >> >
> >> > Any help or assistance would be highly obliged
> >> >
> >> >         [[alternative HTML version deleted]]
> >> >
> >> > ______________________________________________
> >> > [hidden email] mailing list
> >> > https://stat.ethz.ch/mailman/listinfo/r-help
> >> > PLEASE do read the posting guide
> >> > http://www.R-project.org/posting-guide.html
> >> > and provide commented, minimal, self-contained, reproducible code.
> >>
> >>
> >>
> >> --
> >> Pascal Oettli
> >> Project Scientist
> >> JAMSTEC
> >> Yokohama, Japan
> >
> >
> >
> >
> > --
> > :) Smile is my Style :)
>
>
>
> --
> Pascal Oettli
> Project Scientist
> JAMSTEC
> Yokohama, Japan
>



--
:) Smile is my Style :)

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.