@opengis/gis 0.0.17 → 0.0.18

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.
Files changed (101) hide show
  1. package/dist/import-file.cjs +845 -0
  2. package/dist/{index.js → import-file.js} +12117 -11060
  3. package/module/gis/card/gis.maps.table/index.yml +11 -0
  4. package/module/gis/card/gis.maps.table/main_info.hbs +25 -0
  5. package/module/gis/card/gis.maps.table/maps_layers.hbs +19 -0
  6. package/module/gis/card/gis.metadata.table/index.yml +19 -0
  7. package/module/gis/card/gis.metadata.table/main_info.hbs +21 -0
  8. package/module/gis/card/gis.metadata.table/metadata_info.hbs +28 -0
  9. package/module/gis/card/gis.metadata.table/other.hbs +26 -0
  10. package/module/gis/card/gis.rasters.table/index.yml +8 -0
  11. package/module/gis/card/gis.rasters.table/main_info.hbs +27 -0
  12. package/module/gis/card/gis.registers.table/cls.hbs +36 -0
  13. package/module/gis/card/gis.registers.table/columns.hbs +83 -0
  14. package/module/gis/card/gis.registers.table/filters.hbs +80 -0
  15. package/module/gis/card/gis.registers.table/index.yml +21 -0
  16. package/module/gis/card/gis.registers.table/main_info.hbs +35 -0
  17. package/module/gis/card/gis.registers.table/source.hbs +45 -0
  18. package/module/gis/card/gis.services.table/attributes.hbs +85 -0
  19. package/module/gis/card/gis.services.table/filters.hbs +83 -0
  20. package/module/gis/card/gis.services.table/index.yml +20 -0
  21. package/module/gis/card/gis.services.table/main_info.hbs +27 -0
  22. package/module/gis/card/gis.services.table/source.hbs +25 -0
  23. package/module/gis/cls/bool.yes_no.json +12 -0
  24. package/module/gis/cls/encoding.json +14 -0
  25. package/module/gis/cls/geom_type.json +14 -0
  26. package/module/gis/cls/gis.column_type.json +34 -0
  27. package/module/gis/cls/gis.column_view_type.json +18 -0
  28. package/module/gis/cls/gis.filter_type.json +22 -0
  29. package/module/gis/cls/language.json +10 -0
  30. package/module/gis/cls/meta.service_type.json +43 -0
  31. package/module/gis/cls/ogc.service.json +22 -0
  32. package/module/gis/cls/service_type.json +42 -0
  33. package/module/gis/cls/source_type.json +10 -0
  34. package/module/gis/cls/standarts.json +6 -0
  35. package/module/gis/cls/topic_category.json +107 -0
  36. package/module/gis/cls/update_frequency.json +30 -0
  37. package/module/gis/form/gis.group_list.form.json +17 -0
  38. package/module/gis/form/gis.maps.form.json +67 -0
  39. package/module/gis/form/gis.metadata.form.json +240 -0
  40. package/module/gis/form/gis.ogc_service.form.json +36 -0
  41. package/module/gis/form/gis.rasters.form.json +100 -0
  42. package/module/gis/form/gis.registers.form.json +264 -0
  43. package/module/gis/form/gis.registers_column.form.json +77 -0
  44. package/module/gis/form/gis.registers_filter.form.json +65 -0
  45. package/module/gis/form/gis.services.form.json +300 -0
  46. package/module/gis/form/gis.services_attributes.form.json +68 -0
  47. package/module/gis/form/gis.services_filter.form.json +65 -0
  48. package/module/gis/menu.json +43 -0
  49. package/module/gis/select/gis.group_list.sql +1 -0
  50. package/module/gis/select/pg.columns.parent.sql +6 -0
  51. package/module/gis/select/pg.table_name.sql +17 -0
  52. package/module/gis/select/service_id.sql +1 -0
  53. package/module/gis/table/gis.maps.table.json +78 -0
  54. package/module/gis/table/gis.metadata.table.json +71 -0
  55. package/module/gis/table/gis.ogc_service.table.json +81 -0
  56. package/module/gis/table/gis.rasters.table.json +98 -0
  57. package/module/gis/table/gis.registers.table.json +79 -0
  58. package/module/gis/table/gis.services.table.json +105 -0
  59. package/module/gis/table/site.gis.registers.table.json +75 -0
  60. package/module/gis/table/site.gis.services.table.json +104 -0
  61. package/module/gis/templates/ISO19136_2017_gml_template.xml +331 -0
  62. package/module/gis/tokens.yml +5 -0
  63. package/package.json +11 -5
  64. package/plugin.js +12 -0
  65. package/server/plugins/mapnik/funcs/createXML.js +72 -0
  66. package/server/plugins/mapnik/funcs/gdalWrapper.js +72 -0
  67. package/server/plugins/mapnik/funcs/mapnik.js +101 -0
  68. package/server/plugins/mapnik/funcs/rasterConfig.js +11 -0
  69. package/server/plugins/mapnik/funcs/rasterExists.js +21 -0
  70. package/server/plugins/mapnik/funcs/rasterInfo.js +109 -0
  71. package/server/plugins/mapnik/funcs/rasterVrt.js +56 -0
  72. package/server/plugins/mapnik/funcs/rasterXML.js +65 -0
  73. package/server/plugins/mapnik/funcs/rootFolder.mjs +8 -0
  74. package/server/plugins/mapnik/index.mjs +12 -0
  75. package/server/plugins/mapnik/utils/map.proto +241 -0
  76. package/server/routes/gis/index.mjs +19 -0
  77. package/server/routes/gis/metadata/metadataXML.js +13 -0
  78. package/server/routes/gis/registers/funcs/classifiers.js +26 -0
  79. package/server/routes/gis/registers/funcs/columns.js +5 -0
  80. package/server/routes/gis/registers/funcs/handleRegistryRequest.js +100 -0
  81. package/server/routes/gis/registers/gis.registry.js +32 -0
  82. package/server/routes/gis/registers/gis.registry.list.js +59 -0
  83. package/server/routes/gis/registers/insert.columns.js +107 -0
  84. package/server/routes/gis/registers/insert.filters.js +110 -0
  85. package/server/routes/gis/registers/map.registry.js +79 -0
  86. package/server/routes/gis/services/get.layer.geom.js +27 -0
  87. package/server/routes/map/controllers/map.js +123 -0
  88. package/server/routes/map/controllers/mapCatalog.js +55 -0
  89. package/server/routes/map/controllers/mapCatalogAttribute.js +56 -0
  90. package/server/routes/map/controllers/mapFeatures.js +120 -0
  91. package/server/routes/map/controllers/mapFormat.js +111 -0
  92. package/server/routes/map/controllers/mapTiles.js +148 -0
  93. package/server/routes/map/controllers/maps.js +16 -0
  94. package/server/routes/map/controllers/marker_icon.js +42 -0
  95. package/server/routes/map/controllers/rtile.js +133 -0
  96. package/server/routes/map/controllers/vtile.js +146 -0
  97. package/server/routes/map/index.mjs +51 -0
  98. package/server/routes/root.mjs +3 -0
  99. package/utils.js +9 -0
  100. package/dist/index.umd.cjs +0 -845
  101. /package/dist/{index.css → import-file.css} +0 -0
