simple_mapnik 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simple_mapnik/api.rb +2 -2
- data/lib/simple_mapnik/map.rb +4 -0
- data/lib/simple_mapnik/version.rb +1 -1
- data/lib/simple_mapnik.rb +1 -0
- data/spec/fixtures/sample/stylesheet_string.xml +19 -0
- data/spec/lib/simple_mapnik/map_spec.rb +11 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82dc0814ab72fdcf1ba19ebd95ce9af85ea85797
|
4
|
+
data.tar.gz: ed90badb5cd37ff4e964f1d2bb734170d223f694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43ad84c9f1295934f9965bd788def6022edf9086708026923f2c38d21936b7d40cbde795259ecc29c98568b39d14a842b8607e9078cfe58a46816847a629552d
|
7
|
+
data.tar.gz: 96c049bf4a8aa0c3637afa688ff1ba7a4589c85ab343d6e65bfa1911c749b2d20b73dd64e57abb41d9ad82228be205627d3c14fc225ade87b634d80889fa5b97
|
data/lib/simple_mapnik/api.rb
CHANGED
@@ -27,11 +27,11 @@ module SimpleMapnik
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def url
|
30
|
-
@url ||= 'https://github.com/geoconcerns/mapnik-c-api/archive/
|
30
|
+
@url ||= 'https://github.com/geoconcerns/mapnik-c-api/archive/v0.0.2.zip'
|
31
31
|
end
|
32
32
|
|
33
33
|
def src_directory_name
|
34
|
-
@src_directory_name ||= 'mapnik-c-api-
|
34
|
+
@src_directory_name ||= 'mapnik-c-api-0.0.2'
|
35
35
|
end
|
36
36
|
|
37
37
|
protected
|
data/lib/simple_mapnik/map.rb
CHANGED
data/lib/simple_mapnik.rb
CHANGED
@@ -31,6 +31,7 @@ module SimpleMapnik
|
|
31
31
|
mapnik_map_get_srs: [[:pointer], :string],
|
32
32
|
mapnik_map_set_srs: [[:pointer, :string], :int],
|
33
33
|
mapnik_map_load: [[:pointer, :string], :int],
|
34
|
+
mapnik_map_load_string: [[:pointer, :string], :int],
|
34
35
|
mapnik_map_zoom_all: [[:pointer], :int],
|
35
36
|
mapnik_map_render_to_file: [[:pointer, :string], :int],
|
36
37
|
mapnik_map_resize: [[:pointer, :uint, :uint], :void],
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="steelblue">
|
3
|
+
|
4
|
+
<Style name="style">
|
5
|
+
<Rule>
|
6
|
+
<PolygonSymbolizer fill="white" />
|
7
|
+
<LineSymbolizer stroke="grey" stroke-width=".2" />
|
8
|
+
</Rule>
|
9
|
+
</Style>
|
10
|
+
|
11
|
+
<Layer name="world" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
12
|
+
<StyleName>style</StyleName>
|
13
|
+
<Datasource>
|
14
|
+
<Parameter name="file">./spec/fixtures/sample/world_merc.shp</Parameter>
|
15
|
+
<Parameter name="encoding">iso-8859-1</Parameter>
|
16
|
+
<Parameter name="type">shape</Parameter>
|
17
|
+
</Datasource>
|
18
|
+
</Layer>
|
19
|
+
</Map>
|
@@ -3,6 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe SimpleMapnik::Map do
|
4
4
|
let(:datasources) { '/usr/local/lib/mapnik/input' }
|
5
5
|
let(:stylesheet) { './spec/fixtures/sample/stylesheet.xml' }
|
6
|
+
let(:style_string) { IO.read('./spec/fixtures/sample/stylesheet_string.xml') }
|
6
7
|
let(:out_file) { './tmp/test.png' }
|
7
8
|
|
8
9
|
subject { described_class.new(256, 256) }
|
@@ -25,6 +26,16 @@ describe SimpleMapnik::Map do
|
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
29
|
+
context 'with an xml formatted style string' do
|
30
|
+
it 'renders a shapefile into an image' do
|
31
|
+
subject.load_string(style_string)
|
32
|
+
subject.zoom_all
|
33
|
+
expect { subject.to_file(out_file) }
|
34
|
+
.to change { File.exist?(out_file) }
|
35
|
+
.from(false).to(true)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
28
39
|
describe '#zoom_to' do
|
29
40
|
let(:bounds) { double }
|
30
41
|
let(:ptr) { double }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_mapnik
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eliot Jordan
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- simple_mapnik.gemspec
|
166
166
|
- spec/fixtures/sample/missing_attribute.xml
|
167
167
|
- spec/fixtures/sample/stylesheet.xml
|
168
|
+
- spec/fixtures/sample/stylesheet_string.xml
|
168
169
|
- spec/fixtures/sample/world_merc.dbf
|
169
170
|
- spec/fixtures/sample/world_merc.index
|
170
171
|
- spec/fixtures/sample/world_merc.json
|
@@ -205,6 +206,7 @@ summary: Simple access to Mapnik library from Ruby
|
|
205
206
|
test_files:
|
206
207
|
- spec/fixtures/sample/missing_attribute.xml
|
207
208
|
- spec/fixtures/sample/stylesheet.xml
|
209
|
+
- spec/fixtures/sample/stylesheet_string.xml
|
208
210
|
- spec/fixtures/sample/world_merc.dbf
|
209
211
|
- spec/fixtures/sample/world_merc.index
|
210
212
|
- spec/fixtures/sample/world_merc.json
|