@opengis/gis 0.0.15 → 0.0.17

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 (97) hide show
  1. package/package.json +2 -9
  2. package/module/gis/card/gis.maps.table/index.yml +0 -11
  3. package/module/gis/card/gis.maps.table/main_info.hbs +0 -25
  4. package/module/gis/card/gis.maps.table/maps_layers.hbs +0 -19
  5. package/module/gis/card/gis.metadata.table/index.yml +0 -19
  6. package/module/gis/card/gis.metadata.table/main_info.hbs +0 -21
  7. package/module/gis/card/gis.metadata.table/metadata_info.hbs +0 -28
  8. package/module/gis/card/gis.metadata.table/other.hbs +0 -26
  9. package/module/gis/card/gis.rasters.table/index.yml +0 -8
  10. package/module/gis/card/gis.rasters.table/main_info.hbs +0 -27
  11. package/module/gis/card/gis.registers.table/cls.hbs +0 -36
  12. package/module/gis/card/gis.registers.table/columns.hbs +0 -83
  13. package/module/gis/card/gis.registers.table/filters.hbs +0 -80
  14. package/module/gis/card/gis.registers.table/index.yml +0 -21
  15. package/module/gis/card/gis.registers.table/main_info.hbs +0 -35
  16. package/module/gis/card/gis.registers.table/source.hbs +0 -45
  17. package/module/gis/card/gis.services.table/attributes.hbs +0 -85
  18. package/module/gis/card/gis.services.table/filters.hbs +0 -83
  19. package/module/gis/card/gis.services.table/index.yml +0 -20
  20. package/module/gis/card/gis.services.table/main_info.hbs +0 -27
  21. package/module/gis/card/gis.services.table/source.hbs +0 -25
  22. package/module/gis/cls/bool.yes_no.json +0 -12
  23. package/module/gis/cls/encoding.json +0 -14
  24. package/module/gis/cls/geom_type.json +0 -14
  25. package/module/gis/cls/gis.column_type.json +0 -34
  26. package/module/gis/cls/gis.column_view_type.json +0 -18
  27. package/module/gis/cls/gis.filter_type.json +0 -22
  28. package/module/gis/cls/language.json +0 -10
  29. package/module/gis/cls/meta.service_type.json +0 -43
  30. package/module/gis/cls/ogc.service.json +0 -22
  31. package/module/gis/cls/service_type.json +0 -42
  32. package/module/gis/cls/source_type.json +0 -10
  33. package/module/gis/cls/standarts.json +0 -6
  34. package/module/gis/cls/topic_category.json +0 -107
  35. package/module/gis/cls/update_frequency.json +0 -30
  36. package/module/gis/form/gis.group_list.form.json +0 -17
  37. package/module/gis/form/gis.maps.form.json +0 -67
  38. package/module/gis/form/gis.metadata.form.json +0 -240
  39. package/module/gis/form/gis.ogc_service.form.json +0 -36
  40. package/module/gis/form/gis.rasters.form.json +0 -100
  41. package/module/gis/form/gis.registers.form.json +0 -264
  42. package/module/gis/form/gis.registers_column.form.json +0 -77
  43. package/module/gis/form/gis.registers_filter.form.json +0 -65
  44. package/module/gis/form/gis.services.form.json +0 -300
  45. package/module/gis/form/gis.services_attributes.form.json +0 -68
  46. package/module/gis/form/gis.services_filter.form.json +0 -65
  47. package/module/gis/menu.json +0 -43
  48. package/module/gis/select/gis.group_list.sql +0 -1
  49. package/module/gis/select/pg.columns.parent.sql +0 -6
  50. package/module/gis/select/pg.table_name.sql +0 -17
  51. package/module/gis/select/service_id.sql +0 -1
  52. package/module/gis/table/gis.maps.table.json +0 -78
  53. package/module/gis/table/gis.metadata.table.json +0 -71
  54. package/module/gis/table/gis.ogc_service.table.json +0 -81
  55. package/module/gis/table/gis.rasters.table.json +0 -98
  56. package/module/gis/table/gis.registers.table.json +0 -79
  57. package/module/gis/table/gis.services.table.json +0 -105
  58. package/module/gis/table/site.gis.registers.table.json +0 -75
  59. package/module/gis/table/site.gis.services.table.json +0 -104
  60. package/module/gis/templates/ISO19136_2017_gml_template.xml +0 -331
  61. package/module/gis/tokens.yml +0 -5
  62. package/plugin.js +0 -12
  63. package/server/plugins/mapnik/funcs/createXML.js +0 -72
  64. package/server/plugins/mapnik/funcs/gdalWrapper.js +0 -72
  65. package/server/plugins/mapnik/funcs/mapnik.js +0 -101
  66. package/server/plugins/mapnik/funcs/rasterConfig.js +0 -11
  67. package/server/plugins/mapnik/funcs/rasterExists.js +0 -21
  68. package/server/plugins/mapnik/funcs/rasterInfo.js +0 -109
  69. package/server/plugins/mapnik/funcs/rasterVrt.js +0 -56
  70. package/server/plugins/mapnik/funcs/rasterXML.js +0 -65
  71. package/server/plugins/mapnik/funcs/rootFolder.mjs +0 -8
  72. package/server/plugins/mapnik/index.mjs +0 -12
  73. package/server/plugins/mapnik/utils/map.proto +0 -241
  74. package/server/routes/gis/index.mjs +0 -19
  75. package/server/routes/gis/metadata/metadataXML.js +0 -13
  76. package/server/routes/gis/registers/funcs/classifiers.js +0 -26
  77. package/server/routes/gis/registers/funcs/columns.js +0 -5
  78. package/server/routes/gis/registers/funcs/handleRegistryRequest.js +0 -100
  79. package/server/routes/gis/registers/gis.registry.js +0 -32
  80. package/server/routes/gis/registers/gis.registry.list.js +0 -59
  81. package/server/routes/gis/registers/insert.columns.js +0 -107
  82. package/server/routes/gis/registers/insert.filters.js +0 -110
  83. package/server/routes/gis/registers/map.registry.js +0 -79
  84. package/server/routes/gis/services/get.layer.geom.js +0 -27
  85. package/server/routes/map/controllers/map.js +0 -123
  86. package/server/routes/map/controllers/mapCatalog.js +0 -55
  87. package/server/routes/map/controllers/mapCatalogAttribute.js +0 -56
  88. package/server/routes/map/controllers/mapFeatures.js +0 -120
  89. package/server/routes/map/controllers/mapFormat.js +0 -111
  90. package/server/routes/map/controllers/mapTiles.js +0 -148
  91. package/server/routes/map/controllers/maps.js +0 -16
  92. package/server/routes/map/controllers/marker_icon.js +0 -42
  93. package/server/routes/map/controllers/rtile.js +0 -133
  94. package/server/routes/map/controllers/vtile.js +0 -146
  95. package/server/routes/map/index.mjs +0 -51
  96. package/server/routes/root.mjs +0 -3
  97. package/utils.js +0 -9
@@ -1,331 +0,0 @@
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>
@@ -1,5 +0,0 @@
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/plugin.js DELETED
@@ -1,12 +0,0 @@
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)
@@ -1,72 +0,0 @@
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
- }
@@ -1,72 +0,0 @@
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;
@@ -1,101 +0,0 @@
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;
@@ -1,11 +0,0 @@
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
- }
@@ -1,21 +0,0 @@
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
- }