mapnik 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. data/.autotest +35 -0
  2. data/.yardopts +1 -0
  3. data/Gemfile +14 -0
  4. data/LICENSE +19 -0
  5. data/Manifest.txt +172 -0
  6. data/README.rdoc +107 -0
  7. data/Rakefile +43 -0
  8. data/demo/data/COPYRIGHT.txt +3 -0
  9. data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.dbf +0 -0
  10. data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.prj +1 -0
  11. data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shp +0 -0
  12. data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shx +0 -0
  13. data/demo/data/boundaries.dbf +0 -0
  14. data/demo/data/boundaries.prj +1 -0
  15. data/demo/data/boundaries.sbx +0 -0
  16. data/demo/data/boundaries.shp +0 -0
  17. data/demo/data/boundaries.shx +0 -0
  18. data/demo/data/boundaries_l.dbf +0 -0
  19. data/demo/data/boundaries_l.prj +1 -0
  20. data/demo/data/boundaries_l.sbx +0 -0
  21. data/demo/data/boundaries_l.shp +0 -0
  22. data/demo/data/boundaries_l.shx +0 -0
  23. data/demo/data/ontdrainage.dbf +0 -0
  24. data/demo/data/ontdrainage.prj +1 -0
  25. data/demo/data/ontdrainage.sbx +0 -0
  26. data/demo/data/ontdrainage.shp +0 -0
  27. data/demo/data/ontdrainage.shx +0 -0
  28. data/demo/data/popplaces.dbf +0 -0
  29. data/demo/data/popplaces.prj +1 -0
  30. data/demo/data/popplaces.sbx +0 -0
  31. data/demo/data/popplaces.shp +0 -0
  32. data/demo/data/popplaces.shx +0 -0
  33. data/demo/data/qcdrainage.dbf +0 -0
  34. data/demo/data/qcdrainage.prj +1 -0
  35. data/demo/data/qcdrainage.sbx +0 -0
  36. data/demo/data/qcdrainage.shp +0 -0
  37. data/demo/data/qcdrainage.shx +0 -0
  38. data/demo/data/roads.dbf +0 -0
  39. data/demo/data/roads.prj +1 -0
  40. data/demo/data/roads.sbx +0 -0
  41. data/demo/data/roads.shp +0 -0
  42. data/demo/data/roads.shx +0 -0
  43. data/demo/data/test/charplacement.dbf +0 -0
  44. data/demo/data/test/charplacement.shp +0 -0
  45. data/demo/data/test/charplacement.shx +0 -0
  46. data/demo/data/test/displacement.dbf +0 -0
  47. data/demo/data/test/displacement.shp +0 -0
  48. data/demo/data/test/displacement.shx +0 -0
  49. data/demo/data/test/overlap.dbf +0 -0
  50. data/demo/data/test/overlap.shp +0 -0
  51. data/demo/data/test/overlap.shx +0 -0
  52. data/demo/data/test/raw/charplacement.gfs +25 -0
  53. data/demo/data/test/raw/charplacement.gml +99 -0
  54. data/demo/data/test/raw/charplacement.xsd +36 -0
  55. data/demo/data/test/raw/displacement.gfs +25 -0
  56. data/demo/data/test/raw/displacement.gml +173 -0
  57. data/demo/data/test/raw/displacement.xsd +36 -0
  58. data/demo/data/test/raw/overlap.gfs +25 -0
  59. data/demo/data/test/raw/overlap.gml +127 -0
  60. data/demo/data/test/raw/overlap.xsd +36 -0
  61. data/demo/data/test/raw/textspacing.gfs +25 -0
  62. data/demo/data/test/raw/textspacing.gml +117 -0
  63. data/demo/data/test/raw/textspacing.xsd +36 -0
  64. data/demo/data/test/readme.txt +3 -0
  65. data/demo/data/test/regenerate.sh +20 -0
  66. data/demo/data/test/textspacing.dbf +0 -0
  67. data/demo/data/test/textspacing.shp +0 -0
  68. data/demo/data/test/textspacing.shx +0 -0
  69. data/demo/rundemo.rb +145 -0
  70. data/demo/sinatra/demo.rb +31 -0
  71. data/demo/sinatra/public/css/demo_map.css +7 -0
  72. data/demo/sinatra/public/index.html +13 -0
  73. data/demo/sinatra/public/javascripts/demo_map.js +42 -0
  74. data/ext/ruby_mapnik/_mapnik.cpp +52 -0
  75. data/ext/ruby_mapnik/_mapnik.h +65 -0
  76. data/ext/ruby_mapnik/_mapnik_color.rb.cpp +179 -0
  77. data/ext/ruby_mapnik/_mapnik_color.rb.h +32 -0
  78. data/ext/ruby_mapnik/_mapnik_coord.rb.cpp +145 -0
  79. data/ext/ruby_mapnik/_mapnik_coord.rb.h +32 -0
  80. data/ext/ruby_mapnik/_mapnik_datasource.rb.cpp +170 -0
  81. data/ext/ruby_mapnik/_mapnik_datasource.rb.h +32 -0
  82. data/ext/ruby_mapnik/_mapnik_datasource_cache.rb.cpp +87 -0
  83. data/ext/ruby_mapnik/_mapnik_datasource_cache.rb.h +32 -0
  84. data/ext/ruby_mapnik/_mapnik_envelope.rb.cpp +220 -0
  85. data/ext/ruby_mapnik/_mapnik_envelope.rb.h +32 -0
  86. data/ext/ruby_mapnik/_mapnik_expression.rb.cpp +91 -0
  87. data/ext/ruby_mapnik/_mapnik_expression.rb.h +32 -0
  88. data/ext/ruby_mapnik/_mapnik_feature.rb.cpp +93 -0
  89. data/ext/ruby_mapnik/_mapnik_feature.rb.h +32 -0
  90. data/ext/ruby_mapnik/_mapnik_font_engine.rb.cpp +71 -0
  91. data/ext/ruby_mapnik/_mapnik_font_engine.rb.h +32 -0
  92. data/ext/ruby_mapnik/_mapnik_layer.rb.cpp +208 -0
  93. data/ext/ruby_mapnik/_mapnik_layer.rb.h +32 -0
  94. data/ext/ruby_mapnik/_mapnik_line_pattern_symbolizer.rb.cpp +71 -0
  95. data/ext/ruby_mapnik/_mapnik_line_pattern_symbolizer.rb.h +32 -0
  96. data/ext/ruby_mapnik/_mapnik_line_symbolizer.rb.cpp +43 -0
  97. data/ext/ruby_mapnik/_mapnik_line_symbolizer.rb.h +32 -0
  98. data/ext/ruby_mapnik/_mapnik_map.rb.cpp +489 -0
  99. data/ext/ruby_mapnik/_mapnik_map.rb.h +32 -0
  100. data/ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp +140 -0
  101. data/ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.h +32 -0
  102. data/ext/ruby_mapnik/_mapnik_point_symbolizer.rb.cpp +150 -0
  103. data/ext/ruby_mapnik/_mapnik_point_symbolizer.rb.h +32 -0
  104. data/ext/ruby_mapnik/_mapnik_polygon_pattern_symbolizer.rb.cpp +93 -0
  105. data/ext/ruby_mapnik/_mapnik_polygon_pattern_symbolizer.rb.h +32 -0
  106. data/ext/ruby_mapnik/_mapnik_polygon_symbolizer.rb.cpp +89 -0
  107. data/ext/ruby_mapnik/_mapnik_polygon_symbolizer.rb.h +32 -0
  108. data/ext/ruby_mapnik/_mapnik_projection.rb.cpp +100 -0
  109. data/ext/ruby_mapnik/_mapnik_projection.rb.h +32 -0
  110. data/ext/ruby_mapnik/_mapnik_raster_colorizer.rb.cpp +162 -0
  111. data/ext/ruby_mapnik/_mapnik_raster_colorizer.rb.h +32 -0
  112. data/ext/ruby_mapnik/_mapnik_raster_symbolizer.rb.cpp +87 -0
  113. data/ext/ruby_mapnik/_mapnik_raster_symbolizer.rb.h +32 -0
  114. data/ext/ruby_mapnik/_mapnik_rule.rb.cpp +69 -0
  115. data/ext/ruby_mapnik/_mapnik_rule.rb.h +32 -0
  116. data/ext/ruby_mapnik/_mapnik_shield_symbolizer.rb.cpp +86 -0
  117. data/ext/ruby_mapnik/_mapnik_shield_symbolizer.rb.h +32 -0
  118. data/ext/ruby_mapnik/_mapnik_stroke.rb.cpp +188 -0
  119. data/ext/ruby_mapnik/_mapnik_stroke.rb.h +32 -0
  120. data/ext/ruby_mapnik/_mapnik_style.rb.cpp +76 -0
  121. data/ext/ruby_mapnik/_mapnik_style.rb.h +32 -0
  122. data/ext/ruby_mapnik/_mapnik_symbolizer.rb.cpp +75 -0
  123. data/ext/ruby_mapnik/_mapnik_symbolizer.rb.h +32 -0
  124. data/ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp +471 -0
  125. data/ext/ruby_mapnik/_mapnik_text_symbolizer.rb.h +32 -0
  126. data/ext/ruby_mapnik/extconf.rb +80 -0
  127. data/ext/ruby_mapnik/ruby_mapnik.cpp +32 -0
  128. data/lib/mapnik.rb +1 -0
  129. data/lib/ruby_mapnik.rb +48 -0
  130. data/lib/ruby_mapnik/mapnik/font_engine.rb +35 -0
  131. data/lib/ruby_mapnik/mapnik/layer.rb +68 -0
  132. data/lib/ruby_mapnik/mapnik/map.rb +166 -0
  133. data/lib/ruby_mapnik/mapnik/projection.rb +44 -0
  134. data/lib/ruby_mapnik/mapnik/raster_colorizer.rb +55 -0
  135. data/lib/ruby_mapnik/mapnik/rule.rb +104 -0
  136. data/lib/ruby_mapnik/mapnik/stroke.rb +56 -0
  137. data/lib/ruby_mapnik/mapnik/style.rb +64 -0
  138. data/lib/ruby_mapnik/mapnik/tile.rb +93 -0
  139. data/script/console +2 -0
  140. data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.dbf +0 -0
  141. data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.prj +1 -0
  142. data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shp +0 -0
  143. data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shx +0 -0
  144. data/test/data/test_map.xml +15 -0
  145. data/test/test_helper.rb +29 -0
  146. data/test/test_line_pattern_symbolizer.rb +26 -0
  147. data/test/test_mapnik_color.rb +66 -0
  148. data/test/test_mapnik_coord.rb +92 -0
  149. data/test/test_mapnik_datasource.rb +49 -0
  150. data/test/test_mapnik_envelope.rb +232 -0
  151. data/test/test_mapnik_expression.rb +19 -0
  152. data/test/test_mapnik_feature.rb +29 -0
  153. data/test/test_mapnik_font_engine.rb +13 -0
  154. data/test/test_mapnik_layer.rb +121 -0
  155. data/test/test_mapnik_line_symbolizer.rb +25 -0
  156. data/test/test_mapnik_map.rb +211 -0
  157. data/test/test_mapnik_markers_symbolizer.rb +46 -0
  158. data/test/test_mapnik_point_symbolizer.rb +53 -0
  159. data/test/test_mapnik_polygon_symbolizer.rb +44 -0
  160. data/test/test_mapnik_projection.rb +46 -0
  161. data/test/test_mapnik_raster_colorizer.rb +56 -0
  162. data/test/test_mapnik_raster_symbolizer.rb +45 -0
  163. data/test/test_mapnik_rule.rb +45 -0
  164. data/test/test_mapnik_shield_symbolizer.rb +156 -0
  165. data/test/test_mapnik_stroke.rb +94 -0
  166. data/test/test_mapnik_style.rb +28 -0
  167. data/test/test_mapnik_symbolizer.rb +9 -0
  168. data/test/test_mapnik_text_symbolizer.rb +208 -0
  169. data/test/test_polygon_pattern_symbolizer.rb +34 -0
  170. data/test/test_ruby_mapnik.rb +34 -0
  171. data/yard/lib/yard/parser/generic_parser.rb +72 -0
  172. data/yard/lib/yard_generic.rb +18 -0
  173. metadata +333 -0
