rgeo-proj4 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/proj4_c_impl/main.c +26 -19
- data/lib/rgeo/proj4/version.rb +1 -1
- metadata +8 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa9c25a9c28360d481e136fd0d8da64c88a9c0f4018f496ddaee88d1ed5ffc75
|
|
4
|
+
data.tar.gz: 332437030fe6111853cf0d3384a267f15470f807ce548abb4f09ba7481cae275
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b4a5789391e027f5130877d638dd2013e0b4b144683c179877d50387797919d8998ef900d832a9664774a8633a483b91653fad0439e98481c95de014c790641a
|
|
7
|
+
data.tar.gz: a81cc3dabdec13ceb6b5839e0023a268dce470a25e8ee311a61f58f309e51058b14aa11c16ee1e3dd39ad93c82d501fff6103b937b190db39f7b9c5ef96338fe
|
data/ext/proj4_c_impl/main.c
CHANGED
|
@@ -32,6 +32,10 @@ typedef struct {
|
|
|
32
32
|
PJ *crs_to_crs;
|
|
33
33
|
} RGeo_CRSToCRSData;
|
|
34
34
|
|
|
35
|
+
// PROJ context for multithreaded environments. This avoids segfaults or
|
|
36
|
+
// hanging processes on fork. We only use one context, initialized on load.
|
|
37
|
+
static PJ_CONTEXT *local_proj_context;
|
|
38
|
+
|
|
35
39
|
// Destroy function for proj data.
|
|
36
40
|
static void rgeo_proj4_free(void *ptr) {
|
|
37
41
|
RGeo_Proj4Data *data = (RGeo_Proj4Data *)ptr;
|
|
@@ -153,11 +157,12 @@ static VALUE method_proj4_initialize_copy(VALUE self, VALUE orig) {
|
|
|
153
157
|
// Copy value from orig
|
|
154
158
|
TypedData_Get_Struct(orig, RGeo_Proj4Data, &rgeo_proj4_data_type, orig_data);
|
|
155
159
|
if (!NIL_P(orig_data->original_str)) {
|
|
156
|
-
self_data->pj =
|
|
157
|
-
|
|
160
|
+
self_data->pj = proj_create(local_proj_context,
|
|
161
|
+
StringValuePtr(orig_data->original_str));
|
|
158
162
|
} else {
|
|
159
|
-
str =
|
|
160
|
-
|
|
163
|
+
str =
|
|
164
|
+
proj_as_proj_string(local_proj_context, orig_data->pj, PJ_PROJ_4, NULL);
|
|
165
|
+
self_data->pj = proj_create(local_proj_context, str);
|
|
161
166
|
}
|
|
162
167
|
self_data->original_str = orig_data->original_str;
|
|
163
168
|
self_data->uses_radians = orig_data->uses_radians;
|
|
@@ -175,7 +180,7 @@ static VALUE method_proj4_set_value(VALUE self, VALUE str, VALUE uses_radians) {
|
|
|
175
180
|
rgeo_proj4_clear_struct(self_data);
|
|
176
181
|
|
|
177
182
|
// Set new data
|
|
178
|
-
self_data->pj = proj_create(
|
|
183
|
+
self_data->pj = proj_create(local_proj_context, StringValuePtr(str));
|
|
179
184
|
self_data->original_str = str;
|
|
180
185
|
self_data->uses_radians = RTEST(uses_radians) ? 1 : 0;
|
|
181
186
|
|
|
@@ -194,7 +199,8 @@ static VALUE method_proj4_get_geographic(VALUE self) {
|
|
|
194
199
|
TypedData_Get_Struct(self, RGeo_Proj4Data, &rgeo_proj4_data_type,
|
|
195
200
|
self_data);
|
|
196
201
|
|
|
197
|
-
geographic_proj =
|
|
202
|
+
geographic_proj =
|
|
203
|
+
proj_crs_get_geodetic_crs(local_proj_context, self_data->pj);
|
|
198
204
|
if (geographic_proj == 0) {
|
|
199
205
|
FREE(new_data);
|
|
200
206
|
rb_raise(rb_eRGeoInvalidProjectionError,
|
|
@@ -233,7 +239,7 @@ static VALUE method_proj4_canonical_str(VALUE self) {
|
|
|
233
239
|
TypedData_Get_Struct(self, RGeo_Proj4Data, &rgeo_proj4_data_type, data);
|
|
234
240
|
pj = data->pj;
|
|
235
241
|
if (pj) {
|
|
236
|
-
str = proj_as_proj_string(
|
|
242
|
+
str = proj_as_proj_string(local_proj_context, pj, PJ_PROJ_4, NULL);
|
|
237
243
|
if (str) {
|
|
238
244
|
result = rb_str_new2(str);
|
|
239
245
|
}
|
|
@@ -252,7 +258,7 @@ static VALUE method_proj4_wkt_str(VALUE self) {
|
|
|
252
258
|
pj = data->pj;
|
|
253
259
|
if (pj) {
|
|
254
260
|
const char *const options[] = {"MULTILINE=NO", NULL};
|
|
255
|
-
str = proj_as_wkt(
|
|
261
|
+
str = proj_as_wkt(local_proj_context, pj, WKT_TYPE, options);
|
|
256
262
|
if (str) {
|
|
257
263
|
result = rb_str_new2(str);
|
|
258
264
|
}
|
|
@@ -297,9 +303,9 @@ static VALUE method_proj4_axis_and_unit_info_str(VALUE self, VALUE dimension) {
|
|
|
297
303
|
TypedData_Get_Struct(self, RGeo_Proj4Data, &rgeo_proj4_data_type, data);
|
|
298
304
|
pj = data->pj;
|
|
299
305
|
if (pj) {
|
|
300
|
-
pj_cs = proj_crs_get_coordinate_system(
|
|
306
|
+
pj_cs = proj_crs_get_coordinate_system(local_proj_context, pj);
|
|
301
307
|
if (pj_cs) {
|
|
302
|
-
if (proj_cs_get_axis_info(
|
|
308
|
+
if (proj_cs_get_axis_info(local_proj_context, pj_cs, dimension_index,
|
|
303
309
|
&axis_info, NULL, NULL, NULL, &unit_name, NULL,
|
|
304
310
|
NULL)) {
|
|
305
311
|
result = rb_sprintf("%s:%s", axis_info, unit_name);
|
|
@@ -322,9 +328,9 @@ static VALUE method_proj4_axis_count(VALUE self) {
|
|
|
322
328
|
TypedData_Get_Struct(self, RGeo_Proj4Data, &rgeo_proj4_data_type, data);
|
|
323
329
|
pj = data->pj;
|
|
324
330
|
if (pj) {
|
|
325
|
-
pj_cs = proj_crs_get_coordinate_system(
|
|
331
|
+
pj_cs = proj_crs_get_coordinate_system(local_proj_context, pj);
|
|
326
332
|
if (pj_cs) {
|
|
327
|
-
count = proj_cs_get_axis_count(
|
|
333
|
+
count = proj_cs_get_axis_count(local_proj_context, pj_cs);
|
|
328
334
|
result = INT2FIX(count);
|
|
329
335
|
|
|
330
336
|
proj_destroy(pj_cs);
|
|
@@ -412,7 +418,7 @@ static VALUE cmethod_proj4_create(VALUE klass, VALUE str, VALUE uses_radians) {
|
|
|
412
418
|
Check_Type(str, T_STRING);
|
|
413
419
|
data = ALLOC(RGeo_Proj4Data);
|
|
414
420
|
if (data) {
|
|
415
|
-
data->pj = proj_create(
|
|
421
|
+
data->pj = proj_create(local_proj_context, StringValuePtr(str));
|
|
416
422
|
data->original_str = str;
|
|
417
423
|
data->uses_radians = RTEST(uses_radians) ? 1 : 0;
|
|
418
424
|
result = TypedData_Wrap_Struct(klass, &rgeo_proj4_data_type, data);
|
|
@@ -435,8 +441,8 @@ static VALUE cmethod_crs_to_crs_create(VALUE klass, VALUE from, VALUE to) {
|
|
|
435
441
|
TypedData_Get_Struct(to, RGeo_Proj4Data, &rgeo_proj4_data_type, to_data);
|
|
436
442
|
from_pj = from_data->pj;
|
|
437
443
|
to_pj = to_data->pj;
|
|
438
|
-
crs_to_crs =
|
|
439
|
-
|
|
444
|
+
crs_to_crs = proj_create_crs_to_crs_from_pj(local_proj_context, from_pj,
|
|
445
|
+
to_pj, 0, NULL);
|
|
440
446
|
|
|
441
447
|
// check for invalid transformation
|
|
442
448
|
if (crs_to_crs == 0) {
|
|
@@ -447,7 +453,7 @@ static VALUE cmethod_crs_to_crs_create(VALUE klass, VALUE from, VALUE to) {
|
|
|
447
453
|
// necessary to use proj_normalize_for_visualization so that we
|
|
448
454
|
// do not have to worry about the order of coordinates in every
|
|
449
455
|
// coord system
|
|
450
|
-
gis_pj = proj_normalize_for_visualization(
|
|
456
|
+
gis_pj = proj_normalize_for_visualization(local_proj_context, crs_to_crs);
|
|
451
457
|
if (gis_pj) {
|
|
452
458
|
proj_destroy(crs_to_crs);
|
|
453
459
|
crs_to_crs = gis_pj;
|
|
@@ -503,7 +509,7 @@ static VALUE method_crs_to_crs_wkt_str(VALUE self) {
|
|
|
503
509
|
crs_to_crs_pj = crs_to_crs_data->crs_to_crs;
|
|
504
510
|
if (crs_to_crs_pj) {
|
|
505
511
|
const char *const options[] = {"MULTILINE=NO", NULL};
|
|
506
|
-
str = proj_as_wkt(
|
|
512
|
+
str = proj_as_wkt(local_proj_context, crs_to_crs_pj, WKT_TYPE, options);
|
|
507
513
|
if (str) {
|
|
508
514
|
result = rb_str_new2(str);
|
|
509
515
|
}
|
|
@@ -522,8 +528,8 @@ static VALUE method_crs_to_crs_area_of_use_str(VALUE self) {
|
|
|
522
528
|
crs_to_crs_data);
|
|
523
529
|
crs_to_crs_pj = crs_to_crs_data->crs_to_crs;
|
|
524
530
|
if (crs_to_crs_pj) {
|
|
525
|
-
if (proj_get_area_of_use(
|
|
526
|
-
NULL, &str)) {
|
|
531
|
+
if (proj_get_area_of_use(local_proj_context, crs_to_crs_pj, NULL, NULL,
|
|
532
|
+
NULL, NULL, &str)) {
|
|
527
533
|
result = rb_str_new2(str);
|
|
528
534
|
}
|
|
529
535
|
}
|
|
@@ -639,6 +645,7 @@ static void rgeo_init_proj4() {
|
|
|
639
645
|
|
|
640
646
|
void Init_proj4_c_impl() {
|
|
641
647
|
#ifdef RGEO_PROJ4_SUPPORTED
|
|
648
|
+
local_proj_context = proj_context_create();
|
|
642
649
|
rgeo_init_proj4();
|
|
643
650
|
rgeo_init_proj_errors();
|
|
644
651
|
#endif
|
data/lib/rgeo/proj4/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rgeo-proj4
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tee Parham, Daniel Azuma, Keith Doggett, Ulysse Buonomo
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2026-04-28 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rgeo
|
|
@@ -16,14 +15,14 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - "~>"
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 3.
|
|
18
|
+
version: 3.1.0
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - "~>"
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 3.
|
|
25
|
+
version: 3.1.0
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
27
|
name: ffi-geos
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -86,14 +85,14 @@ dependencies:
|
|
|
86
85
|
requirements:
|
|
87
86
|
- - "~>"
|
|
88
87
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 1.
|
|
88
|
+
version: 1.82.1
|
|
90
89
|
type: :development
|
|
91
90
|
prerelease: false
|
|
92
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
92
|
requirements:
|
|
94
93
|
- - "~>"
|
|
95
94
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: 1.
|
|
95
|
+
version: 1.82.1
|
|
97
96
|
- !ruby/object:Gem::Dependency
|
|
98
97
|
name: ruby_memcheck
|
|
99
98
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -131,7 +130,6 @@ homepage: https://github.com/rgeo/rgeo-proj4
|
|
|
131
130
|
licenses:
|
|
132
131
|
- MIT
|
|
133
132
|
metadata: {}
|
|
134
|
-
post_install_message:
|
|
135
133
|
rdoc_options: []
|
|
136
134
|
require_paths:
|
|
137
135
|
- lib
|
|
@@ -139,15 +137,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
139
137
|
requirements:
|
|
140
138
|
- - ">="
|
|
141
139
|
- !ruby/object:Gem::Version
|
|
142
|
-
version:
|
|
140
|
+
version: 3.1.4
|
|
143
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
142
|
requirements:
|
|
145
143
|
- - ">="
|
|
146
144
|
- !ruby/object:Gem::Version
|
|
147
145
|
version: '0'
|
|
148
146
|
requirements: []
|
|
149
|
-
rubygems_version: 3.
|
|
150
|
-
signing_key:
|
|
147
|
+
rubygems_version: 3.6.4
|
|
151
148
|
specification_version: 4
|
|
152
149
|
summary: Proj4 extension for rgeo.
|
|
153
150
|
test_files: []
|