rgeo-proj4 3.1.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/proj4_c_impl/errors.c +33 -0
- data/ext/proj4_c_impl/errors.h +22 -0
- data/ext/proj4_c_impl/extconf.rb +64 -16
- data/ext/proj4_c_impl/main.c +284 -135
- data/ext/proj4_c_impl/preface.h +27 -0
- data/lib/rgeo/coord_sys/crs_to_crs.rb +34 -6
- data/lib/rgeo/coord_sys/proj4.rb +71 -10
- data/lib/rgeo/errors.rb +15 -0
- data/lib/rgeo/proj4/version.rb +1 -1
- data/lib/rgeo/proj4.rb +41 -2
- metadata +31 -14
- data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +0 -143
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62f388f5389751fb4be6fd44e37b436c2a3465dc407346cb8c311c839af0e35f
|
4
|
+
data.tar.gz: 259d631dcf07572b4a99de70cef87156ea880bc2db54aeaea9cf6db4530772ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c48f8cb2676bbc08309a6c103b7df1c7f121e586b300357bc278bccc3dcdfb72f597b9e89bf11603a749a329910685ee93adf719ab4f47db7b3676a9290911ac
|
7
|
+
data.tar.gz: 623d1af171edc6e69bc1d8967d9b9262f2a96dd560fcaa6cc5982be75d1e4d4177957255fd28895230c4645cc1ed778a0f77354d3b0b30d031cda8d9bc984687
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#ifndef RGEO_PROJ4_ERRORS_INCLUDED
|
2
|
+
#define RGEO_PROJ4_ERRORS_INCLUDED
|
3
|
+
|
4
|
+
#include <ruby.h>
|
5
|
+
|
6
|
+
#include "preface.h"
|
7
|
+
|
8
|
+
#ifdef RGEO_PROJ4_SUPPORTED
|
9
|
+
|
10
|
+
#include "errors.h"
|
11
|
+
|
12
|
+
RGEO_BEGIN_C
|
13
|
+
|
14
|
+
VALUE error_module;
|
15
|
+
VALUE rb_eRGeoError;
|
16
|
+
VALUE rb_eRGeoInvalidProjectionError;
|
17
|
+
|
18
|
+
void rgeo_init_proj_errors() {
|
19
|
+
VALUE rgeo_module;
|
20
|
+
|
21
|
+
rgeo_module = rb_define_module("RGeo");
|
22
|
+
error_module = rb_define_module_under(rgeo_module, "Error");
|
23
|
+
rb_eRGeoError =
|
24
|
+
rb_define_class_under(error_module, "RGeoError", rb_eRuntimeError);
|
25
|
+
rb_eRGeoInvalidProjectionError =
|
26
|
+
rb_define_class_under(error_module, "InvalidProjection", rb_eRGeoError);
|
27
|
+
}
|
28
|
+
|
29
|
+
RGEO_END_C
|
30
|
+
|
31
|
+
#endif // RGEO_PROJ4_SUPPORTED
|
32
|
+
|
33
|
+
#endif // RGEO_GEOS_ERROS_INCLUDED
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#ifndef RGEO_PROJ4_ERRORS_INCLUDED
|
2
|
+
#define RGEO_PROJ4_ERRORS_INCLUDED
|
3
|
+
|
4
|
+
#include <ruby.h>
|
5
|
+
|
6
|
+
#ifdef RGEO_PROJ4_SUPPORTED
|
7
|
+
|
8
|
+
RGEO_BEGIN_C
|
9
|
+
|
10
|
+
extern VALUE error_module;
|
11
|
+
// Main rgeo error type
|
12
|
+
extern VALUE rb_eRGeoError;
|
13
|
+
// RGeo::Error::InvalidProjection
|
14
|
+
extern VALUE rb_eRGeoInvalidProjectionError;
|
15
|
+
|
16
|
+
void rgeo_init_proj_errors();
|
17
|
+
|
18
|
+
RGEO_END_C
|
19
|
+
|
20
|
+
#endif // RGEO_PROJ4_SUPPORTED
|
21
|
+
|
22
|
+
#endif // RGEO_PROJ4_ERRORS_INCLUDED
|
data/ext/proj4_c_impl/extconf.rb
CHANGED
@@ -12,7 +12,18 @@ else
|
|
12
12
|
|
13
13
|
require "mkmf"
|
14
14
|
|
15
|
-
|
15
|
+
if ENV.key?("DEBUG") || ENV.key?("MAINTAINER_MODE")
|
16
|
+
$CFLAGS << " -DDEBUG" \
|
17
|
+
" -Wall" \
|
18
|
+
" -ggdb" \
|
19
|
+
" -pedantic" \
|
20
|
+
" -std=c17"
|
21
|
+
|
22
|
+
extra_flags = ENV.fetch("MAINTAINER_MODE", ENV.fetch("DEBUG", ""))
|
23
|
+
$CFLAGS << " " << extra_flags if extra_flags.strip.start_with?("-")
|
24
|
+
end
|
25
|
+
|
26
|
+
header_dirs =
|
16
27
|
[
|
17
28
|
::RbConfig::CONFIG["includedir"],
|
18
29
|
"/usr/local/include",
|
@@ -26,7 +37,7 @@ else
|
|
26
37
|
"/Library/Frameworks/PROJ.framework/unix/include",
|
27
38
|
"/usr/include"
|
28
39
|
]
|
29
|
-
|
40
|
+
lib_dirs =
|
30
41
|
[
|
31
42
|
::RbConfig::CONFIG["libdir"],
|
32
43
|
"/usr/local/lib",
|
@@ -42,28 +53,65 @@ else
|
|
42
53
|
"/usr/lib",
|
43
54
|
"/usr/lib64"
|
44
55
|
]
|
45
|
-
|
46
|
-
|
56
|
+
header_dirs.delete_if { |path| !::File.directory?(path) }
|
57
|
+
lib_dirs.delete_if { |path| !::File.directory?(path) }
|
47
58
|
|
48
|
-
|
49
|
-
|
59
|
+
found_proj = false
|
60
|
+
found_valid_proj_version = false
|
61
|
+
header_dirs, lib_dirs = dir_config("proj", header_dirs, lib_dirs)
|
50
62
|
if have_header("proj.h")
|
51
63
|
$libs << " -lproj"
|
64
|
+
found_proj = true
|
52
65
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
66
|
+
required_proj_funcs = %w[
|
67
|
+
proj_create
|
68
|
+
proj_create_crs_to_crs_from_pj
|
69
|
+
proj_normalize_for_visualization
|
70
|
+
]
|
71
|
+
found_valid_proj_version = required_proj_funcs.all? do |func|
|
72
|
+
have_func(func, "proj.h")
|
59
73
|
end
|
60
74
|
end
|
61
75
|
have_func("rb_gc_mark_movable")
|
62
76
|
|
63
|
-
unless
|
64
|
-
|
65
|
-
|
77
|
+
unless found_proj
|
78
|
+
|
79
|
+
install_text = case RUBY_PLATFORM
|
80
|
+
when /linux/
|
81
|
+
%(
|
82
|
+
Please install proj like so:
|
83
|
+
apt-get install libproj-dev proj-bin
|
84
|
+
)
|
85
|
+
when /darwin/
|
86
|
+
%(
|
87
|
+
Please install proj like so:
|
88
|
+
brew install proj
|
89
|
+
)
|
90
|
+
else
|
91
|
+
%(
|
92
|
+
Please install proj.
|
93
|
+
)
|
94
|
+
end
|
95
|
+
error_msg = %(
|
96
|
+
**** WARNING: Unable to find Proj headers. Ensure that Proj is properly installed.
|
97
|
+
|
98
|
+
#{install_text}
|
99
|
+
|
100
|
+
or set the path manually using:
|
101
|
+
--with-proj-dir or with the --with-proj-include and --with-proj-lib options
|
102
|
+
)
|
103
|
+
warn error_msg
|
104
|
+
raise
|
66
105
|
end
|
67
|
-
create_makefile("rgeo/coord_sys/proj4_c_impl")
|
68
106
|
|
107
|
+
unless found_valid_proj_version
|
108
|
+
error_msg = %(
|
109
|
+
**** WARNING: The found Proj version is not new enough to be used for this version of rgeo-proj4.
|
110
|
+
**** Proj 6.2+ is required.
|
111
|
+
)
|
112
|
+
warn error_msg
|
113
|
+
raise
|
114
|
+
end
|
115
|
+
|
116
|
+
create_makefile("rgeo/coord_sys/proj4_c_impl")
|
69
117
|
end
|