Skip to content

Commit

Permalink
fixes #2166
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Sep 14, 2023
1 parent a2a3ec4 commit 21d385a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# version 1.0-15

* `st_transform()` properly responds to in-session changes to `sf_proj_network()`; #2166

* `plot.sf()`: `key.width` is sensitive to pointsize graphics parameter `par("ps")`; keys with factor levels suggest a proper size if they won't fit.

* `plot.sf()`: `key.pos` can hold a second value in [0, 1] determining the relative position of the key in the available space
Expand Down
8 changes: 8 additions & 0 deletions src/proj.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <iostream>

#include <ogr_srs_api.h>

#include "Rcpp.h"

// [[Rcpp::export]]
Expand Down Expand Up @@ -197,11 +199,17 @@ Rcpp::CharacterVector CPL_enable_network(Rcpp::CharacterVector url, bool enable
#ifdef HAVE_71
if (enable) {
proj_context_set_enable_network(PJ_DEFAULT_CTX, 1);
#if GDAL_VERSION_NUM >= 3040000
OSRSetPROJEnableNetwork(1);
#endif
if (url.size())
proj_context_set_url_endpoint(PJ_DEFAULT_CTX, url[0]);
return Rcpp::CharacterVector::create(proj_context_get_url_endpoint(PJ_DEFAULT_CTX));
} else { // disable:
proj_context_set_enable_network(PJ_DEFAULT_CTX, 0);
#if GDAL_VERSION_NUM >= 3040000
OSRSetPROJEnableNetwork(0);
#endif
return Rcpp::CharacterVector::create();
}
#else
Expand Down
8 changes: 4 additions & 4 deletions tests/spatstat.Rout.save
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

Expand Down Expand Up @@ -125,8 +125,8 @@ Type 'q()' to quit R.
+ (y = st_as_sfc(as.psp(sf)))
+ all.equal(st_geometry(x), y)
+ }
spatstat.geom 3.2-1
spatstat.random 3.1-5
spatstat.geom 3.2-5
spatstat.random 3.1-6
Simple feature collection with 51 features and 1 field
Geometry type: GEOMETRY
Dimension: XY
Expand Down Expand Up @@ -166,4 +166,4 @@ In st_as_sfc.owin(spatstat.geom::as.owin(x)) :
>
> proc.time()
user system elapsed
2.366 0.868 2.343
2.011 0.116 2.121

0 comments on commit 21d385a

Please sign in to comment.