cartocss_helper 5.0.0 → 5.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cartocss_helper.rb +2 -1
- data/lib/cartocss_helper/configuration.rb +2 -1
- data/lib/cartocss_helper/data_file_handling.rb +2 -1
- data/lib/cartocss_helper/git.rb +2 -0
- data/lib/cartocss_helper/heuristic.rb +2 -0
- data/lib/cartocss_helper/image_generator.rb +2 -1
- data/lib/cartocss_helper/notes_downloader.rb +2 -0
- data/lib/cartocss_helper/overpass_downloader.rb +10 -1
- data/lib/cartocss_helper/overpass_query_generator.rb +35 -28
- data/lib/cartocss_helper/renderer_handler.rb +2 -0
- data/lib/cartocss_helper/style_specific/default_osm_style.rb +2 -0
- data/lib/cartocss_helper/style_specific/style_specific.rb +2 -0
- data/lib/cartocss_helper/tag_lister.rb +2 -0
- data/lib/cartocss_helper/util/filehelper.rb +2 -1
- data/lib/cartocss_helper/util/generic_cached_downloader.rb +2 -0
- data/lib/cartocss_helper/util/generic_downloader.rb +2 -0
- data/lib/cartocss_helper/util/logger.rb +2 -0
- data/lib/cartocss_helper/util/rest-client_wrapper.rb +2 -0
- data/lib/cartocss_helper/util/systemhelper.rb +2 -0
- data/lib/cartocss_helper/validator.rb +2 -1
- data/lib/cartocss_helper/visualise_changes_diff_from_images.rb +2 -0
- data/lib/cartocss_helper/visualise_changes_image_generation.rb +2 -0
- data/lib/data/testing_locations.rb +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 687e90505435113721d6c181afce5feb18be9813
|
4
|
+
data.tar.gz: 127cf1604bb20100d21dde261ca687cad19a8300
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6d068d926cf96ac6047044bd34631edc40d259980f10c08bf1fc111b3336bdf94e278ac69731d1878ef637effae7131ab48408d23a48b696b6b63c3293dd5f9
|
7
|
+
data.tar.gz: c35e933f2ab3484797d2a7ce1f4617af3cb71134c984cb1189b1a5950afc56019c2bdd46373915feee974d08058fa6a12f800acefaca0ab64a4720ddbbf63508
|
data/lib/cartocss_helper.rb
CHANGED
data/lib/cartocss_helper/git.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'util/generic_downloader.rb'
|
2
4
|
require_relative 'util/generic_cached_downloader.rb'
|
3
5
|
require 'uri' # for URI.escape
|
@@ -41,6 +43,8 @@ module CartoCSSHelper
|
|
41
43
|
puts url
|
42
44
|
puts
|
43
45
|
puts e
|
46
|
+
elsif e.http_code == 414
|
47
|
+
puts 'see https://github.com/matkoniecz/CartoCSSHelper/issues/35'
|
44
48
|
end
|
45
49
|
raise e
|
46
50
|
end
|
@@ -54,8 +58,13 @@ module CartoCSSHelper
|
|
54
58
|
query = query.gsub('\\', '\\\\')
|
55
59
|
query = query.delete("\n")
|
56
60
|
query = query.delete("\t")
|
61
|
+
query = URI.escape(query)
|
62
|
+
query = query.gsub("&", "%26")
|
63
|
+
if query.length > 8174 #8175 is too much and allows crashes
|
64
|
+
raise 'see https://github.com/matkoniecz/CartoCSSHelper/issues/35'
|
65
|
+
end
|
57
66
|
base_overpass_url = OverpassDownloader.get_overpass_instance_url
|
58
|
-
return base_overpass_url + '/interpreter?data=' +
|
67
|
+
return base_overpass_url + '/interpreter?data=' + query
|
59
68
|
end
|
60
69
|
|
61
70
|
def self.get_overpass_instance_url
|
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'digest/sha1'
|
3
4
|
require 'sys/filesystem'
|
4
5
|
require_relative 'overpass_downloader.rb'
|
@@ -134,7 +135,11 @@ module CartoCSSHelper
|
|
134
135
|
return get_query_to_get_location_set_format(tags, type, latitude, longitude, range, "[out:csv(::lat,::lon;false)]")
|
135
136
|
end
|
136
137
|
|
138
|
+
# TODO: better, more generic function name
|
139
|
+
# get_query_to_get_objects_matching?
|
140
|
+
# put latitude, longitude, range together to avoid passing dummy variables
|
137
141
|
def self.get_query_to_get_location_set_format(tags, type, latitude, longitude, range, format)
|
142
|
+
# special support for range == :infinity
|
138
143
|
# special support for some tag values - see CartoCSSHelper::OverpassQueryGenerator.turn_list_of_tags_in_overpass_filter for details
|
139
144
|
locator = "[timeout:#{OverpassDownloader.get_allowed_timeout_in_seconds}]#{format};"
|
140
145
|
locator += "\n"
|
@@ -167,21 +172,21 @@ module CartoCSSHelper
|
|
167
172
|
end
|
168
173
|
|
169
174
|
def self.translate_tag_object_into_filter_data(tag)
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
175
|
+
operator = :equal
|
176
|
+
key = tag[0]
|
177
|
+
value = :any_value
|
178
|
+
if tag[1].class == Hash
|
179
|
+
# complex operation
|
180
|
+
if tag[1][:operation] == :not_equal_to
|
181
|
+
operator = :not_equal
|
182
|
+
else
|
183
|
+
raise "unexpected operation in #{tag[1]}"
|
184
|
+
end
|
185
|
+
value = tag[1][:value]
|
186
|
+
else
|
187
|
+
value = tag[1]
|
188
|
+
end
|
189
|
+
return { operator: operator, key: key, value: value }
|
185
190
|
end
|
186
191
|
|
187
192
|
def self.overpass_escape(text)
|
@@ -190,17 +195,21 @@ module CartoCSSHelper
|
|
190
195
|
|
191
196
|
def self.turn_tag_into_overpass_filter(tag)
|
192
197
|
filter_data = translate_tag_object_into_filter_data(tag)
|
193
|
-
value =
|
194
|
-
key =
|
198
|
+
value = filter_data[:value]
|
199
|
+
key = filter_data[:key]
|
195
200
|
operator = filter_data[:operator]
|
201
|
+
|
202
|
+
value = overpass_escape(value) if value != :any_value
|
203
|
+
key = overpass_escape(key)
|
204
|
+
|
196
205
|
if value == :any_value && operator == :equal
|
197
|
-
|
206
|
+
return "\t['#{key}']"
|
198
207
|
elsif value == :any_value && operator == :not_equal
|
199
|
-
|
208
|
+
return "\t['#{key}'!~'.*']"
|
200
209
|
elsif value != :any_value && operator == :equal
|
201
|
-
|
210
|
+
return "\t['#{key}'='#{value}']"
|
202
211
|
elsif value != :any_value && operator == :not_equal
|
203
|
-
|
212
|
+
return "\t['#{key}'!='#{value}']"
|
204
213
|
else
|
205
214
|
raise "unexpected situation in <#{tag}>"
|
206
215
|
end
|
@@ -210,14 +219,12 @@ module CartoCSSHelper
|
|
210
219
|
# special support for some tag values - see CartoCSSHelper::OverpassQueryGenerator.turn_list_of_tags_in_overpass_filter for details
|
211
220
|
# TODO - escape value with quotation signs in them
|
212
221
|
element = "(#{type}"
|
213
|
-
element += OverpassQueryGenerator.turn_list_of_tags_in_overpass_filter(tags)
|
214
|
-
element += "\n"
|
222
|
+
element += OverpassQueryGenerator.turn_list_of_tags_in_overpass_filter(tags).strip
|
215
223
|
if range != :infinity
|
216
|
-
element += "
|
217
|
-
element += "\n"
|
224
|
+
element += "(around:#{range},#{latitude},#{longitude})"
|
218
225
|
end
|
219
|
-
element += ');'
|
220
|
-
element += "\n"
|
226
|
+
element += ';);'
|
227
|
+
element += "\n\n"
|
221
228
|
return element
|
222
229
|
end
|
223
230
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cartocss_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz Konieczny
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -200,7 +200,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
200
200
|
requirements:
|
201
201
|
- - ">="
|
202
202
|
- !ruby/object:Gem::Version
|
203
|
-
version: 2.
|
203
|
+
version: 2.3.0
|
204
204
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - ">="
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
version: 1.8.23
|
209
209
|
requirements: []
|
210
210
|
rubyforge_project:
|
211
|
-
rubygems_version: 2.
|
211
|
+
rubygems_version: 2.6.14.1
|
212
212
|
signing_key:
|
213
213
|
specification_version: 4
|
214
214
|
summary: Tool to make development of CartoCSS styles more efficient.
|