Compile sf in windows with liblwgeom

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

Compile sf in windows with liblwgeom

Eduardo Diez
Dear list,
I have a MULTIPOLYGON geometry set where the rings are in the wrong
direction and would like to correct that with *st_make_valid*. As I'm in
Windows and use the binary version of the *sf* package it gives me the
error:

> sp2 = st_make_valid(sp1)
Error in CPL_make_valid(x) :
  st_make_valid requires compilation against liblwgeom

Is there a series of steps I can follow for compiling *sf* in Windows
linked to liblwgeom?

Thanks

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Compile sf in windows with liblwgeom

edzer


On 16/09/17 15:20, Eduardo Diez wrote:

> Dear list,
> I have a MULTIPOLYGON geometry set where the rings are in the wrong
> direction and would like to correct that with *st_make_valid*. As I'm in
> Windows and use the binary version of the *sf* package it gives me the
> error:
>
>> sp2 = st_make_valid(sp1)
> Error in CPL_make_valid(x) :
>   st_make_valid requires compilation against liblwgeom
>
> Is there a series of steps I can follow for compiling *sf* in Windows
> linked to liblwgeom?
No, and I also don't think that st_make_valid does this.

Converting to sp and back, like

st_as_sf(as(sp1, "Spatial"))

might do the trick, though.

>
> Thanks
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Edzer Pebesma
Institute for Geoinformatics  (ifgi),  University of Münster
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/


_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

signature.asc (484 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Compile sf in windows with liblwgeom

Barry Rowlingson
On Sat, Sep 16, 2017 at 3:45 PM, Edzer Pebesma <
[hidden email]> wrote:

>
>
> On 16/09/17 15:20, Eduardo Diez wrote:
> > Dear list,
> > I have a MULTIPOLYGON geometry set where the rings are in the wrong
> > direction and would like to correct that with *st_make_valid*. As I'm in
> > Windows and use the binary version of the *sf* package it gives me the
> > error:
> >
> >> sp2 = st_make_valid(sp1)
> > Error in CPL_make_valid(x) :
> >   st_make_valid requires compilation against liblwgeom
> >
> > Is there a series of steps I can follow for compiling *sf* in Windows
> > linked to liblwgeom?
>
> No, and I also don't think that st_make_valid does this.
>
>
st_make_valid certainly did something:

https://gis.stackexchange.com/questions/254836/sf-lines-to-polygons-with-holes

I've just added an edit to my answer there with the sp-and-back round trip,
which seems to work, but its not exactly the most satisfying solution.

What's the problem with liblwgeom on Windows?

Barry

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Compile sf in windows with liblwgeom

edzer


On 16/09/17 18:22, Barry Rowlingson wrote:

>
>
> On Sat, Sep 16, 2017 at 3:45 PM, Edzer Pebesma
> <[hidden email] <mailto:[hidden email]>>
> wrote:
>
>
>
>     On 16/09/17 15:20, Eduardo Diez wrote:
>     > Dear list,
>     > I have a MULTIPOLYGON geometry set where the rings are in the wrong
>     > direction and would like to correct that with *st_make_valid*. As I'm in
>     > Windows and use the binary version of the *sf* package it gives me the
>     > error:
>     >
>     >> sp2 = st_make_valid(sp1)
>     > Error in CPL_make_valid(x) :
>     >   st_make_valid requires compilation against liblwgeom
>     >
>     > Is there a series of steps I can follow for compiling *sf* in Windows
>     > linked to liblwgeom?
>
>     No, and I also don't think that st_make_valid does this.
>
>
> st_make_valid certainly did something:
>
> https://gis.stackexchange.com/questions/254836/sf-lines-to-polygons-with-holes
I only tried a single outer ring in both directions, and it didn't
revert them. Maybe it only reverts if if outer and inner ring have the
same direction.

>
> I've just added an edit to my answer there with the sp-and-back round
> trip, which seems to work, but its not exactly the most satisfying solution.

It would be fairly trivial to move some of the code to sf - at a
performance penalty if we'd do the check always, like sp does.

>
> What's the problem with liblwgeom on Windows?

It's not part of the rwinlib collection at https://github.com/rwinlib ;
I'll bring it up with Jeroen next time I see him. lwgeom has more good
things than what sf uses.

>
> Barry
>

--
Edzer Pebesma
Institute for Geoinformatics  (ifgi),  University of Münster
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/


_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

signature.asc (484 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Compile sf in windows with liblwgeom

edzer


On 17/09/17 00:07, Edzer Pebesma wrote:

>
>
> On 16/09/17 18:22, Barry Rowlingson wrote:
>>
>>
>> On Sat, Sep 16, 2017 at 3:45 PM, Edzer Pebesma
>> <[hidden email] <mailto:[hidden email]>>
>> wrote:
>>
>>
>>
>>     On 16/09/17 15:20, Eduardo Diez wrote:
>>     > Dear list,
>>     > I have a MULTIPOLYGON geometry set where the rings are in the wrong
>>     > direction and would like to correct that with *st_make_valid*. As I'm in
>>     > Windows and use the binary version of the *sf* package it gives me the
>>     > error:
>>     >
>>     >> sp2 = st_make_valid(sp1)
>>     > Error in CPL_make_valid(x) :
>>     >   st_make_valid requires compilation against liblwgeom
>>     >
>>     > Is there a series of steps I can follow for compiling *sf* in Windows
>>     > linked to liblwgeom?
>>
>>     No, and I also don't think that st_make_valid does this.
>>
>>
>> st_make_valid certainly did something:
>>
>> https://gis.stackexchange.com/questions/254836/sf-lines-to-polygons-with-holes
>
> I only tried a single outer ring in both directions, and it didn't
> revert them. Maybe it only reverts if if outer and inner ring have the
> same direction.
>
>>
>> I've just added an edit to my answer there with the sp-and-back round
>> trip, which seems to work, but its not exactly the most satisfying solution.
>
> It would be fairly trivial to move some of the code to sf - at a
> performance penalty if we'd do the check always, like sp does.
>
>>
>> What's the problem with liblwgeom on Windows?
>
> It's not part of the rwinlib collection at https://github.com/rwinlib ;
> I'll bring it up with Jeroen next time I see him. lwgeom has more good
> things than what sf uses.
liblwgeom is part of the postgis source tree in
https://github.com/postgis/postgis , but when configuring that with

./autogen.sh
./configure --without-pgconfig

liblwgeom becomes the sole build target.

The few dependencies it has (geos, proj, json-c) are, AFAICT, all
already in rwinlib/gdal2

>
>>
>> Barry
>>
>
>
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Edzer Pebesma
Institute for Geoinformatics  (ifgi),  University of Münster
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/


_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

signature.asc (484 bytes) Download Attachment