simple-proj 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -1
- data/ext/extconf.rb +1 -1
- data/ext/mkmf.log +18 -0
- data/ext/rb_proj.c +212 -21
- data/lib/simple-proj.rb +29 -1
- data/simple-proj.gemspec +2 -1
- data/spec/proj_spec.rb +18 -0
- metadata +26 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47aef9c67ff6e5451d16b1c97332a444d558b2b22e8bf2c00f7f9556e3c932ba
|
4
|
+
data.tar.gz: 34652c6bdeb579d5b94460efa2b8ad06262093f6b767773efae8aa60659b15db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b84374f89291e98cc4ae8efb79054a8ff19674a0f94f52f81ff0e33c5d7704c5acf5ba812cb6965e004dafd8cc4b8faf752a08ac846dee5d8ac929688316ce5
|
7
|
+
data.tar.gz: 82d7106b6746d6ed9eadc68d80f241f6af30fd448f23ffd64322e50a93c59fbfa2a84866e93a24ad24b4a39587f1283c4262cf85115bbe4f0597843452e15c3e
|
data/Rakefile
CHANGED
data/ext/extconf.rb
CHANGED
data/ext/mkmf.log
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
"clang -o conftest -I/Users/himotoyoshi/.rbenv/versions/2.7.5/include/ruby-2.7.0/x86_64-darwin21 -I/Users/himotoyoshi/.rbenv/versions/2.7.5/include/ruby-2.7.0/ruby/backward -I/Users/himotoyoshi/.rbenv/versions/2.7.5/include/ruby-2.7.0 -I. -I/usr/local/include -I/Users/himotoyoshi/.rbenv/versions/2.7.5/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -O2 -fno-common -pipe conftest.c -L. -L/Users/himotoyoshi/.rbenv/versions/2.7.5/lib -L/Users/himotoyoshi/lib -L/usr/local/lib -L/usr/lib -L. -L/Users/himotoyoshi/.rbenv/versions/2.7.5/lib -fstack-protector-strong -lruby.2.7 "
|
2
|
+
In file included from conftest.c:1:
|
3
|
+
In file included from /Users/himotoyoshi/.rbenv/versions/2.7.5/include/ruby-2.7.0/ruby.h:33:
|
4
|
+
In file included from /Users/himotoyoshi/.rbenv/versions/2.7.5/include/ruby-2.7.0/ruby/ruby.h:29:
|
5
|
+
/Users/himotoyoshi/.rbenv/versions/2.7.5/include/ruby-2.7.0/ruby/defines.h:126:10: fatal error: 'stdio.h' file not found
|
6
|
+
#include <stdio.h>
|
7
|
+
^~~~~~~~~
|
8
|
+
1 error generated.
|
9
|
+
checked program was:
|
10
|
+
/* begin */
|
11
|
+
1: #include "ruby.h"
|
12
|
+
2:
|
13
|
+
3: int main(int argc, char **argv)
|
14
|
+
4: {
|
15
|
+
5: return !!argv[argc];
|
16
|
+
6: }
|
17
|
+
/* end */
|
18
|
+
|
data/ext/rb_proj.c
CHANGED
@@ -51,12 +51,19 @@ The arguments should be PROJ::CRS objects or String objects one of
|
|
51
51
|
* a WKT string,
|
52
52
|
* an object code (like “EPSG:4326”, “urn:ogc:def:crs:EPSG::4326”,
|
53
53
|
“urn:ogc:def:coordinateOperation:EPSG::1671”),
|
54
|
+
* an Object name. e.g “WGS 84”, “WGS 84 / UTM zone 31N”.
|
55
|
+
In that case as uniqueness is not guaranteed,
|
56
|
+
heuristics are applied to determine the appropriate best match.
|
54
57
|
* a OGC URN combining references for compound coordinate reference
|
55
58
|
systems (e.g “urn:ogc:def:crs,crs:EPSG::2393,crs:EPSG::5717” or
|
56
59
|
custom abbreviated syntax “EPSG:2393+5717”),
|
57
60
|
* a OGC URN combining references for concatenated operations (e.g.
|
58
61
|
“urn:ogc:def:coordinateOperation,coordinateOperation:EPSG::3895,
|
59
62
|
coordinateOperation:EPSG::1618”)
|
63
|
+
* a PROJJSON string.
|
64
|
+
The jsonschema is at https://proj.org/schemas/v0.4/projjson.schema.json (added in PROJ 6.2)
|
65
|
+
* a compound CRS made from two object names separated with ” + “.
|
66
|
+
e.g. “WGS 84 + EGM96 height” (added in 7.1)
|
60
67
|
|
61
68
|
If two arguments are given, the first is the source CRS definition and the
|
62
69
|
second is the target CRS definition. If only one argument is given, the
|
@@ -257,7 +264,7 @@ rb_proj_angular_input (VALUE self, VALUE direction)
|
|
257
264
|
/*
|
258
265
|
Checks if an operation returns output in radians or not.
|
259
266
|
|
260
|
-
@return [Boolean]
|
267
|
+
@return [Boolean]
|
261
268
|
*/
|
262
269
|
|
263
270
|
static VALUE
|
@@ -321,6 +328,7 @@ rb_proj_factors (VALUE self, VALUE vlon, VALUE vlat)
|
|
321
328
|
Transforms coordinates forwardly from (lat1, lon1, z1) to (x1, y2, z2).
|
322
329
|
The order of coordinates arguments should be longitude, latitude, and height.
|
323
330
|
The input longitude and latitude should be in units 'degrees'.
|
331
|
+
If the returned coordinates are angles, they are converted in units `degrees`.
|
324
332
|
|
325
333
|
@overload forward(lon1, lat1, z1 = nil)
|
326
334
|
@param lon1 [Numeric] longitude in degrees.
|
@@ -368,6 +376,81 @@ rb_proj_forward (int argc, VALUE *argv, VALUE self)
|
|
368
376
|
rb_raise(rb_eRuntimeError, "%s", proj_errno_string(errno));
|
369
377
|
}
|
370
378
|
|
379
|
+
if ( proj_angular_output(proj->ref, PJ_FWD) == 1 ) {
|
380
|
+
if ( NIL_P(vz) ) {
|
381
|
+
return rb_assoc_new(rb_float_new(proj_todeg(data_out.lpz.lam)),
|
382
|
+
rb_float_new(proj_todeg(data_out.lpz.phi)));
|
383
|
+
} else {
|
384
|
+
return rb_ary_new3(3, rb_float_new(proj_todeg(data_out.lpz.lam)),
|
385
|
+
rb_float_new(proj_todeg(data_out.lpz.phi)),
|
386
|
+
rb_float_new(data_out.lpz.z));
|
387
|
+
}
|
388
|
+
}
|
389
|
+
else {
|
390
|
+
if ( NIL_P(vz) ) {
|
391
|
+
return rb_assoc_new(rb_float_new(data_out.xyz.x),
|
392
|
+
rb_float_new(data_out.xyz.y));
|
393
|
+
} else {
|
394
|
+
return rb_ary_new3(3, rb_float_new(data_out.xyz.x),
|
395
|
+
rb_float_new(data_out.xyz.y),
|
396
|
+
rb_float_new(data_out.xyz.z));
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
400
|
+
}
|
401
|
+
|
402
|
+
/*
|
403
|
+
Transforms coordinates forwardly from (lat1, lon1, z1) to (x1, y2, z2).
|
404
|
+
The order of coordinates arguments should be longitude, latitude, and height.
|
405
|
+
The input longitude and latitude should be in units 'degrees'.
|
406
|
+
If the returned coordinates are angles, they are treated as in units `radians`.
|
407
|
+
|
408
|
+
@overload forward(lon1, lat1, z1 = nil)
|
409
|
+
@param lon1 [Numeric] longitude in degrees.
|
410
|
+
@param lat1 [Numeric] latitude in degrees.
|
411
|
+
@param z1 [Numeric, nil] vertical coordinate.
|
412
|
+
|
413
|
+
@return x2, y2[, z2]
|
414
|
+
|
415
|
+
@example
|
416
|
+
x2, y2 = pj.forward(lon1, lat1)
|
417
|
+
x2, y2, z2 = pj.forward(lon1, lat1, z1)
|
418
|
+
|
419
|
+
*/
|
420
|
+
static VALUE
|
421
|
+
rb_proj_forward_bang (int argc, VALUE *argv, VALUE self)
|
422
|
+
{
|
423
|
+
volatile VALUE vlon, vlat, vz;
|
424
|
+
Proj *proj;
|
425
|
+
PJ_COORD data_in, data_out;
|
426
|
+
int errno;
|
427
|
+
|
428
|
+
rb_scan_args(argc, argv, "21", (VALUE*) &vlon, (VALUE*) &vlat, (VALUE*) &vz);
|
429
|
+
|
430
|
+
Data_Get_Struct(self, Proj, proj);
|
431
|
+
|
432
|
+
if ( ! proj->is_src_latlong ) {
|
433
|
+
rb_raise(rb_eRuntimeError, "requires latlong src crs. use #transform_forward instead of #forward.");
|
434
|
+
}
|
435
|
+
|
436
|
+
if ( proj_angular_input(proj->ref, PJ_FWD) == 1 ) {
|
437
|
+
data_in.lpz.lam = proj_torad(NUM2DBL(vlon));
|
438
|
+
data_in.lpz.phi = proj_torad(NUM2DBL(vlat));
|
439
|
+
data_in.lpz.z = NIL_P(vz) ? 0.0 : NUM2DBL(vz);
|
440
|
+
}
|
441
|
+
else {
|
442
|
+
data_in.xyz.x = NUM2DBL(vlon);
|
443
|
+
data_in.xyz.y = NUM2DBL(vlat);
|
444
|
+
data_in.xyz.z = NIL_P(vz) ? 0.0 : NUM2DBL(vz);
|
445
|
+
}
|
446
|
+
|
447
|
+
data_out = proj_trans(proj->ref, PJ_FWD, data_in);
|
448
|
+
|
449
|
+
if ( data_out.xyz.x == HUGE_VAL ) {
|
450
|
+
errno = proj_context_errno(PJ_DEFAULT_CTX);
|
451
|
+
rb_raise(rb_eRuntimeError, "%s", proj_errno_string(errno));
|
452
|
+
}
|
453
|
+
|
371
454
|
if ( NIL_P(vz) ) {
|
372
455
|
return rb_assoc_new(rb_float_new(data_out.xyz.x),
|
373
456
|
rb_float_new(data_out.xyz.y));
|
@@ -376,11 +459,13 @@ rb_proj_forward (int argc, VALUE *argv, VALUE self)
|
|
376
459
|
rb_float_new(data_out.xyz.y),
|
377
460
|
rb_float_new(data_out.xyz.z));
|
378
461
|
}
|
462
|
+
|
379
463
|
}
|
380
464
|
|
381
465
|
/*
|
382
466
|
Transforms coordinates inversely from (x1, y1, z1) to (lon2, lat2, z2).
|
383
467
|
The order of output coordinates is longitude, latitude and height.
|
468
|
+
If the input coordinates are angles, they are treated as being in units `degrees`.
|
384
469
|
The returned longitude and latitude are in units 'degrees'.
|
385
470
|
|
386
471
|
@overload inverse(x1, y1, z1 = nil)
|
@@ -410,6 +495,79 @@ rb_proj_inverse (int argc, VALUE *argv, VALUE self)
|
|
410
495
|
rb_raise(rb_eRuntimeError, "requires latlong src crs. use #transform_inverse instead of #inverse.");
|
411
496
|
}
|
412
497
|
|
498
|
+
if ( proj_angular_input(proj->ref, PJ_INV) == 1 ) {
|
499
|
+
data_in.lpz.lam = proj_torad(NUM2DBL(vx));
|
500
|
+
data_in.lpz.phi = proj_torad(NUM2DBL(vy));
|
501
|
+
data_in.lpz.z = NIL_P(vz) ? 0.0 : NUM2DBL(vz);
|
502
|
+
}
|
503
|
+
else {
|
504
|
+
data_in.xyz.x = NUM2DBL(vx);
|
505
|
+
data_in.xyz.y = NUM2DBL(vy);
|
506
|
+
data_in.xyz.z = NIL_P(vz) ? 0.0 : NUM2DBL(vz);
|
507
|
+
}
|
508
|
+
|
509
|
+
data_out = proj_trans(proj->ref, PJ_INV, data_in);
|
510
|
+
|
511
|
+
if ( data_out.lpz.lam == HUGE_VAL ) {
|
512
|
+
errno = proj_errno(proj->ref);
|
513
|
+
rb_raise(rb_eRuntimeError, "%s", proj_errno_string(errno));
|
514
|
+
}
|
515
|
+
|
516
|
+
if ( proj_angular_output(proj->ref, PJ_INV) == 1 ) {
|
517
|
+
if ( NIL_P(vz) ) {
|
518
|
+
return rb_assoc_new(rb_float_new(proj_todeg(data_out.lpz.lam)),
|
519
|
+
rb_float_new(proj_todeg(data_out.lpz.phi)));
|
520
|
+
} else {
|
521
|
+
return rb_ary_new3(3, rb_float_new(proj_todeg(data_out.lpz.lam)),
|
522
|
+
rb_float_new(proj_todeg(data_out.lpz.phi)),
|
523
|
+
rb_float_new(data_out.lpz.z));
|
524
|
+
}
|
525
|
+
}
|
526
|
+
else {
|
527
|
+
if ( NIL_P(vz) ) {
|
528
|
+
return rb_assoc_new(rb_float_new(data_out.xyz.x),
|
529
|
+
rb_float_new(data_out.xyz.y));
|
530
|
+
} else {
|
531
|
+
return rb_ary_new3(3, rb_float_new(data_out.xyz.x),
|
532
|
+
rb_float_new(data_out.xyz.y),
|
533
|
+
rb_float_new(data_out.xyz.z));
|
534
|
+
}
|
535
|
+
}
|
536
|
+
}
|
537
|
+
|
538
|
+
/*
|
539
|
+
Transforms coordinates inversely from (x1, y1, z1) to (lon2, lat2, z2).
|
540
|
+
The order of output coordinates is longitude, latitude and height.
|
541
|
+
If the input coordinates are angles, they are treated as being in units `radians`.
|
542
|
+
The returned longitude and latitude are in units 'degrees'.
|
543
|
+
|
544
|
+
@overload inverse(x1, y1, z1 = nil)
|
545
|
+
@param x1 [Numeric]
|
546
|
+
@param y1 [Numeric]
|
547
|
+
@param z1 [Numeric, nil]
|
548
|
+
|
549
|
+
@return lon2, lat2, [, z2]
|
550
|
+
|
551
|
+
@example
|
552
|
+
lon2, lat2 = pj.inverse(x1, y1)
|
553
|
+
lon2, lat2, z2 = pj.inverse(x1, y1, z1)
|
554
|
+
|
555
|
+
*/
|
556
|
+
static VALUE
|
557
|
+
rb_proj_inverse_bang (int argc, VALUE *argv, VALUE self)
|
558
|
+
{
|
559
|
+
volatile VALUE vx, vy, vz;
|
560
|
+
Proj *proj;
|
561
|
+
PJ_COORD data_in, data_out;
|
562
|
+
int errno;
|
563
|
+
|
564
|
+
rb_scan_args(argc, argv, "21", (VALUE *)&vx, (VALUE *)&vy, (VALUE *)&vz);
|
565
|
+
Data_Get_Struct(self, Proj, proj);
|
566
|
+
|
567
|
+
if ( ! proj->is_src_latlong ) {
|
568
|
+
rb_raise(rb_eRuntimeError, "requires latlong src crs. use #transform_inverse instead of #inverse.");
|
569
|
+
}
|
570
|
+
|
413
571
|
data_in.xyz.x = NUM2DBL(vx);
|
414
572
|
data_in.xyz.y = NUM2DBL(vy);
|
415
573
|
data_in.xyz.z = NIL_P(vz) ? 0.0 : NUM2DBL(vz);
|
@@ -681,50 +839,79 @@ rb_proj_get_id_code (int argc, VALUE *argv, VALUE self)
|
|
681
839
|
return (string) ? rb_str_new2(string) : Qnil;
|
682
840
|
}
|
683
841
|
|
684
|
-
/*
|
685
|
-
Gets a PROJJSON string representation of the object.
|
686
842
|
|
687
|
-
|
688
|
-
|
843
|
+
/*
|
844
|
+
Gets a PROJ string representation of the object.
|
845
|
+
This method may return nil if the object is not compatible with
|
846
|
+
an export to the requested type.
|
689
847
|
|
690
848
|
@return [String,nil]
|
691
849
|
*/
|
692
850
|
static VALUE
|
693
|
-
|
851
|
+
rb_proj_as_proj_string (VALUE self)
|
694
852
|
{
|
695
853
|
Proj *proj;
|
696
|
-
const char *
|
854
|
+
const char *string;
|
697
855
|
|
698
856
|
Data_Get_Struct(self, Proj, proj);
|
699
|
-
|
700
|
-
if ( !
|
857
|
+
string = proj_as_proj_string(PJ_DEFAULT_CTX, proj->ref, PJ_PROJ_5, NULL);
|
858
|
+
if ( ! string ) {
|
701
859
|
return Qnil;
|
702
860
|
}
|
703
|
-
return rb_str_new2(
|
861
|
+
return rb_str_new2(string);
|
704
862
|
}
|
705
863
|
|
864
|
+
#if PROJ_AT_LEAST_VERSION(6,2,0)
|
706
865
|
|
707
866
|
/*
|
708
|
-
Gets a
|
709
|
-
|
710
|
-
|
867
|
+
Gets a PROJJSON string representation of the object.
|
868
|
+
|
869
|
+
This method may return nil if the object is not compatible
|
870
|
+
with an export to the requested type.
|
711
871
|
|
712
872
|
@return [String,nil]
|
713
873
|
*/
|
874
|
+
|
714
875
|
static VALUE
|
715
|
-
|
876
|
+
rb_proj_as_projjson (int argc, VALUE *argv, VALUE self)
|
716
877
|
{
|
717
878
|
Proj *proj;
|
718
|
-
|
879
|
+
volatile VALUE vopts;
|
880
|
+
const char *options[4] = {NULL, NULL, NULL, NULL};
|
881
|
+
const char *json = NULL;
|
882
|
+
int i;
|
719
883
|
|
720
884
|
Data_Get_Struct(self, Proj, proj);
|
721
|
-
|
722
|
-
|
885
|
+
|
886
|
+
if ( argc == 0 ) {
|
887
|
+
json = proj_as_projjson(PJ_DEFAULT_CTX, proj->ref, NULL);
|
888
|
+
}
|
889
|
+
if ( argc > 3 ) {
|
890
|
+
rb_raise(rb_eRuntimeError, "too much options");
|
891
|
+
}
|
892
|
+
else {
|
893
|
+
for (i=0; i<argc; i++) {
|
894
|
+
Check_Type(argv[i], T_STRING);
|
895
|
+
options[i] = StringValuePtr(argv[i]);
|
896
|
+
}
|
897
|
+
json = proj_as_projjson(PJ_DEFAULT_CTX, proj->ref, options);
|
898
|
+
}
|
899
|
+
|
900
|
+
if ( ! json ) {
|
723
901
|
return Qnil;
|
724
902
|
}
|
725
|
-
return rb_str_new2(
|
903
|
+
return rb_str_new2(json);
|
726
904
|
}
|
727
905
|
|
906
|
+
#endif
|
907
|
+
|
908
|
+
|
909
|
+
/*
|
910
|
+
Gets a ellipsoid parameters of CRS definition of the object.
|
911
|
+
|
912
|
+
@return [Array] Returns Array containing semi_major_axis(m), semi_minor(m), boolean whether the semi-minor value was computed, inverse flattening.
|
913
|
+
*/
|
914
|
+
|
728
915
|
static VALUE
|
729
916
|
rb_proj_ellipsoid_get_parameters (VALUE self)
|
730
917
|
{
|
@@ -746,7 +933,7 @@ rb_proj_ellipsoid_get_parameters (VALUE self)
|
|
746
933
|
/*
|
747
934
|
Gets a WKT expression of CRS definition of the object.
|
748
935
|
|
749
|
-
@return [String]
|
936
|
+
@return [String] Returns String of WKT expression.
|
750
937
|
*/
|
751
938
|
static VALUE
|
752
939
|
rb_proj_as_wkt (int argc, VALUE *argv, VALUE self)
|
@@ -776,7 +963,7 @@ rb_proj_as_wkt (int argc, VALUE *argv, VALUE self)
|
|
776
963
|
|
777
964
|
|
778
965
|
void
|
779
|
-
|
966
|
+
Init_simple_proj_ext ()
|
780
967
|
{
|
781
968
|
id_forward = rb_intern("forward");
|
782
969
|
id_inverse = rb_intern("inverse");
|
@@ -798,7 +985,9 @@ Init_simple_proj ()
|
|
798
985
|
rb_define_method(rb_cProj, "angular_output?", rb_proj_angular_output, 1);
|
799
986
|
rb_define_method(rb_cProj, "normalize_for_visualization", rb_proj_normalize_for_visualization, 0);
|
800
987
|
rb_define_method(rb_cProj, "forward", rb_proj_forward, -1);
|
988
|
+
rb_define_method(rb_cProj, "forward!", rb_proj_forward_bang, -1);
|
801
989
|
rb_define_method(rb_cProj, "inverse", rb_proj_inverse, -1);
|
990
|
+
rb_define_method(rb_cProj, "inverse!", rb_proj_inverse_bang, -1);
|
802
991
|
rb_define_method(rb_cProj, "transform", rb_proj_transform_forward, -1);
|
803
992
|
rb_define_method(rb_cProj, "transform_inverse", rb_proj_transform_inverse, -1);
|
804
993
|
rb_define_private_method(rb_cProj, "_pj_info", rb_proj_pj_info, 0);
|
@@ -813,7 +1002,9 @@ Init_simple_proj ()
|
|
813
1002
|
rb_define_method(rb_mCommon, "id_auth_name", rb_proj_get_id_auth_name, -1);
|
814
1003
|
rb_define_method(rb_mCommon, "id_code", rb_proj_get_id_code, -1);
|
815
1004
|
rb_define_method(rb_mCommon, "to_proj_string", rb_proj_as_proj_string, 0);
|
816
|
-
|
1005
|
+
#if PROJ_AT_LEAST_VERSION(6,2,0)
|
1006
|
+
rb_define_method(rb_mCommon, "to_projjson", rb_proj_as_projjson, -1);
|
1007
|
+
#endif
|
817
1008
|
rb_define_method(rb_mCommon, "ellipsoid_parameters", rb_proj_ellipsoid_get_parameters, 0);
|
818
1009
|
rb_define_method(rb_mCommon, "to_wkt", rb_proj_as_wkt, -1);
|
819
1010
|
|
data/lib/simple-proj.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
require '
|
1
|
+
require 'simple_proj_ext'
|
2
2
|
require 'json'
|
3
3
|
require 'bindata'
|
4
4
|
require 'ostruct'
|
5
5
|
|
6
6
|
class PROJ
|
7
7
|
|
8
|
+
VERSION = _info["version"]
|
9
|
+
|
8
10
|
# Returns PROJ info
|
9
11
|
#
|
10
12
|
# @return [OpenStruct]
|
@@ -159,6 +161,32 @@ class PROJ
|
|
159
161
|
|
160
162
|
end
|
161
163
|
|
164
|
+
### Marshalling
|
165
|
+
|
166
|
+
class PROJ
|
167
|
+
|
168
|
+
def _dump_data
|
169
|
+
return to_wkt
|
170
|
+
end
|
171
|
+
|
172
|
+
def _load_data (wkt)
|
173
|
+
initialize_copy self.class.new(wkt)
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
|
178
|
+
class PROJ::CRS
|
179
|
+
|
180
|
+
def _dump_data
|
181
|
+
return to_wkt
|
182
|
+
end
|
183
|
+
|
184
|
+
def _load_data (wkt)
|
185
|
+
initialize_copy self.class.new(wkt)
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
189
|
+
|
162
190
|
begin
|
163
191
|
require "simple-proj-carray"
|
164
192
|
rescue LoadError
|
data/simple-proj.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
Gem::Specification::new do |s|
|
3
|
-
version = "1.0.
|
3
|
+
version = "1.0.1"
|
4
4
|
|
5
5
|
files = Dir.glob("**/*") - [
|
6
6
|
Dir.glob("simple-proj-*.gem"),
|
@@ -22,4 +22,5 @@ Gem::Specification::new do |s|
|
|
22
22
|
s.files = files
|
23
23
|
s.extensions = [ "ext/extconf.rb" ]
|
24
24
|
s.required_ruby_version = ">= 2.4.0"
|
25
|
+
s.add_runtime_dependency 'bindata', '~> 2.4', '>= 2.4.8'
|
25
26
|
end
|
data/spec/proj_spec.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'simple-proj'
|
2
|
+
require 'rspec-power_assert'
|
3
|
+
|
4
|
+
describe 'PROJ' do
|
5
|
+
|
6
|
+
example 'creation with proj string' do
|
7
|
+
|
8
|
+
expect { PROJ.new("") }.to raise_error(RuntimeError)
|
9
|
+
|
10
|
+
webmerc = PROJ.new("+proj=webmerc")
|
11
|
+
epsg3857 = PROJ.new("EPSG:3857")
|
12
|
+
|
13
|
+
pp [webmerc.to_wkt, epsg3857.to_wkt]
|
14
|
+
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-proj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroki Motoyoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2022-07-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bindata
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.4'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.4.8
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.4'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.4.8
|
13
33
|
description: " Ruby extension library for PROJ 7\n"
|
14
34
|
email: ''
|
15
35
|
executables: []
|
@@ -21,10 +41,12 @@ files:
|
|
21
41
|
- README.md
|
22
42
|
- Rakefile
|
23
43
|
- ext/extconf.rb
|
44
|
+
- ext/mkmf.log
|
24
45
|
- ext/rb_proj.c
|
25
46
|
- ext/rb_proj.h
|
26
47
|
- lib/simple-proj.rb
|
27
48
|
- simple-proj.gemspec
|
49
|
+
- spec/proj_spec.rb
|
28
50
|
homepage: https://github.com/himotoyoshi/simple-proj
|
29
51
|
licenses:
|
30
52
|
- MIT
|
@@ -44,8 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
66
|
- !ruby/object:Gem::Version
|
45
67
|
version: '0'
|
46
68
|
requirements: []
|
47
|
-
|
48
|
-
rubygems_version: 2.7.6
|
69
|
+
rubygems_version: 3.1.6
|
49
70
|
signing_key:
|
50
71
|
specification_version: 4
|
51
72
|
summary: Ruby extension library for PROJ 7
|