@@ -0,0 +1,331 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20060504/gmd/gmd.xsd">
2
+ {{#contentList table="gis.metadata" query="metadata_id='{{id}}'" widget=0}}
3
+ {{#with rows.[0]}}
4
+ <gmd:fileIdentifier>
5
+ <gco:CharacterString>{{metadata_id}}</gco:CharacterString>
6
+ </gmd:fileIdentifier>
7
+ <gmd:language>
8
+ <gmd:LanguageCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/ML_gmxCodelists.xml#LanguageCode" codeListValue="UKR">1</gmd:LanguageCode>
9
+ </gmd:language>
10
+ <gmd:hierarchyLevel>
11
+ <gmd:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/ML_gmxCodelists.xml#MD_ScopeCode" codeListValue="web_service">web_service</gmd:MD_ScopeCode>
12
+ </gmd:hierarchyLevel>
13
+ <gmd:contact>
14
+ <gmd:CI_ResponsibleParty>
15
+ <gmd:individualName>
16
+ <gco:CharacterString></gco:CharacterString>
17
+ </gmd:individualName>
18
+ <gmd:organisationName>
19
+ <gco:CharacterString></gco:CharacterString>
20
+ </gmd:organisationName>
21
+ <gmd:contactInfo>
22
+ <gmd:CI_Contact>
23
+ <gmd:address>
24
+ <gmd:CI_Address>
25
+ <gmd:electronicMailAddress>
26
+ <gco:CharacterString></gco:CharacterString>
27
+ </gmd:electronicMailAddress>
28
+ </gmd:CI_Address>
29
+ </gmd:address>
30
+ </gmd:CI_Contact>
31
+ </gmd:contactInfo>
32
+ <gmd:role>
33
+ <gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
34
+ </gmd:role>
35
+ </gmd:CI_ResponsibleParty>
36
+ </gmd:contact>
37
+ <gmd:dateStamp>
38
+ <gco:Date></gco:Date>
39
+ </gmd:dateStamp>
40
+ <gmd:metadataStandardName>
41
+ <gco:CharacterString>INSPIRE Metadata for Datasets</gco:CharacterString>
42
+ </gmd:metadataStandardName>
43
+ <gmd:metadataStandardVersion>
44
+ <gco:CharacterString>DRAFT</gco:CharacterString>
45
+ </gmd:metadataStandardVersion>
46
+ <gmd:referenceSystemInfo>
47
+ <gmd:MD_ReferenceSystem>
48
+ <gmd:referenceSystemIdentifier>
49
+ <gmd:RS_Identifier>
50
+ <gmd:code>
51
+ <gco:CharacterString>http://www.opengis.net/def/crs/EPSG/0/4326</gco:CharacterString>
52
+ </gmd:code>
53
+ <gmd:codeSpace>
54
+ <gco:CharacterString>4326</gco:CharacterString>
55
+ </gmd:codeSpace>
56
+ </gmd:RS_Identifier>
57
+ </gmd:referenceSystemIdentifier>
58
+ </gmd:MD_ReferenceSystem>
59
+ </gmd:referenceSystemInfo>
60
+ <gmd:identificationInfo>
61
+ <gmd:MD_DataIdentification>
62
+ <gmd:citation>
63
+ <gmd:CI_Citation>
64
+ <gmd:title>
65
+ <gco:CharacterString>{{select layer_id data="service_id"}}</gco:CharacterString>
66
+ </gmd:title>
67
+ <gmd:date>
68
+ <gmd:CI_Date>
69
+ <gmd:date>
70
+ <gco:Date>{{formatDate editor_date format="yy-mm-dd"}}</gco:Date>
71
+ </gmd:date>
72
+ <gmd:dateType>
73
+ <gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication"/>
74
+ </gmd:dateType>
75
+ </gmd:CI_Date>
76
+ </gmd:date>
77
+ <gmd:date>
78
+ <gmd:CI_Date>
79
+ <gmd:date>
80
+ <gco:Date>{{formatDate cdate format="yy-mm-dd"}}</gco:Date>
81
+ </gmd:date>
82
+ <gmd:dateType>
83
+ <gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation"/>
84
+ </gmd:dateType>
85
+ </gmd:CI_Date>
86
+ </gmd:date>
87
+ </gmd:CI_Citation>
88
+ </gmd:citation>
89
+ <gmd:abstract>
90
+ <gco:CharacterString>{{abstract}}</gco:CharacterString>
91
+ </gmd:abstract>
92
+ <gmd:pointOfContact>
93
+ <gmd:CI_ResponsibleParty>
94
+ <gmd:organisationName>
95
+ <gco:CharacterString></gco:CharacterString>
96
+ </gmd:organisationName>
97
+ <gmd:positionName>
98
+ <gco:CharacterString/>
99
+ </gmd:positionName>
100
+ <gmd:contactInfo>
101
+ <gmd:CI_Contact>
102
+ <gmd:phone>
103
+ <gmd:CI_Telephone>
104
+ <gmd:voice>
105
+ <gco:CharacterString/>
106
+ </gmd:voice>
107
+ <gmd:facsimile>
108
+ <gco:CharacterString/>
109
+ </gmd:facsimile>
110
+ </gmd:CI_Telephone>
111
+ </gmd:phone>
112
+ <gmd:address>
113
+ <gmd:CI_Address>
114
+ <gmd:deliveryPoint>
115
+ <gco:CharacterString/>
116
+ </gmd:deliveryPoint>
117
+ <gmd:city>
118
+ <gco:CharacterString/>
119
+ </gmd:city>
120
+ <gmd:administrativeArea>
121
+ <gco:CharacterString/>
122
+ </gmd:administrativeArea>
123
+ <gmd:postalCode>
124
+ <gco:CharacterString/>
125
+ </gmd:postalCode>
126
+ <gmd:country>
127
+ <gco:CharacterString/>
128
+ </gmd:country>
129
+ <gmd:electronicMailAddress>
130
+ <gco:CharacterString></gco:CharacterString>
131
+ </gmd:electronicMailAddress>
132
+ </gmd:CI_Address>
133
+ </gmd:address>
134
+ <gmd:onlineResource>
135
+ <gmd:CI_OnlineResource>
136
+ <gmd:linkage>
137
+ <gmd:URL/>
138
+ </gmd:linkage>
139
+ </gmd:CI_OnlineResource>
140
+ </gmd:onlineResource>
141
+ </gmd:CI_Contact>
142
+ </gmd:contactInfo>
143
+ <gmd:role>
144
+ <gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="owner"/>
145
+ </gmd:role>
146
+ </gmd:CI_ResponsibleParty>
147
+ </gmd:pointOfContact>
148
+ <gmd:graphicOverview>
149
+ </gmd:graphicOverview>
150
+ <gmd:descriptiveKeywords>
151
+ <gmd:MD_Keywords>
152
+ {{#each keywords}}
153
+ <gmd:keyword>
154
+ <gco:CharacterString>{{this}}</gco:CharacterString>
155
+ </gmd:keyword>
156
+ {{/each}}
157
+ <gmd:thesaurusName>
158
+ <gmd:CI_Citation>
159
+ <gmd:title>
160
+ <gco:CharacterString>GEMET - INSPIRE themes, version 1.0</gco:CharacterString>
161
+ </gmd:title>
162
+ <gmd:date>
163
+ <gmd:CI_Date>
164
+ <gmd:date>
165
+ <gco:Date>{{formatDate cdate format="yy-mm-dd"}}</gco:Date>
166
+ </gmd:date>
167
+ <gmd:dateType>
168
+ <gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/ML_gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication">publication</gmd:CI_DateTypeCode>
169
+ </gmd:dateType>
170
+ </gmd:CI_Date>
171
+ </gmd:date>
172
+ </gmd:CI_Citation>
173
+ </gmd:thesaurusName>
174
+ </gmd:MD_Keywords>
175
+ </gmd:descriptiveKeywords>
176
+ <gmd:descriptiveKeywords>
177
+ <gmd:MD_Keywords>
178
+ <gmd:keyword>
179
+ <gco:CharacterString></gco:CharacterString>
180
+ </gmd:keyword>
181
+ <gmd:keyword>
182
+ <gco:CharacterString></gco:CharacterString>
183
+ </gmd:keyword>
184
+ <gmd:thesaurusName>
185
+ <gmd:CI_Citation>
186
+ <gmd:title>
187
+ <gco:CharacterString>INSPIRE priority data set</gco:CharacterString>
188
+ </gmd:title>
189
+ <gmd:date>
190
+ <gmd:CI_Date>
191
+ <gmd:date>
192
+ <gco:Date></gco:Date>
193
+ </gmd:date>
194
+ <gmd:dateType>
195
+ <gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication">creation</gmd:CI_DateTypeCode>
196
+ </gmd:dateType>
197
+ </gmd:CI_Date>
198
+ </gmd:date>
199
+ </gmd:CI_Citation>
200
+ </gmd:thesaurusName>
201
+ </gmd:MD_Keywords>
202
+ </gmd:descriptiveKeywords>
203
+ <gmd:spatialRepresentationType>
204
+ <gmd:MD_SpatialRepresentationTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_SpatialRepresentationTypeCode" codeListValue=""/>
205
+ </gmd:spatialRepresentationType>
206
+ <gmd:spatialResolution>
207
+ <gmd:MD_Resolution>
208
+ <gmd:equivalentScale>
209
+ <gmd:MD_RepresentativeFraction>
210
+ <gmd:denominator>
211
+ <gco:Integer>{{scale}}</gco:Integer>
212
+ </gmd:denominator>
213
+ </gmd:MD_RepresentativeFraction>
214
+ </gmd:equivalentScale>
215
+ </gmd:MD_Resolution>
216
+ </gmd:spatialResolution>
217
+ <gmd:language>
218
+ <gmd:LanguageCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/ML_gmxCodelists.xml#LanguageCode" codeListValue="lav"/>
219
+ </gmd:language>
220
+ <gmd:topicCategory>
221
+ <gmd:MD_TopicCategoryCode>{{select topic_category data="topic_category"}}</gmd:MD_TopicCategoryCode>
222
+ </gmd:topicCategory>
223
+ <gmd:extent>
224
+ <gmd:EX_Extent>
225
+ <gmd:geographicElement>
226
+ <gmd:EX_GeographicBoundingBox>
227
+ <gmd:westBoundLongitude>
228
+ <gco:Decimal>20.700</gco:Decimal>
229
+ </gmd:westBoundLongitude>
230
+ <gmd:eastBoundLongitude>
231
+ <gco:Decimal>28.500</gco:Decimal>
232
+ </gmd:eastBoundLongitude>
233
+ <gmd:southBoundLatitude>
234
+ <gco:Decimal>55.600</gco:Decimal>
235
+ </gmd:southBoundLatitude>
236
+ <gmd:northBoundLatitude>
237
+ <gco:Decimal>58.100</gco:Decimal>
238
+ </gmd:northBoundLatitude>
239
+ </gmd:EX_GeographicBoundingBox>
240
+ </gmd:geographicElement>
241
+ <gmd:temporalElement>
242
+ <gmd:EX_TemporalExtent>
243
+ <gmd:extent>
244
+ <gml:TimePeriod gml:id="Temporal">
245
+ <gml:begin>
246
+ <gml:TimeInstant gml:id="TemporalBegin">
247
+ <gml:timePosition>2021-01-01</gml:timePosition>
248
+ </gml:TimeInstant>
249
+ </gml:begin>
250
+ <gml:end>
251
+ <gml:TimeInstant gml:id="TemporalEnd">
252
+ <gml:timePosition>2021-12-31</gml:timePosition>
253
+ </gml:TimeInstant>
254
+ </gml:end>
255
+ </gml:TimePeriod>
256
+ </gmd:extent>
257
+ </gmd:EX_TemporalExtent>
258
+ </gmd:temporalElement>
259
+ </gmd:EX_Extent>
260
+ </gmd:extent>
261
+ </gmd:MD_DataIdentification>
262
+ </gmd:identificationInfo>
263
+ <gmd:distributionInfo>
264
+ <gmd:MD_Distribution>
265
+ <gmd:distributionFormat>
266
+ <gmd:MD_Format>
267
+ <gmd:name>
268
+ <gco:CharacterString/>
269
+ </gmd:name>
270
+ <gmd:version>
271
+ <gco:CharacterString/>
272
+ </gmd:version>
273
+ </gmd:MD_Format>
274
+ </gmd:distributionFormat>
275
+ </gmd:MD_Distribution>
276
+ </gmd:distributionInfo>
277
+ <gmd:dataQualityInfo>
278
+ <gmd:DQ_DataQuality>
279
+ <gmd:scope>
280
+ <gmd:DQ_Scope>
281
+ <gmd:level>
282
+ <gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue=""/>
283
+ </gmd:level>
284
+ </gmd:DQ_Scope>
285
+ </gmd:scope>
286
+ <gmd:report>
287
+ <gmd:DQ_DomainConsistency xsi:type="DQ_DomainConsistency_Type">
288
+ <gmd:measureIdentification>
289
+ <gmd:RS_Identifier>
290
+ <gmd:code>
291
+ <gco:CharacterString>Conformity_001</gco:CharacterString>
292
+ </gmd:code>
293
+ <gmd:codeSpace>
294
+ <gco:CharacterString>INSPIRE</gco:CharacterString>
295
+ </gmd:codeSpace>
296
+ </gmd:RS_Identifier>
297
+ </gmd:measureIdentification>
298
+ <gmd:result>
299
+ <gmd:DQ_ConformanceResult xsi:type="DQ_ConformanceResult_Type">
300
+ <gmd:specification>
301
+ <gmd:CI_Citation>
302
+ <gmd:title>
303
+ <gco:CharacterString></gco:CharacterString>
304
+ </gmd:title>
305
+ <gmd:date>
306
+ <gmd:CI_Date>
307
+ <gmd:date>
308
+ <gco:Date>2010-12-08</gco:Date>
309
+ </gmd:date>
310
+ <gmd:dateType>
311
+ <gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/ML_gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication"/>
312
+ </gmd:dateType>
313
+ </gmd:CI_Date>
314
+ </gmd:date>
315
+ </gmd:CI_Citation>
316
+ </gmd:specification>
317
+ <gmd:explanation>
318
+ <gco:CharacterString>See the referenced specification</gco:CharacterString>
319
+ </gmd:explanation>
320
+ <gmd:pass>
321
+ <gco:Boolean>true</gco:Boolean>
322
+ </gmd:pass>
323
+ </gmd:DQ_ConformanceResult>
324
+ </gmd:result>
325
+ </gmd:DQ_DomainConsistency>
326
+ </gmd:report>
327
+ </gmd:DQ_DataQuality>
328
+ </gmd:dataQualityInfo>
329
+ {{/with}}
330
+ {{/contentList}}
331
+ </gmd:MD_Metadata>
@@ -0,0 +1,5 @@
1
+ maps: { table: 'gis.maps.table'}
2
+ metadata: { table: 'gis.metadata.table' }
3
+ rasters: { table: 'gis.rasters.table' }
4
+ registers: { table: 'gis.registers.table' }
5
+ services: { table: 'gis.services.table'}
package/package.json CHANGED
@@ -1,11 +1,18 @@
1
1
  {
2
2
  "name": "@opengis/gis",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "author": "Softpro",
6
- "main": "dist/index.js",
6
+ "main": "plugin.js",
7
7
  "files": [
8
- "dist/*"
8
+ "dist/*",
9
+ "module/*",
10
+ "server/*",
11
+ "plugin.js",
12
+ "utils.js",
13
+ "config.js",
14
+ "README.md",
15
+ "LICENSE"
9
16
  ],
10
17
  "scripts": {
11
18
  "dev": "vite",
@@ -33,8 +40,7 @@
33
40
  "marked": "^15.0.12",
34
41
  "vue": "^3.5.13",
35
42
  "vue-router": "^4.5.1",
36
- "vue3-smooth-dnd": "^0.0.6",
37
- "ws": "^8.16.0"
43
+ "vue3-smooth-dnd": "^0.0.6"
38
44
  },
39
45
  "devDependencies": {
40
46
  "@vitejs/plugin-vue": "^5.2.3",
package/plugin.js ADDED
@@ -0,0 +1,12 @@
1
+ import fp from 'fastify-plugin';
2
+
3
+ import { config } from '@opengis/fastify-table/utils.js';
4
+
5
+ config.prefix = config.prefix || '/api';
6
+
7
+ async function plugin(fastify, opts = config) {
8
+ // API
9
+ fastify.register(import('./server/routes/map/index.mjs'), opts);
10
+ fastify.register(import('./server/routes/gis/index.mjs'), opts);
11
+ }
12
+ export default fp(plugin)
@@ -0,0 +1,72 @@
1
+ import carto from 'carto';
2
+
3
+ import rasterExists from './rasterExists.js';
4
+ import rasterConfig from './rasterConfig.js';
5
+
6
+ export default async function createXML({
7
+ fullPath, srs, extent: bounds, send, size
8
+ }) {
9
+
10
+ const configFilePath = fullPath.replace('/preview1', '').replace('mosaic.vrt', 'config.yml')
11
+ const configData = await rasterConfig(configFilePath);
12
+
13
+ const rasterPreview = await rasterExists(fullPath, 1);
14
+
15
+ if (rasterPreview) {
16
+ send('preview:' + rasterPreview);
17
+ }
18
+
19
+ const rasterZoom = configData?.previewZoom ?? (rasterPreview && size?.includes('G') ? 16 : 0);
20
+
21
+ const rasterScaling = 'bilinear';
22
+
23
+ const Layer = [].concat([
24
+ {
25
+ id: 'test',
26
+ name: 'test',
27
+ geometry: 'raster',
28
+ properties: { minzoom: +rasterZoom + 1 },
29
+ srs: srs || '+proj=longlat +datum=WGS84 +no_defs ',
30
+ Datasource: {
31
+ // extent: bounds.join(','),
32
+ file: fullPath,
33
+ type: 'gdal',
34
+ },
35
+ }]).concat(
36
+ rasterZoom && rasterPreview ? [{
37
+ id: 'testpreview',
38
+ name: 'testpreview',
39
+ geometry: 'raster',
40
+ properties: { maxzoom: +rasterZoom },
41
+ srs: srs || '+proj=longlat +datum=WGS84 +no_defs ',
42
+ Datasource: {
43
+ // extent: bounds.join(','),
44
+ file: rasterPreview,
45
+ type: 'gdal',
46
+ },
47
+ }]
48
+ : [],
49
+ );
50
+
51
+ const data = `#testpreview{raster-opacity:1; raster-scaling:${rasterScaling};} #test{raster-opacity:1;raster-scaling:${rasterScaling}; } `;
52
+
53
+ const configJson = {
54
+ format: 'png',
55
+ Layer,
56
+ srs: '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over',
57
+ bounds: bounds || [-180, -85.05112877980659, 180, 85.05112877980659],
58
+ 'maximum-extent': '-20037508.34,-20037508.34,20037508.34,20037508.34',
59
+ center: [0, 0, 2],
60
+ minzoom: 1,
61
+ maxzoom: 25,
62
+ Stylesheet: [{ id: 'carto_css_style', data }],
63
+ };
64
+
65
+ const xmlFileText = new carto.Renderer().render(configJson);
66
+
67
+ if (!xmlFileText) {
68
+ return { status: 500, error: `Cant create xml for ${fullPath}` };
69
+ }
70
+
71
+ return xmlFileText;
72
+ }
@@ -0,0 +1,72 @@
1
+ import path from 'path';
2
+ import { randomUUID as uuidv4 } from 'crypto';
3
+ import mapnik from './mapnik.js';
4
+
5
+ import { config } from '@opengis/fastify-table/utils.js';
6
+
7
+ const { mapServerAddress } = mapnik();
8
+
9
+ function unixPath(data) {
10
+ if (mapServerAddress && !mapServerAddress?.includes('localhost') && data?.[1] === ':') {
11
+ return path.posix.join('/data/softpro', data.substr(3).replace(/\\/g, '/'));
12
+ }
13
+ return data;
14
+ }
15
+ const gdalWrapper = async ({
16
+ name, pathIn, pathOut, parameters, funcs, send = console.log,
17
+ }) => {
18
+ const timeStart = new Date();
19
+ const pref = name === 'gdalbuildvrt' ? ' -o ' : '';
20
+ const cmd = `${name} ${parameters || ''} ${unixPath(pathIn) || ''} ${pref} ${unixPath(pathOut) || ''}`;
21
+
22
+ if (mapServerAddress) {
23
+ const out = pref + (unixPath(pathOut) || '');
24
+ const obj = {
25
+ name, path: unixPath(pathIn), out, params: parameters,
26
+ };
27
+
28
+ const time = Date.now();
29
+ const { result, err } = await mapnik().gdal(obj);
30
+
31
+ if (config.local && false) {
32
+ send(cmd);
33
+ send(JSON.stringify(obj));
34
+ send(`${Date.now() - time}`);
35
+ }
36
+
37
+ if (err) {
38
+ const logObj = {
39
+ level: 'ERROR',
40
+ uuid: uuidv4(),
41
+ name: 'GDAL',
42
+ subname: 'GDALWRAPPER',
43
+ msec: new Date() - timeStart,
44
+ param: { cmd },
45
+ status: '500',
46
+ response: { error: err },
47
+ };
48
+ // log.error({ name: 'gdal', ...logObj });
49
+ send(err);
50
+ }
51
+ return { err, result };
52
+ }
53
+
54
+ const result = await funcs.exec(cmd, { send });
55
+ if (!result) {
56
+ const logObj = {
57
+ level: 'ERROR',
58
+ uuid: uuidv4(),
59
+ name: 'GDAL',
60
+ subname: 'GDALWRAPPER',
61
+ msec: new Date() - timeStart,
62
+ param: { cmd },
63
+ status: '500',
64
+ response: { error: `Cant execute ${cmd}` },
65
+ };
66
+ // log.error({ name: 'gdal', ...logObj });
67
+ return { err: `Cant execute ${cmd}` };
68
+ }
69
+ return { result };
70
+ };
71
+
72
+ export default gdalWrapper;
@@ -0,0 +1,101 @@
1
+ /* eslint-disable consistent-return */
2
+ import path from 'node:path';
3
+
4
+ import grpc from '@grpc/grpc-js';
5
+ import protoLoader from '@grpc/proto-loader';
6
+
7
+ import { config, logger } from '@opengis/fastify-table/utils.js';
8
+
9
+ config.ready = config.ready || {};
10
+
11
+ const { mapServerAddress } = config || {};
12
+
13
+ if (!mapServerAddress) {
14
+ throw new Error('mapServerAddress not set in config');
15
+ }
16
+
17
+ const proto = grpc.loadPackageDefinition(
18
+ protoLoader.loadSync(path.join(process.cwd(), '/server/plugins/mapnik/utils/map.proto'), {
19
+ keepCase: true,
20
+ longs: String,
21
+ enums: String,
22
+ defaults: true,
23
+ oneofs: true,
24
+ }),
25
+ );
26
+
27
+ const mapClient = mapServerAddress ? new proto.Map(
28
+ mapServerAddress,
29
+ grpc.credentials.createInsecure(),
30
+ ) : null;
31
+
32
+ mapClient.waitForReady(Date.now() + 5000, (err) => {
33
+ if (err) {
34
+ config.ready.mapnik = false;
35
+ console.error('Mapnik client connection timeout or failure:', err);
36
+ }
37
+ else {
38
+ config.ready.mapnik = true;
39
+ console.log('Mapnik client connected successfully.');
40
+ // You can now make RPC calls safely
41
+ }
42
+ });
43
+
44
+ const fsFuncsList = ['uploadFile', 'deleteFiles', 'downloadFile', 'checkFiles', 'fileList', 'readDir'];
45
+
46
+ const funcs1 = [
47
+ 'render', 'renderXML', 'loadXML', 'markerIcon', 'gdal',
48
+ 'printMap', 'log', 'sqlToShp', 'uploadFile', 'deleteFiles',
49
+ 'downloadFile', 'checkFiles', 'fileList', 'readDir', 'renderStatus',
50
+ ].reduce((p, el) => {
51
+ // eslint-disable-next-line no-param-reassign
52
+ p[el] = mapServerAddress ? async (data) => new Promise((res, rej) => {
53
+ const capitalized = fsFuncsList.includes(el) ? el : el.charAt(0).toUpperCase() + el.slice(1);
54
+ // eslint-disable-next-line no-param-reassign
55
+ if (data) {
56
+ if (data?.path && data.path?.[0] !== '"') {
57
+ // eslint-disable-next-line no-param-reassign
58
+ data.path = `"${data.path}"`;
59
+ }
60
+ }
61
+
62
+ if (el === 'downloadFile') {
63
+ const downloadBuffer = [];
64
+ const download = mapClient[capitalized].call(mapClient, data, (err, data1) => {
65
+ if (err || data1?.result?.startsWith?.('Usage:')) {
66
+ logger.file('grpc/mapnik', { error: err.toString(), stack: err.stack, ready: config.ready.mapnik });
67
+ if (!config.ready.mapnik) {
68
+ return rej(new Error('no grpc mapnik connection'));
69
+ }
70
+ return rej(err || data1?.result);
71
+ }
72
+ res(data1);
73
+ });
74
+ download.on('data', (resp) => {
75
+ downloadBuffer.push(...resp.chunk_data);
76
+ });
77
+ download.on('end', () => res({ data: Buffer.from(downloadBuffer) }));
78
+ }
79
+ else {
80
+ mapClient[capitalized].call(mapClient, data, (err, data1) => {
81
+ if (err || data1?.result?.startsWith?.('Usage:')) {
82
+ logger.file('grpc/mapnik', { error: err.toString(), stack: err.stack, ready: config.ready.mapnik });
83
+ if (!config.ready.mapnik) {
84
+ return rej(new Error('no grpc mapnik connection'));
85
+ }
86
+ return rej(err || data1?.result);
87
+ }
88
+ res(data1);
89
+ });
90
+ }
91
+ }) : null;
92
+ return p;
93
+ }, {});
94
+
95
+
96
+ const getMapnik = () => ({
97
+ ...funcs1,
98
+ mapServerAddress,
99
+ });
100
+
101
+ export default getMapnik;
@@ -0,0 +1,11 @@
1
+ import yaml from 'js-yaml';
2
+
3
+ import mapnik from './mapnik.js';
4
+
5
+ const { downloadFile } = mapnik();
6
+
7
+ export default async function rasterConfig(fullPath) {
8
+ if (!fullPath.endsWith('config.yml')) return;
9
+ const { data } = await downloadFile({ filePath: fullPath });
10
+ return yaml.load(data.toString('utf8'));
11
+ }
@@ -0,0 +1,21 @@
1
+ import path from 'node:path';
2
+
3
+ import mapnik from './mapnik.js';
4
+
5
+ const { checkFiles } = mapnik();
6
+
7
+ export default async function rasterExists(fullPath, preview = 0) {
8
+ const name = path.basename(fullPath).replace('.vrt', '.tif');
9
+ const findpath = preview ? path.posix.join(path.dirname(fullPath), 'preview1', name) : fullPath;
10
+ const { fileLoadingStatus: stat } = await checkFiles({ dir: path.dirname(findpath), filesSearch: [path.basename(findpath)] })
11
+
12
+ if (stat === 'OK') {
13
+ return findpath;
14
+ }
15
+
16
+ if (fullPath.includes('mosaic.vrt')) {
17
+ const { fileLoadingStatus: stat1 } = await checkFiles({ dir: path.dirname(findpath), filesSearch: ['mosaic.vrt'] });
18
+ console.log('stat: mosaic.vrt', stat1);
19
+ return stat1 === 'OK' ? findpath.replace('.tif', '.vrt') : null;
20
+ }
21
+ }