Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDAL Error 6: GEOS support not enabled #1207

Closed
pieterprovoost opened this issue Nov 29, 2019 · 3 comments
Closed

GDAL Error 6: GEOS support not enabled #1207

pieterprovoost opened this issue Nov 29, 2019 · 3 comments

Comments

@pieterprovoost
Copy link

pieterprovoost commented Nov 29, 2019

I'm trying to use st_wrap_dateline which fails with GDAL Error 6: GEOS support not enabled. I tried reinstalling sf from source following #847 but without success. I'm on macOS Catalina.

R CMD INSTALL sf-0.6-3.tar.gz --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/Versions/2.2/unix/bin/gdal-config -with-geos-config=/Library/Frameworks/GEOS.framework/Versions/3B/unix/bin/geos-config'
Warning in untar2(tarfile, files, list, exdir, restore_times) :
  skipping pax global extended headers
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library’
* installing *source* package ‘sf’ ...
configure: CC: clang
configure: CXX: clang++ -std=gnu++11
configure: gdal-config set to /Library/Frameworks/GDAL.framework/Versions/2.2/unix/bin/gdal-config
checking gdal-config exists... yes
checking gdal-config executable... yes
checking gdal-config usability... yes
configure: GDAL: 2.2.4
checking GDAL version >= 2.0.0... yes
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /Library/Frameworks/GDAL.framework/Versions/2.2/Resources/gdal/pcs.csv readable... yes
checking GDAL: checking whether PROJ.4 is available for linking:... no
Undefined symbols for architecture x86_64:
  "OGRCreateCoordinateTransformation(OGRSpatialReference const*, OGRSpatialReference const*)", referenced from:
      _main in gdal_proj-0bb25b.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure: Install failure: compilation and/or linkage problems.
configure: error: cannot link projection code
ERROR: configuration failed for package ‘sf’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/sf’
@rsbivand
Copy link
Member

Your problem is that you do not have the full set of external software, so you cannot follow the earlier resolution. You did not say how you installed the version of sf using a GDAL version built without GEOS.

The underlying problem you report is that GDAL itself was not built with GEOS support. If you say install the CRAN OSX binary, you can check whether GEOS is available through GDAL with sf::sf_extSoftVersion(), for me not (ever) on OSX:

> sf_extSoftVersion()
          GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H 
       "3.8.0"        "3.0.2"        "6.2.1"         "true"         "true" 

Try the CRAN OSX binary first, maybe its GDAL is built with GEOS.

@pieterprovoost
Copy link
Author

I forgot to mention that I installed GDAL 2.2 Complete from https://www.kyngchaos.com/software/frameworks/. I previously installed sf from CRAN but that does not give me GEOS support:

> install.packages("sf")
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5/sf_0.8-0.tgz'
Content type 'application/x-gzip' length 53678094 bytes (51.2 MB)
==================================================
downloaded 51.2 MB


The downloaded binary packages are in
	/var/folders/6v/r68tqv6s0gj23sjb3cf4qxtr0000gn/T//Rtmp8noNxF/downloaded_packages
> library(sf)
Linking to GEOS 3.7.2, GDAL 2.4.2, PROJ 5.2.0
Warning message:
package ‘sf’ was built under R version 3.5.2 
> sf_extSoftVersion()
          GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H 
       "3.7.2"        "2.4.2"        "5.2.0"        "false"        "false" 

@rsbivand
Copy link
Member

OK, thanks, that is clear. So you'll have to find a way to install the missing PROJ component(s) shown in your configure output. https://github.com/r-spatial/sf refers to using brew, naming Kyngchaos as an alternative. Maybe try that or search the sf issues for tips on installing from source on OSX. As I never use OSX, I can't try for you, sorry.

If nothing works, coerce your objects (as(x, "Spatial") back to sp/rgeos for equivalent functionality in maptools::nowrapRecenter() or similar using rgeos, see http://maptools.r-forge.r-project.org/reference/nowrapRecenter.html. This uses just GEOS in rgeos, so GDAL does not need to be built with GEOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants