1
- # Geospatial Datapackage Specification
1
+ # (Geo) Spatial Data Package Specification
2
2
3
- This is an example Geospatial Data Package .
3
+ This document outlines a (geo) spatial data package [ profile ] ( https://specs.frictionlessdata.io/profiles/ ) for [ JSON-based ] ( https://en.wikipedia.org/wiki/JSON ) [ Frictionless Data Packages ] ( https://specs.frictionlessdata.io/data-package/ ) , also called a Snapshot .
4
4
5
- This datapackage follows the [ Frictionless Data Specification] ( https://frictionlessdata.io ) and defines a way of specifying a simple map view based on geojsons as a data resource to the package .
5
+ It follows the [ Frictionless Data Specification] ( https://frictionlessdata.io ) and provides a simple, human-readable way of defining map views with [ styled ] ( https://github.com/cividi/simplestyle-extended-spec ) [ GeoJSON ] ( https://geojson.org ) documents .
6
6
7
- ## Datapackage Structure
7
+ ## Usage
8
8
9
- ### Licenses and Sources
9
+ ### Editor Linting
10
+
11
+ To add linting support to your editor (e.g. VS Code has built in support) you can check directly against the [ JSON schema ` schema/snapshot.json ` ] ( schema/snapshot.json ) .
12
+
13
+ Simply add
14
+ ``` json
15
+ "$schema" : " https://raw.githubusercontent.com/cividi/spatial-data-package-spec/main/schemas/snapshot.json"
16
+ ```
17
+ to your data package and enable linting support for JSON schemas.
18
+
19
+ ### Validation with Frictionless Tools
20
+
21
+ Make sure to include
22
+ ``` json
23
+ "profile" : " https://raw.githubusercontent.com/cividi/spatial-data-package-spec/main/schemas/snapshot.json"
24
+ ```
25
+ in your Snapshot file. You can then use Frictionless Tools, e.g. data-cli to validate the schema and tabular data:
26
+ ``` sh
27
+ data validate . # Looks for datapackage.json in current folder
28
+ ```
29
+
30
+ ## Detailed Data Package Structure
31
+
32
+ In addition to the basic structure of a Data Package (cf. [ Frictionless Data Package] ( https://specs.frictionlessdata.io/data-package/ ) ) requiring
33
+
34
+ 1 . a ` name ` and
35
+ 1 . a ` resource `
10
36
11
- - ` Licenses: ` Defines the details of the licenses
12
- - ` Sources ` : Sources that have been used as input
37
+ a Snapshots (Spatial Data Package) also require (technical details see below)
38
+
39
+ 1 . a ` view ` – Defining how the map can be rendered
40
+ 1 . a ` source ` – Listing data sources
41
+ 1 . ` resource ` s added to a ` view ` to be either
42
+ - a simple-style GeoJSON – for Lines, Polygons, Markers
43
+ - a simple-style-extended GeoJSON – for Circles
44
+ - a mapbox style URL – for a background map
45
+
46
+ ### Examples
47
+
48
+ A valid example can be found in [ ` datapackage.json ` ] ( datapackage.json ) .
13
49
14
50
### Resources
15
51
@@ -18,7 +54,7 @@ An array of resources with links to or the data itself. Includes a resource `nam
18
54
Possible Mediatypes
19
55
20
56
- ` application/geo+json ` : GeoJSON with [ Mapbox Simple Styles] ( https://github.com/mapbox/simplestyle-spec )
21
- - ` application/vnd.simplestyle-extended ` : GeoJSON with [ Extended Simple Styles] ( https://github.com/cividitech /simplestyle-extended-spec )
57
+ - ` application/vnd.simplestyle-extended ` : GeoJSON with [ Extended Simple Styles] ( https://github.com/cividi /simplestyle-extended-spec )
22
58
- ` application/vnd.mapbox-vector-tile ` : Mapbox URI for styled vector tiles
23
59
24
60
### Views
@@ -31,54 +67,110 @@ For a map view compatible with the [Gemeindescan-Project](https://bitbucket.org/
31
67
32
68
``` json
33
69
{
34
- "name" : " mapview" ,
35
- "resources" : [
36
- " geojson-resource-name-1" ,
37
- " geojson-resource-name-2" ,
38
- " mapbox-resource-name"
70
+ "name" : " package-name" ,
71
+ "profile" : " https://raw.githubusercontent.com/cividi/spatial-data-package-spec/main/schemas/snapshot.json" ,
72
+ "views" :[
73
+ {
74
+ "name" : " mapview" ,
75
+ "resources" : [
76
+ " geojson-resource-name-1" ,
77
+ " mapbox-resource-name"
78
+ ],
79
+ "specType" : " gemeindescanSnapshot" ,
80
+ "spec" : {
81
+ "title" : " Snapshot Title" ,
82
+ "description" : " Snapshot Description" ,
83
+ "bounds" : [
84
+ " geo:47.43668029143545,9.355459213256836" ,
85
+ " geo:47.483104811626674,9.424123764038086"
86
+ ],
87
+ "legend" : [{
88
+ "label" : " Legend text" ,
89
+ "shape" : " square" ,
90
+ "size" : 0.5 ,
91
+ "primary" : true ,
92
+ "fillColor" : " #ffffff" ,
93
+ "fillOpacity" : 0.2 ,
94
+ "strokeColor" : " #000000" ,
95
+ "strokeOpacity" : 1 ,
96
+ "strokeWidth" : 1
97
+ }]
98
+ }
99
+ }
39
100
],
40
- "specType" : " gemeindescanSnapshot" ,
41
- "spec" : {
42
- "title" : " Snapshot Title" ,
43
- "description" : " Snapshot Description" ,
44
- "bounds" : [
45
- " geo:47.43668029143545,9.355459213256836" ,
46
- " geo:47.483104811626674,9.424123764038086"
47
- ],
48
- "legend" : [{
49
- "shape" : " square" ,
50
- "size" : 0.5 ,
51
- "color" : " #fff" ,
52
- "opacity" : 0.2 ,
53
- "label" : " Legend text" ,
54
- "primary" : true
55
- }]
56
- }
101
+ "resources" :[
102
+ {
103
+ "name" : " geojson-resource-name-1" ,
104
+ "mediatype" : " application/vnd.simplestyle-extended" ,
105
+ "data" : {
106
+ "type" : " FeatureCollection" ,
107
+ "features" : [{
108
+ "type" : " Feature" ,
109
+ "geometry" : {
110
+ "type" : " Point" ,
111
+ "coordinates" : [9.38771 , 47.46058 ]
112
+ },
113
+ "properties" : {
114
+ "fid" : 1 ,
115
+ "radius" : 200 ,
116
+ "fillColor" : " red" ,
117
+ "fillOpacity" : 0.2 ,
118
+ "title" : " Centerpoint" ,
119
+ "color" : " red" ,
120
+ "weight" : 1 ,
121
+ "opacity" : 0.8
122
+ }
123
+ }]
124
+ }
125
+ },
126
+ {
127
+ "path" : " mapbox://styles/gemeindescan/ckc4sha4310d21iszp8ri17u2" ,
128
+ "mediatype" : " application/vnd.mapbox-vector-tile" ,
129
+ "name" : " mapbox-resource-name"
130
+ }
131
+ ]
57
132
}
58
133
```
59
134
60
135
- ` name ` : name of the view (unique within datapackage)
61
136
- ` resources ` : an array of resource-names (see above) in order of rendering, first will be lowest in render order
62
- - ` specType ` : currently only ` map ` is supported here
137
+ - ` specType ` : currently only ` gemeindescanSnapshot ` is supported here
63
138
- ` spec ` : Metainformation to render a full map view
64
139
- ` title ` : Title of the View
65
140
- ` description ` : Description of the View
66
141
- ` bounds ` : array of bounding box support geopoints, denoted as Geo-URI as defined by [ RFC5870] ( https://tools.ietf.org/html/rfc5870 ) , latitude first
67
142
- ` legend ` : Legend entries for the view
143
+ - ` label ` : legend entry text
68
144
- ` shape ` : one of square, circle or line
69
145
- ` size ` : relative size in percent, either size of the sqaure or circle or line thickness
70
- - ` color ` : fill/main color
71
- - ` opacity ` : opacity value
72
- - ` label ` : legend entry text
73
146
- ` primary ` : can be used for simplifying the legend to less elements in size constraint contexts
147
+ - ` fillColor ` : fill/main color
148
+ - ` fillOpacity ` : opacity value
149
+ - ` strokeColor ` : stroke color
150
+ - ` strokeOpacity ` : stroke opacity
151
+ - ` strokeWidth ` : stroke width
152
+
153
+ ### Licenses and Sources
154
+
155
+ - ` Licenses: ` * optional* Defines the details of the licenses
156
+ - ` Sources ` : Sources that have been used
74
157
75
158
### Contributors and Maintainers
76
159
77
160
Each represents an array of people and institutions, companies involved in creating and maintaining the datapackage.
78
161
162
+ ## Unit testing
163
+
164
+ To validate [ ` datapackage.json ` ] ( datapackage.json ) against the current schema, run
165
+
166
+ ``` sh
167
+ npm install
168
+ npm run test
169
+ ```
170
+
79
171
## Sample Data
80
172
81
- Data comes from open data sources via the [ CIVIDI project] ( https://cividi.ch ) .
173
+ Data comes from open data sources via the [ cividi project] ( https://cividi.ch ) .
82
174
83
175
## License
84
176
0 commit comments