simple_mapnik 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8d3175e317ae4772b41f5d8ac4f9a0781d4432a
4
- data.tar.gz: 46eaac32355da4efb010299a5a99bd799a27f468
3
+ metadata.gz: 82dc0814ab72fdcf1ba19ebd95ce9af85ea85797
4
+ data.tar.gz: ed90badb5cd37ff4e964f1d2bb734170d223f694
5
5
  SHA512:
6
- metadata.gz: 03a3e4d5bdbe20771aeddb586cdeb7604b89071be85d89a6266bd02be35887d0b6c9d76405235cb57d98ea664cf02df5e09c30e3141e981db0f504e42081e662
7
- data.tar.gz: c1a9cedff9a7c3f7af5073246aac47ce058646e6b3b0730098ecc7385b99cf283437d653930b9a243c5810dc2d4add3e9a6acfd1900b1d5810840121decd8d8e
6
+ metadata.gz: 43ad84c9f1295934f9965bd788def6022edf9086708026923f2c38d21936b7d40cbde795259ecc29c98568b39d14a842b8607e9078cfe58a46816847a629552d
7
+ data.tar.gz: 96c049bf4a8aa0c3637afa688ff1ba7a4589c85ab343d6e65bfa1911c749b2d20b73dd64e57abb41d9ad82228be205627d3c14fc225ade87b634d80889fa5b97
@@ -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/master.zip'
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-master'
34
+ @src_directory_name ||= 'mapnik-c-api-0.0.2'
35
35
  end
36
36
 
37
37
  protected
@@ -23,6 +23,10 @@ module SimpleMapnik
23
23
  mapnik_map_load @ptr, style
24
24
  end
25
25
 
26
+ def load_string(style)
27
+ mapnik_map_load_string @ptr, style
28
+ end
29
+
26
30
  def zoom_all
27
31
  mapnik_map_zoom_all @ptr
28
32
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleMapnik
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
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.1
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