@@ -0,0 +1,25 @@
1
+ <GMLFeatureClassList>
2
+ <GMLFeatureClass>
3
+ <Name>overlap</Name>
4
+ <ElementPath>overlap</ElementPath>
5
+ <DatasetSpecificInfo>
6
+ <FeatureCount>1</FeatureCount>
7
+ <ExtentXMin>1.00000</ExtentXMin>
8
+ <ExtentXMax>2.00000</ExtentXMax>
9
+ <ExtentYMin>1.00000</ExtentYMin>
10
+ <ExtentYMax>5.00000</ExtentYMax>
11
+ </DatasetSpecificInfo>
12
+ <PropertyDefn>
13
+ <Name>NAME</Name>
14
+ <ElementPath>NAME</ElementPath>
15
+ <Type>String</Type>
16
+ <Width>0</Width>
17
+ </PropertyDefn>
18
+ <PropertyDefn>
19
+ <Name>CLASS</Name>
20
+ <ElementPath>CLASS</ElementPath>
21
+ <Type>String</Type>
22
+ <Width>0</Width>
23
+ </PropertyDefn>
24
+ </GMLFeatureClass>
25
+ </GMLFeatureClassList>
@@ -0,0 +1,127 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <ogr:FeatureCollection
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="overlap.xsd"
5
+ xmlns:ogr="http://ogr.maptools.org/"
6
+ xmlns:gml="http://www.opengis.net/gml">
7
+ <gml:boundedBy>
8
+ <gml:Box>
9
+ <gml:coord><gml:X>0</gml:X><gml:Y>0</gml:Y></gml:coord>
10
+ <gml:coord><gml:X>13</gml:X><gml:Y>-13</gml:Y></gml:coord>
11
+ </gml:Box>
12
+ </gml:boundedBy>
13
+ <gml:featureMember>
14
+
15
+ <ogr:overlap fid="F0">
16
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>1,-1 1,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
17
+ <ogr:NAME>Road Name</ogr:NAME>
18
+ <ogr:CLASS>NETWORK</ogr:CLASS>
19
+ </ogr:overlap>
20
+ <ogr:overlap fid="F0">
21
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>1,-3 7,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
22
+ <ogr:NAME>Road Name</ogr:NAME>
23
+ <ogr:CLASS>NETWORK</ogr:CLASS>
24
+ </ogr:overlap>
25
+ <ogr:overlap fid="F0">
26
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>7,-3 7,-7</gml:coordinates></gml:LineString></ogr:geometryProperty>
27
+ <ogr:NAME>Road Name</ogr:NAME>
28
+ <ogr:CLASS>NETWORK</ogr:CLASS>
29
+ </ogr:overlap>
30
+ <ogr:overlap fid="F0">
31
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>3,-2 3,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
32
+ <ogr:NAME>Road Name</ogr:NAME>
33
+ <ogr:CLASS>NETWORK</ogr:CLASS>
34
+ </ogr:overlap>
35
+ <ogr:overlap fid="F0">
36
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>7,-7 1,-7</gml:coordinates></gml:LineString></ogr:geometryProperty>
37
+ <ogr:NAME>Road Name</ogr:NAME>
38
+ <ogr:CLASS>NETWORK</ogr:CLASS>
39
+ </ogr:overlap>
40
+ <ogr:overlap fid="F0">
41
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>5,-2 5,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
42
+ <ogr:NAME>Road Name</ogr:NAME>
43
+ <ogr:CLASS>NETWORK</ogr:CLASS>
44
+ </ogr:overlap>
45
+
46
+ <ogr:overlap fid="F0">
47
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>8,-3 12,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
48
+ <ogr:NAME>Road Name</ogr:NAME>
49
+ <ogr:CLASS>CROSS</ogr:CLASS>
50
+ </ogr:overlap>
51
+ <ogr:overlap fid="F0">
52
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>10,-1 10,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
53
+ <ogr:NAME>Road Name</ogr:NAME>
54
+ <ogr:CLASS>CROSS</ogr:CLASS>
55
+ </ogr:overlap>
56
+
57
+ <ogr:overlap fid="F0">
58
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>
59
+ 10,-9 13,-9 13,-11 11,-11 11,-8
60
+ </gml:coordinates></gml:LineString></ogr:geometryProperty>
61
+ <ogr:NAME>Road Name</ogr:NAME>
62
+ <ogr:CLASS>SELFOVERLAP</ogr:CLASS>
63
+ </ogr:overlap>
64
+
65
+ <ogr:overlap fid="F0">
66
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>4,-9 4,-13</gml:coordinates></gml:LineString></ogr:geometryProperty>
67
+ <ogr:NAME>Road Name</ogr:NAME>
68
+ <ogr:CLASS>NETWORK2</ogr:CLASS>
69
+ </ogr:overlap>
70
+ <ogr:overlap fid="F0">
71
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>8,-9 8,-13</gml:coordinates></gml:LineString></ogr:geometryProperty>
72
+ <ogr:NAME>Road Name</ogr:NAME>
73
+ <ogr:CLASS>NETWORK2</ogr:CLASS>
74
+ </ogr:overlap>
75
+ <ogr:overlap fid="F0">
76
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>1,-11 9,-11</gml:coordinates></gml:LineString></ogr:geometryProperty>
77
+ <ogr:NAME>Road Name</ogr:NAME>
78
+ <ogr:CLASS>NETWORK2</ogr:CLASS>
79
+ </ogr:overlap>
80
+ <ogr:overlap fid="F0">
81
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>2,-9 2,-13</gml:coordinates></gml:LineString></ogr:geometryProperty>
82
+ <ogr:NAME>Road Name</ogr:NAME>
83
+ <ogr:CLASS>NETWORK2</ogr:CLASS>
84
+ </ogr:overlap>
85
+ <ogr:overlap fid="F0">
86
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>6,-9 6,-13</gml:coordinates></gml:LineString></ogr:geometryProperty>
87
+ <ogr:NAME>Road Name</ogr:NAME>
88
+ <ogr:CLASS>NETWORK2</ogr:CLASS>
89
+ </ogr:overlap>
90
+
91
+
92
+ <ogr:overlap fid="F0">
93
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>8.8,-6 8.8,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
94
+ <ogr:NAME>Long Road Name</ogr:NAME>
95
+ <ogr:CLASS>BENDOVER</ogr:CLASS>
96
+ </ogr:overlap>
97
+ <ogr:overlap fid="F0">
98
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>8,-6 8,-7 10,-7 10,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
99
+ <ogr:NAME>Long Road Name</ogr:NAME>
100
+ <ogr:CLASS>BENDUNDER</ogr:CLASS>
101
+ </ogr:overlap>
102
+
103
+ <ogr:overlap fid="F0">
104
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>12.2,-6 12.2,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
105
+ <ogr:NAME>Long Road Name</ogr:NAME>
106
+ <ogr:CLASS>BENDOVER</ogr:CLASS>
107
+ </ogr:overlap>
108
+ <ogr:overlap fid="F0">
109
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>11,-6 11,-7 13,-7 13,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
110
+ <ogr:NAME>Long Road Name</ogr:NAME>
111
+ <ogr:CLASS>BENDUNDER</ogr:CLASS>
112
+ </ogr:overlap>
113
+
114
+ <ogr:overlap fid="F0">
115
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>12.2,-3.5 12.2,-5.5</gml:coordinates></gml:LineString></ogr:geometryProperty>
116
+ <ogr:NAME>Long Road Name</ogr:NAME>
117
+ <ogr:CLASS>BENDOVER</ogr:CLASS>
118
+ </ogr:overlap>
119
+ <ogr:overlap fid="F0">
120
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>11,-4.5 13,-4.5</gml:coordinates></gml:LineString></ogr:geometryProperty>
121
+ <ogr:NAME>Long Road Name</ogr:NAME>
122
+ <ogr:CLASS>BENDUNDER</ogr:CLASS>
123
+ </ogr:overlap>
124
+
125
+
126
+ </gml:featureMember>
127
+ </ogr:FeatureCollection>
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
3
+ <xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengeospatial.net/gml/2.1.2/feature.xsd"/><xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
4
+ <xs:complexType name="FeatureCollectionType">
5
+ <xs:complexContent>
6
+ <xs:extension base="gml:AbstractFeatureCollectionType">
7
+ <xs:attribute name="lockId" type="xs:string" use="optional"/>
8
+ <xs:attribute name="scope" type="xs:string" use="optional"/>
9
+ </xs:extension>
10
+ </xs:complexContent>
11
+ </xs:complexType>
12
+ <xs:element name="overlap" type="ogr:overlap_Type" substitutionGroup="gml:_Feature"/>
13
+ <xs:complexType name="overlap_Type">
14
+ <xs:complexContent>
15
+ <xs:extension base="gml:AbstractFeatureType">
16
+ <xs:sequence>
17
+ <xs:element name="geometryProperty" type="gml:GeometryPropertyType" nillable="true" minOccurs="1" maxOccurs="1"/>
18
+ <xs:element name="NAME" nillable="true" minOccurs="0" maxOccurs="1">
19
+ <xs:simpleType>
20
+ <xs:restriction base="xs:string">
21
+ <xs:maxLength value="60"/>
22
+ </xs:restriction>
23
+ </xs:simpleType>
24
+ </xs:element>
25
+ <xs:element name="CLASS" nillable="true" minOccurs="0" maxOccurs="1">
26
+ <xs:simpleType>
27
+ <xs:restriction base="xs:string">
28
+ <xs:maxLength value="60"/>
29
+ </xs:restriction>
30
+ </xs:simpleType>
31
+ </xs:element>
32
+ </xs:sequence>
33
+ </xs:extension>
34
+ </xs:complexContent>
35
+ </xs:complexType>
36
+ </xs:schema>
@@ -0,0 +1,25 @@
1
+ <GMLFeatureClassList>
2
+ <GMLFeatureClass>
3
+ <Name>textspacing</Name>
4
+ <ElementPath>textspacing</ElementPath>
5
+ <DatasetSpecificInfo>
6
+ <FeatureCount>1</FeatureCount>
7
+ <ExtentXMin>1.00000</ExtentXMin>
8
+ <ExtentXMax>2.00000</ExtentXMax>
9
+ <ExtentYMin>1.00000</ExtentYMin>
10
+ <ExtentYMax>5.00000</ExtentYMax>
11
+ </DatasetSpecificInfo>
12
+ <PropertyDefn>
13
+ <Name>NAME</Name>
14
+ <ElementPath>NAME</ElementPath>
15
+ <Type>String</Type>
16
+ <Width>0</Width>
17
+ </PropertyDefn>
18
+ <PropertyDefn>
19
+ <Name>CLASS</Name>
20
+ <ElementPath>CLASS</ElementPath>
21
+ <Type>String</Type>
22
+ <Width>0</Width>
23
+ </PropertyDefn>
24
+ </GMLFeatureClass>
25
+ </GMLFeatureClassList>
@@ -0,0 +1,117 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <ogr:FeatureCollection
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="textspacing.xsd"
5
+ xmlns:ogr="http://ogr.maptools.org/"
6
+ xmlns:gml="http://www.opengis.net/gml">
7
+ <gml:boundedBy>
8
+ <gml:Box>
9
+ <gml:coord><gml:X>0</gml:X><gml:Y>0</gml:Y></gml:coord>
10
+ <gml:coord><gml:X>13</gml:X><gml:Y>-13</gml:Y></gml:coord>
11
+ </gml:Box>
12
+ </gml:boundedBy>
13
+ <gml:featureMember>
14
+
15
+ <ogr:textspacing fid="F0">
16
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>2,-1 1,-3 2,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
17
+ <ogr:NAME>Road Name</ogr:NAME>
18
+ <ogr:CLASS>TRIANGLE</ogr:CLASS>
19
+ </ogr:textspacing>
20
+ <ogr:textspacing fid="F1">
21
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>3,-1 4,-3 3,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
22
+ <ogr:NAME>Road Name</ogr:NAME>
23
+ <ogr:CLASS>TRIANGLE</ogr:CLASS>
24
+ </ogr:textspacing>
25
+
26
+ <ogr:textspacing fid="F2">
27
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>1,-7 2,-7</gml:coordinates></gml:LineString></ogr:geometryProperty>
28
+ <ogr:NAME>Road Name</ogr:NAME>
29
+ <ogr:CLASS>STRAIGHT</ogr:CLASS>
30
+ </ogr:textspacing>
31
+ <ogr:textspacing fid="F3">
32
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>1,-8 3,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
33
+ <ogr:NAME>Road Name</ogr:NAME>
34
+ <ogr:CLASS>STRAIGHT</ogr:CLASS>
35
+ </ogr:textspacing>
36
+ <ogr:textspacing fid="F4">
37
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>1,-9 4,-9</gml:coordinates></gml:LineString></ogr:geometryProperty>
38
+ <ogr:NAME>Road Name</ogr:NAME>
39
+ <ogr:CLASS>STRAIGHT</ogr:CLASS>
40
+ </ogr:textspacing>
41
+ <ogr:textspacing fid="F5">
42
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>1,-10 5,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
43
+ <ogr:NAME>Road Name</ogr:NAME>
44
+ <ogr:CLASS>STRAIGHT</ogr:CLASS>
45
+ </ogr:textspacing>
46
+
47
+ <ogr:textspacing fid="F6">
48
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>1,-11 7,-11</gml:coordinates></gml:LineString></ogr:geometryProperty>
49
+ <ogr:NAME>Road Name</ogr:NAME>
50
+ <ogr:CLASS>STRAIGHT</ogr:CLASS>
51
+ </ogr:textspacing>
52
+ <ogr:textspacing fid="F7">
53
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>
54
+ 1,-12 13,-12
55
+ </gml:coordinates></gml:LineString></ogr:geometryProperty>
56
+ <ogr:NAME>Road Name</ogr:NAME>
57
+ <ogr:CLASS>STRAIGHT</ogr:CLASS>
58
+ </ogr:textspacing>
59
+ <ogr:textspacing fid="F8">
60
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>
61
+ 1,-13 2,-13 5,-13 10,-13 13,-13
62
+ </gml:coordinates></gml:LineString></ogr:geometryProperty>
63
+ <ogr:NAME>Road Name</ogr:NAME>
64
+ <ogr:CLASS>STRAIGHT</ogr:CLASS>
65
+ </ogr:textspacing>
66
+
67
+ <ogr:textspacing fid="F9">
68
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>6,-1 5,-3 5,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
69
+ <ogr:NAME>Road Name</ogr:NAME>
70
+ <ogr:CLASS>BEND</ogr:CLASS>
71
+ </ogr:textspacing>
72
+ <ogr:textspacing fid="F10">
73
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>7,-1 8,-3 8,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
74
+ <ogr:NAME>Road Name</ogr:NAME>
75
+ <ogr:CLASS>BEND</ogr:CLASS>
76
+ </ogr:textspacing>
77
+ <ogr:textspacing fid="F11">
78
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>5,-6 5,-8 6,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
79
+ <ogr:NAME>Road Name</ogr:NAME>
80
+ <ogr:CLASS>BEND</ogr:CLASS>
81
+ </ogr:textspacing>
82
+ <ogr:textspacing fid="F12">
83
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>8,-6 8,-8 7,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
84
+ <ogr:NAME>Road Name</ogr:NAME>
85
+ <ogr:CLASS>BEND</ogr:CLASS>
86
+ </ogr:textspacing>
87
+
88
+ <ogr:textspacing fid="F13">
89
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>10.055915,-1.00031738281 10.6649858,-1.077712483 11.274056,-1.26950068 11.77921,-1.55298308 12.191993,-1.92815928 12.51529,-2.369132 12.746218,-2.8329032 12.884774,-3.2968745 12.930959,-3.875339</gml:coordinates></gml:LineString></ogr:geometryProperty>
90
+ <ogr:NAME>Road Name</ogr:NAME>
91
+ <ogr:CLASS>CURVE</ogr:CLASS>
92
+ </ogr:textspacing>
93
+ <ogr:textspacing fid="F14">
94
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>10.0555,-8.875339 10.6645708,-8.7979439 11.273641,-8.6061557 11.778795,-8.3226733 12.191578,-7.9474971 12.514875,-7.5065244 12.745803,-7.0427532 12.884359,-6.5787819 12.930544,-6.0003174</gml:coordinates></gml:LineString></ogr:geometryProperty>
95
+ <ogr:NAME>Road Name</ogr:NAME>
96
+ <ogr:CLASS>CURVE</ogr:CLASS>
97
+ </ogr:textspacing>
98
+
99
+ <ogr:textspacing fid="F15">
100
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>
101
+ 9.055915,-2.00031738281 9.6649858,-2.077712483 10.274056,-2.26950068 10.77921,-2.55298308 11.191993,-2.92815928 11.51529,-3.369132 11.746218,-3.8329032 11.884774,-4.2968745 11.930959,-4.875339
102
+ 11.930544,-5.0003174 11.884359,-5.5787819 11.745803,-6.0427532 11.514875,-6.5065244 11.191578,-6.9474971 10.778795,-7.3226733 10.273641,-7.6061557 9.6645708,-7.7979439 9.0555,-7.875339
103
+ </gml:coordinates></gml:LineString></ogr:geometryProperty>
104
+ <ogr:NAME>Road Name</ogr:NAME>
105
+ <ogr:CLASS>CURVE</ogr:CLASS>
106
+ </ogr:textspacing>
107
+
108
+ <ogr:textspacing fid="F16">
109
+ <ogr:geometryProperty><gml:LineString><gml:coordinates>
110
+ 9.0435048,-10.5550195 9.480786,-10.2191668 9.963148,-10.0731439 10.540222,-10.2495527 10.968444,-10.525815 11.419238,-10.8336443 12.01882,-10.9565825 12.559787,-10.7996079 12.956495,-10.4089966
111
+ </gml:coordinates></gml:LineString></ogr:geometryProperty>
112
+ <ogr:NAME>Road Name</ogr:NAME>
113
+ <ogr:CLASS>SQUIGGLE</ogr:CLASS>
114
+ </ogr:textspacing>
115
+
116
+ </gml:featureMember>
117
+ </ogr:FeatureCollection>
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
3
+ <xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengeospatial.net/gml/2.1.2/feature.xsd"/><xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
4
+ <xs:complexType name="FeatureCollectionType">
5
+ <xs:complexContent>
6
+ <xs:extension base="gml:AbstractFeatureCollectionType">
7
+ <xs:attribute name="lockId" type="xs:string" use="optional"/>
8
+ <xs:attribute name="scope" type="xs:string" use="optional"/>
9
+ </xs:extension>
10
+ </xs:complexContent>
11
+ </xs:complexType>
12
+ <xs:element name="textspacing" type="ogr:textspacing_Type" substitutionGroup="gml:_Feature"/>
13
+ <xs:complexType name="textspacing_Type">
14
+ <xs:complexContent>
15
+ <xs:extension base="gml:AbstractFeatureType">
16
+ <xs:sequence>
17
+ <xs:element name="geometryProperty" type="gml:GeometryPropertyType" nillable="true" minOccurs="1" maxOccurs="1"/>
18
+ <xs:element name="NAME" nillable="true" minOccurs="0" maxOccurs="1">
19
+ <xs:simpleType>
20
+ <xs:restriction base="xs:string">
21
+ <xs:maxLength value="60"/>
22
+ </xs:restriction>
23
+ </xs:simpleType>
24
+ </xs:element>
25
+ <xs:element name="CLASS" nillable="true" minOccurs="0" maxOccurs="1">
26
+ <xs:simpleType>
27
+ <xs:restriction base="xs:string">
28
+ <xs:maxLength value="60"/>
29
+ </xs:restriction>
30
+ </xs:simpleType>
31
+ </xs:element>
32
+ </xs:sequence>
33
+ </xs:extension>
34
+ </xs:complexContent>
35
+ </xs:complexType>
36
+ </xs:schema>
@@ -0,0 +1,3 @@
1
+ These files are for testing various rendering parts of mapnik, they have been created by hand.
2
+ The raw files are in the raw/ folder (they were created with inkscape to assist!)
3
+ Run the regenerate.sh script to regenerate the shape files from the gml files, this requires ogr2ogr to run.
@@ -0,0 +1,20 @@
1
+ #!/bin/sh
2
+ rm -f textspacing.shp textspacing.shx textspacing.dbf
3
+ ogr2ogr -f "ESRI Shapefile" textspacing raw/textspacing.gml
4
+ mv textspacing/* ./
5
+ rmdir textspacing
6
+
7
+ rm -f overlap.shp overlap.shx overlap.dbf
8
+ ogr2ogr -f "ESRI Shapefile" overlap raw/overlap.gml
9
+ mv overlap/* ./
10
+ rmdir overlap
11
+
12
+ rm -f displacement.shp displacement.shx displacement.dbf
13
+ ogr2ogr -f "ESRI Shapefile" displacement raw/displacement.gml
14
+ mv displacement/* ./
15
+ rmdir displacement
16
+
17
+ rm -f charplacement.shp charplacement.shx charplacement.dbf
18
+ ogr2ogr -f "ESRI Shapefile" charplacement raw/charplacement.gml
19
+ mv charplacement/* ./
20
+ rmdir charplacement
@@ -0,0 +1,145 @@
1
+ CURRENT_PATH = File.expand_path(File.dirname(__FILE__))
2
+ require File.join(CURRENT_PATH, '..', 'lib', 'ruby_mapnik')
3
+
4
+ map = Mapnik::Map.new do |m|
5
+
6
+ m.width = 1024
7
+ m.height = 768
8
+ m.background = Mapnik::Color.new("#fff")
9
+ m.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 +no_defs"
10
+
11
+ nd83_srs = "+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
12
+
13
+ m.layer "provinces", nd83_srs do |prov|
14
+ prov.datasource = Mapnik::Datasource.create(:type => "shape", :file => File.join(CURRENT_PATH, 'data/boundaries'))
15
+ prov.style do |s|
16
+ s.rule "[NAME_EN] = 'Ontario'" do |ontario|
17
+ ontario.fill = Mapnik::Color.new('#FABEB7')
18
+ end
19
+
20
+ s.rule "[NAME_EN] = 'Quebec'" do |quebec|
21
+ quebec.fill = Mapnik::Color.new('#D9EBCB')
22
+ end
23
+ end
24
+ end
25
+
26
+ m.style 'drainage' do |style|
27
+ style.rule '[HYC] = 8' do |drainage|
28
+ drainage.fill = Mapnik::Color.new('#99CCFF')
29
+ end
30
+ end
31
+
32
+ m.layer "quebec_hydro", nd83_srs do |q_hydro|
33
+ q_hydro.datasource = Mapnik::Datasource.create(:type => "shape", :file => File.join(CURRENT_PATH, 'data/qcdrainage'))
34
+ q_hydro.styles << 'drainage'
35
+ end
36
+
37
+ m.layer "ontario_hydro", nd83_srs do |o_hydro|
38
+ o_hydro.datasource = Mapnik::Datasource.create(:type => "shape", :file => File.join(CURRENT_PATH, 'data/ontdrainage'))
39
+ o_hydro.styles << 'drainage'
40
+ end
41
+
42
+ m.layer "provincial_borders", nd83_srs do |borders|
43
+ borders.datasource = Mapnik::Datasource.create(:type => "shape", :file => File.join(CURRENT_PATH, 'data/boundaries_l'))
44
+ borders.style do |s|
45
+ s.rule do |default|
46
+ default.line do |stroke|
47
+ stroke.color = Mapnik::Color.new('#000')
48
+ stroke.dashes << {:gap => 8, :length => 4}
49
+ stroke.dashes << {:gap => 2, :length => 2}
50
+ stroke.dashes << {:gap => 2, :length => 2}
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ roads_datasource = Mapnik::Datasource.create(:type => "shape", :file => File.join(CURRENT_PATH, 'data/roads'))
57
+ m.layer 'roads_3_and_4', nd83_srs do |layer|
58
+ layer.datasource = roads_datasource
59
+ layer.style do |s|
60
+ s.rule '([CLASS] = 3) or ([CLASS] = 4)' do |road|
61
+ road.line do |stroke|
62
+ stroke.color = Mapnik::Color.new('#AB9E89')
63
+ stroke.width = 2.0
64
+ end
65
+ end
66
+ end
67
+ end
68
+
69
+ m.layer 'roads_2', nd83_srs do |layer|
70
+ layer.datasource = roads_datasource
71
+
72
+ layer.style 'road_fill' do |s|
73
+ s.rule '[CLASS] = 2' do |road|
74
+ road.line do |stroke|
75
+ stroke.color = Mapnik::Color.new('#AB9E89')
76
+ stroke.width = 4.0
77
+ end
78
+ end
79
+ end
80
+
81
+ layer.style 'road_border' do |s|
82
+ s.rule '[CLASS] = 2' do |road|
83
+ road.line do |stroke|
84
+ stroke.color = Mapnik::Color.new('#FFFA73')
85
+ stroke.width = 2.0
86
+ end
87
+ end
88
+ end
89
+
90
+ end
91
+
92
+ m.layer 'roads_1', nd83_srs do |layer|
93
+ layer.datasource = roads_datasource
94
+
95
+ layer.style 'highway_fill' do |s|
96
+ s.rule '[CLASS] = 1' do |road|
97
+ road.line do |stroke|
98
+ stroke.color = Mapnik::Color.new('#BC951C')
99
+ stroke.width = 7.0
100
+ stroke.line_cap = Mapnik::LineCap::ROUND_CAP
101
+ end
102
+ end
103
+ end
104
+
105
+ layer.style 'highway_border' do |s|
106
+ s.rule '[CLASS] = 1' do |road|
107
+ road.line do |stroke|
108
+ stroke.color = Mapnik::Color.new('#F2BF24')
109
+ stroke.width = 5.0
110
+ stroke.line_cap = Mapnik::LineCap::ROUND_CAP
111
+ end
112
+ end
113
+ end
114
+ end
115
+
116
+ m.layer 'populated_places', nd83_srs do |layer|
117
+ layer.datasource = Mapnik::Datasource.create(:type => "shape", :file => File.join(CURRENT_PATH, 'data/popplaces'))
118
+ layer.style do |style|
119
+ style.rule do |default|
120
+ color = Mapnik::Color.new('#000')
121
+ default.text "[GEONAME]" do |text|
122
+ text.label_placement = Mapnik::LABEL_PLACEMENT::POINT_PLACEMENT
123
+ text.fill = Mapnik::Color.new('#000')
124
+ text.halo_fill = Mapnik::Color.new("#fff")
125
+ text.halo_radius = 1
126
+ text.avoid_edges = true
127
+ end
128
+
129
+ end
130
+ end
131
+ end
132
+
133
+ end
134
+
135
+ # Rendering...
136
+ filename = File.join(CURRENT_PATH, '..', 'tmp', 'rundemo.png')
137
+ map.zoom_to_box(Mapnik::Envelope.new(-8024477.28459,5445190.38849,-7381388.20071,5662941.44855))
138
+ map.render_to_file(filename)
139
+
140
+ if RUBY_PLATFORM =~ /linux/
141
+ command = 'xdg-open'
142
+ else
143
+ command = 'open'
144
+ end
145
+ `#{command} #{filename}`