urbanopt-geojson 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/.rakeTasks +7 -0
  4. data/.rdoc_options +43 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +10 -0
  7. data/.travis.yml +35 -0
  8. data/CHANGELOG.md +5 -0
  9. data/Gemfile +27 -0
  10. data/Jenkinsfile +10 -0
  11. data/LICENSE.md +27 -0
  12. data/RDOC_MAIN.md +48 -0
  13. data/README.md +40 -0
  14. data/Rakefile +45 -0
  15. data/deploy_docs.sh +4 -0
  16. data/doc_templates/LICENSE.md +27 -0
  17. data/doc_templates/README.md.erb +42 -0
  18. data/doc_templates/copyright_erb.txt +31 -0
  19. data/doc_templates/copyright_js.txt +4 -0
  20. data/doc_templates/copyright_ruby.txt +29 -0
  21. data/docs/.gitignore +3 -0
  22. data/docs/.vuepress/components/BuildingProperties.vue +12 -0
  23. data/docs/.vuepress/components/DistrictSystemProperties.vue +12 -0
  24. data/docs/.vuepress/components/ElectricalConnectorProperties.vue +12 -0
  25. data/docs/.vuepress/components/ElectricalJunctionProperties.vue +12 -0
  26. data/docs/.vuepress/components/InnerJsonSchema.vue +80 -0
  27. data/docs/.vuepress/components/JsonSchema.vue +12 -0
  28. data/docs/.vuepress/components/RegionProperties.vue +12 -0
  29. data/docs/.vuepress/components/SiteProperties.vue +12 -0
  30. data/docs/.vuepress/components/StaticLink.vue +8 -0
  31. data/docs/.vuepress/components/ThermalConnectorProperties.vue +12 -0
  32. data/docs/.vuepress/components/ThermalJunctionProperties.vue +12 -0
  33. data/docs/.vuepress/config.js +22 -0
  34. data/docs/.vuepress/highlight.js +8 -0
  35. data/docs/.vuepress/public/custom_rdoc_styles.css +64 -0
  36. data/docs/.vuepress/utils.js +17 -0
  37. data/docs/README.md +30 -0
  38. data/docs/doc/created.rid +0 -0
  39. data/docs/package-lock.json +11771 -0
  40. data/docs/package.json +22 -0
  41. data/docs/schemas/building-properties.md +3 -0
  42. data/docs/schemas/district-system-properties.md +3 -0
  43. data/docs/schemas/electrical-connector-properties.md +3 -0
  44. data/docs/schemas/electrical-junction-properties.md +3 -0
  45. data/docs/schemas/region-properties.md +3 -0
  46. data/docs/schemas/site-properties.md +3 -0
  47. data/docs/schemas/thermal-connector-properties.md +3 -0
  48. data/docs/schemas/thermal-junction-properties.md +3 -0
  49. data/lib/measures/.rubocop.yml +5 -0
  50. data/lib/measures/urban_geometry_creation/LICENSE.md +27 -0
  51. data/lib/measures/urban_geometry_creation/README.md +48 -0
  52. data/lib/measures/urban_geometry_creation/README.md.erb +42 -0
  53. data/lib/measures/urban_geometry_creation/measure.rb +199 -0
  54. data/lib/measures/urban_geometry_creation/measure.xml +139 -0
  55. data/lib/measures/urban_geometry_creation/tests/nrel_stm_footprints.geojson +3238 -0
  56. data/lib/measures/urban_geometry_creation/tests/shadowed_tests.rb +80 -0
  57. data/lib/measures/urban_geometry_creation/tests/urban_geometry_creation_test.rb +143 -0
  58. data/lib/measures/urban_geometry_creation_zoning/LICENSE.md +27 -0
  59. data/lib/measures/urban_geometry_creation_zoning/README.md +48 -0
  60. data/lib/measures/urban_geometry_creation_zoning/README.md.erb +42 -0
  61. data/lib/measures/urban_geometry_creation_zoning/measure.rb +203 -0
  62. data/lib/measures/urban_geometry_creation_zoning/measure.xml +133 -0
  63. data/lib/measures/urban_geometry_creation_zoning/tests/nrel_stm_footprints.geojson +3238 -0
  64. data/lib/measures/urban_geometry_creation_zoning/tests/urban_geometry_creation_test.rb +143 -0
  65. data/lib/urbanopt/geojson.rb +41 -0
  66. data/lib/urbanopt/geojson/building.rb +341 -0
  67. data/lib/urbanopt/geojson/district_system.rb +53 -0
  68. data/lib/urbanopt/geojson/extension.rb +63 -0
  69. data/lib/urbanopt/geojson/feature.rb +206 -0
  70. data/lib/urbanopt/geojson/geo_file.rb +154 -0
  71. data/lib/urbanopt/geojson/helper.rb +340 -0
  72. data/lib/urbanopt/geojson/logging.rb +46 -0
  73. data/lib/urbanopt/geojson/mapper_classes.rb +85 -0
  74. data/lib/urbanopt/geojson/model.rb +133 -0
  75. data/lib/urbanopt/geojson/region.rb +55 -0
  76. data/lib/urbanopt/geojson/schema/building_properties.json +358 -0
  77. data/lib/urbanopt/geojson/schema/district_system_properties.json +137 -0
  78. data/lib/urbanopt/geojson/schema/electrical_connector_properties.json +77 -0
  79. data/lib/urbanopt/geojson/schema/electrical_junction_properties.json +64 -0
  80. data/lib/urbanopt/geojson/schema/geojson_schema.json +323 -0
  81. data/lib/urbanopt/geojson/schema/region_properties.json +93 -0
  82. data/lib/urbanopt/geojson/schema/site_properties.json +87 -0
  83. data/lib/urbanopt/geojson/schema/thermal_connector_properties.json +107 -0
  84. data/lib/urbanopt/geojson/schema/thermal_junction_properties.json +83 -0
  85. data/lib/urbanopt/geojson/update_areas.rb +102 -0
  86. data/lib/urbanopt/geojson/validate_geojson.rb +147 -0
  87. data/lib/urbanopt/geojson/version.rb +35 -0
  88. data/lib/urbanopt/geojson/workflows/building.osw +187 -0
  89. data/lib/urbanopt/geojson/workflows/building.osw.out +2806 -0
  90. data/lib/urbanopt/geojson/workflows/district_system.osw +84 -0
  91. data/lib/urbanopt/geojson/workflows/district_system.osw.out +646 -0
  92. data/lib/urbanopt/geojson/zoning.rb +134 -0
  93. data/package-lock.json +3 -0
  94. data/urbanopt-geojson-gem.gemspec +39 -0
  95. metadata +238 -0
@@ -0,0 +1,137 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "id": "http://json-schema.org/openstudio-urban-modeling/district_system_properties.json#",
4
+ "title": "URBANopt District System",
5
+ "description": "Schema for an URBANopt District System object",
6
+ "type": "object",
7
+ "properties": {
8
+ "id": {
9
+ "description": "Unique id used to refer to this feature within this dataset.",
10
+ "type": "string"
11
+ },
12
+ "project_id": {
13
+ "description": "Project which this feature belongs to.",
14
+ "type": "string"
15
+ },
16
+ "type": {
17
+ "description": "Type of feature.",
18
+ "type": "string",
19
+ "enum": [
20
+ "District System"
21
+ ]
22
+ },
23
+ "source_name": {
24
+ "description": "Name of the original data source.",
25
+ "type": "string"
26
+ },
27
+ "source_id": {
28
+ "description": "Id of the feature in original data source.",
29
+ "type": "string"
30
+ },
31
+ "name": {
32
+ "description": "Feature name",
33
+ "type": "string"
34
+ },
35
+ "legal_name": {
36
+ "description": "Legal name used to identify this feature.",
37
+ "type": "string"
38
+ },
39
+ "address": {
40
+ "description": "Street address",
41
+ "type": "string"
42
+ },
43
+ "district_system_type": {
44
+ "$ref": "#/definitions/districtSystemType"
45
+ },
46
+ "detailed_model_filename": {
47
+ "description": "Name of a detailed model which can be loaded from disk as a seed model or complete model. Mapper class decides which measures to disable if this is present.",
48
+ "type": "string"
49
+ },
50
+ "weather_filename": {
51
+ "description": "Name of EPW weather file for this district system. Defaults to site's weather_filename.",
52
+ "type": "string"
53
+ },
54
+ "tariff_filename": {
55
+ "description": "Name of the tariff file for this district system. Defaults to site's tariff_filename.",
56
+ "type": "string"
57
+ },
58
+ "equipment_1": {
59
+ "description": "First piece of equipment used in this plant",
60
+ "$ref": "#/definitions/equipmentType",
61
+ "type": "string"
62
+ },
63
+ "equipment_2": {
64
+ "description": "Second piece of equipment used in this plant",
65
+ "$ref": "#/definitions/equipmentType",
66
+ "type": "string"
67
+ },
68
+ "equipment_3": {
69
+ "description": "Third piece of equipment used in this plant",
70
+ "$ref": "#/definitions/equipmentType",
71
+ "type": "string"
72
+ },
73
+ "equipment_4": {
74
+ "description": "Fourth piece of equipment used in this plant",
75
+ "$ref": "#/definitions/equipmentType",
76
+ "type": "string"
77
+ },
78
+ "equipment_5": {
79
+ "description": "Fifth piece of equipment used in this plant",
80
+ "$ref": "#/definitions/equipmentType",
81
+ "type": "string"
82
+ },
83
+ "user_data": {
84
+ "description": "Arbitrary user data"
85
+ }
86
+ },
87
+ "required": [
88
+ "type",
89
+ "district_system_type"
90
+ ],
91
+ "additionalProperties": false,
92
+ "definitions": {
93
+ "districtSystemType": {
94
+ "description": "Type of district system.",
95
+ "type": "string",
96
+ "enum": [
97
+ "District Thermal",
98
+ "Community Photovoltaic",
99
+ "Transformer"
100
+ ]
101
+ },
102
+ "equipmentType": {
103
+ "description": "Type of equipment, listed in order of load served.",
104
+ "type": "string",
105
+ "enum": [
106
+ "Air-Cooled Chiller--Cold Water",
107
+ "Air-Cooled Chiller--Ambient Water",
108
+ "Water-Cooled Chiller--Cold Water",
109
+ "Water-Cooled Chiller---Ambient Water",
110
+ "Cooling Tower--Heat Rejection from Chiller, Cold Water",
111
+ "Cooling Tower--Heat Rejection from Chiller, Ambient Water",
112
+ "Cooling Tower--Direct--Chilled Water",
113
+ "Cooling Tower--Direct--Ambient Water",
114
+ "Boiler--Hot Water",
115
+ "Boiler--Ambient Water",
116
+ "Boiler--Combined Heat and Power--Hot Water",
117
+ "Boiler--Combined Heat and Power--Ambient Water",
118
+ "Water to Water Heat Pump--Ambient Water",
119
+ "Water to Water Heat Pump--Cold Water",
120
+ "Water to Water Heat Pump--Hot Water",
121
+ "Air to Water Heat Pump--Ambient Water",
122
+ "Air to Water Heat Pump--Cold Water",
123
+ "Air to Water Heat Pump--Hot Water",
124
+ "Ground Source Heat Pump--Ambient Water",
125
+ "Ground Source Heat Pump--Cold Water",
126
+ "Ground Source Heat Pump--Hot Water",
127
+ "Solar Thermal Array--Ambient Water",
128
+ "Solar Thermal Array--Hot Water",
129
+ "Storage--Hot Water",
130
+ "Storage--Cold Water",
131
+ "Storage--Ambient Water",
132
+ "Waste Heat Source--Hot Water",
133
+ "Waste Heat Source--Ambient Water"
134
+ ]
135
+ }
136
+ }
137
+ }
@@ -0,0 +1,77 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "id": "http://json-schema.org/openstudio-urban-modeling/district_system_properties.json#",
4
+ "title": "URBANopt Electrical Connector",
5
+ "description": "Schema for an URBANopt Electrical Connector object",
6
+ "type": "object",
7
+ "properties": {
8
+ "id": {
9
+ "description": "Unique id used to refer to this feature within this dataset.",
10
+ "type": "string"
11
+ },
12
+ "project_id": {
13
+ "description": "Project which this feature belongs to.",
14
+ "type": "string"
15
+ },
16
+ "type": {
17
+ "description": "Type of feature.",
18
+ "type": "string",
19
+ "enum": [
20
+ "ElectricalConnector"
21
+ ]
22
+ },
23
+ "source_name": {
24
+ "description": "Name of the original data source.",
25
+ "type": "string"
26
+ },
27
+ "source_id": {
28
+ "description": "Id of the feature in original data source.",
29
+ "type": "string"
30
+ },
31
+ "name": {
32
+ "description": "Feature name",
33
+ "type": "string"
34
+ },
35
+ "connector_type": {
36
+ "$ref": "#/definitions/ElectricalConnectorType"
37
+ },
38
+ "lengths": {
39
+ "description": "Length (ft) of each segment, generated on export.",
40
+ "type": "array",
41
+ "items": {
42
+ "type": "number"
43
+ }
44
+ },
45
+ "total_length": {
46
+ "description": "Total length (ft) of the connector, generated on export.",
47
+ "type": "number"
48
+ },
49
+ "start_junction_id": {
50
+ "description": "Id of the junction that this connector starts at.",
51
+ "type": "string"
52
+ },
53
+ "end_junction_id": {
54
+ "description": "Id of the junction that this connector ends at.",
55
+ "type": "string"
56
+ },
57
+ "user_data": {
58
+ "description": "Arbitrary user data"
59
+ }
60
+ },
61
+ "required": [
62
+ "type",
63
+ "connector_type",
64
+ "start_junction_id",
65
+ "end_junction_id"
66
+ ],
67
+ "additionalProperties": false,
68
+ "definitions": {
69
+ "ElectricalConnectorType": {
70
+ "description": "Type of electrical connector",
71
+ "type": "string",
72
+ "enum": [
73
+ "Wire"
74
+ ]
75
+ }
76
+ }
77
+ }
@@ -0,0 +1,64 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "id": "http://json-schema.org/openstudio-urban-modeling/district_system_properties.json#",
4
+ "title": "URBANopt Electrical Junction",
5
+ "description": "Schema for an URBANopt Electrical Junction object",
6
+ "type": "object",
7
+ "properties": {
8
+ "id": {
9
+ "description": "Unique id used to refer to this feature within this dataset.",
10
+ "type": "string"
11
+ },
12
+ "project_id": {
13
+ "description": "Project which this feature belongs to.",
14
+ "type": "string"
15
+ },
16
+ "type": {
17
+ "description": "Type of feature.",
18
+ "type": "string",
19
+ "enum": [
20
+ "ElectricalJunction"
21
+ ]
22
+ },
23
+ "source_name": {
24
+ "description": "Name of the original data source.",
25
+ "type": "string"
26
+ },
27
+ "source_id": {
28
+ "description": "Id of the feature in original data source.",
29
+ "type": "string"
30
+ },
31
+ "name": {
32
+ "description": "Feature name",
33
+ "type": "string"
34
+ },
35
+ "connector_type": {
36
+ "$ref": "#/definitions/ElectricalJunctionType"
37
+ },
38
+ "building_id": {
39
+ "description": "Id of building if this junction is inside a building.",
40
+ "type": "string"
41
+ },
42
+ "district_system_id": {
43
+ "description": "Id of district system if this junction is inside a district system.",
44
+ "type": "string"
45
+ },
46
+ "user_data": {
47
+ "description": "Arbitrary user data"
48
+ }
49
+ },
50
+ "required": [
51
+ "type",
52
+ "connector_type"
53
+ ],
54
+ "additionalProperties": false,
55
+ "definitions": {
56
+ "ElectricalJunctionType": {
57
+ "description": "Type of electrical junction",
58
+ "type": "string",
59
+ "enum": [
60
+ "ElectricalPanel"
61
+ ]
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,323 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "id": "http://json-schema.org/geojson/geojson.json#",
4
+ "title": "Geo JSON object",
5
+ "description": "Schema for a Geo JSON object",
6
+ "type": "object",
7
+ "required": [
8
+ "type"
9
+ ],
10
+ "properties": {
11
+ "crs": {
12
+ "$ref": "#/definitions/crs"
13
+ },
14
+ "bbox": {
15
+ "$ref": "#/definitions/bbox"
16
+ }
17
+ },
18
+ "oneOf": [
19
+ {
20
+ "$ref": "#/definitions/bbox"
21
+ }, {
22
+ "$ref": "#/definitions/geometryCollection"
23
+ }, {
24
+ "$ref": "#/definitions/feature"
25
+ }, {
26
+ "$ref": "#/definitions/featureCollection"
27
+ }
28
+ ],
29
+ "definitions": {
30
+ "position": {
31
+ "description": "A single position",
32
+ "type": "array",
33
+ "minItems": 2,
34
+ "items": [
35
+ {
36
+ "type": "number"
37
+ }, {
38
+ "type": "number"
39
+ }
40
+ ],
41
+ "additionalItems": false
42
+ },
43
+ "positionArray": {
44
+ "description": "An array of positions",
45
+ "type": "array",
46
+ "items": {
47
+ "$ref": "#/definitions/position"
48
+ }
49
+ },
50
+ "lineString": {
51
+ "description": "An array of two or more positions",
52
+ "allOf": [
53
+ {
54
+ "$ref": "#/definitions/positionArray"
55
+ }, {
56
+ "minItems": 2
57
+ }
58
+ ]
59
+ },
60
+ "linearRing": {
61
+ "description": "An array of four positions where the first equals the last",
62
+ "allOf": [
63
+ {
64
+ "$ref": "#/definitions/positionArray"
65
+ }, {
66
+ "minItems": 4
67
+ }
68
+ ]
69
+ },
70
+ "polygon": {
71
+ "description": "An array of linear rings",
72
+ "type": "array",
73
+ "items": {
74
+ "$ref": "#/definitions/linearRing"
75
+ }
76
+ },
77
+ "geometry": {
78
+ "title": "geometry",
79
+ "description": "One geometry as defined by GeoJSON",
80
+ "type": "object",
81
+ "required": [
82
+ "type", "coordinates"
83
+ ],
84
+ "oneOf": [
85
+ {
86
+ "title": "Point",
87
+ "properties": {
88
+ "type": {
89
+ "enum": [
90
+ "Point"
91
+ ]
92
+ },
93
+ "coordinates": {
94
+ "$ref": "#/definitions/position"
95
+ }
96
+ }
97
+ }, {
98
+ "title": "MultiPoint",
99
+ "properties": {
100
+ "type": {
101
+ "enum": [
102
+ "MultiPoint"
103
+ ]
104
+ },
105
+ "coordinates": {
106
+ "$ref": "#/definitions/positionArray"
107
+ }
108
+ }
109
+ }, {
110
+ "title": "LineString",
111
+ "properties": {
112
+ "type": {
113
+ "enum": [
114
+ "LineString"
115
+ ]
116
+ },
117
+ "coordinates": {
118
+ "$ref": "#/definitions/lineString"
119
+ }
120
+ }
121
+ }, {
122
+ "title": "MultiLineString",
123
+ "properties": {
124
+ "type": {
125
+ "enum": [
126
+ "MultiLineString"
127
+ ]
128
+ },
129
+ "coordinates": {
130
+ "type": "array",
131
+ "items": {
132
+ "$ref": "#/definitions/lineString"
133
+ }
134
+ }
135
+ }
136
+ }, {
137
+ "title": "Polygon",
138
+ "properties": {
139
+ "type": {
140
+ "enum": [
141
+ "Polygon"
142
+ ]
143
+ },
144
+ "coordinates": {
145
+ "$ref": "#/definitions/polygon"
146
+ }
147
+ }
148
+ }, {
149
+ "title": "MultiPolygon",
150
+ "properties": {
151
+ "type": {
152
+ "enum": [
153
+ "MultiPolygon"
154
+ ]
155
+ },
156
+ "coordinates": {
157
+ "type": "array",
158
+ "items": {
159
+ "$ref": "#/definitions/polygon"
160
+ }
161
+ }
162
+ }
163
+ }
164
+ ]
165
+ },
166
+ "linkedObject": {
167
+ "type": "object",
168
+ "required": [
169
+ "href"
170
+ ],
171
+ "properties": {
172
+ "href": {
173
+ "type": "string",
174
+ "format": "uri",
175
+ "FIXME": "spec says \"dereferenceable\", cannot enforce that"
176
+ },
177
+ "type": {
178
+ "type": "string",
179
+ "description": "Suggested values: proj4, ogjwkt, esriwkt"
180
+ }
181
+ }
182
+ },
183
+ "linkedCrs": {
184
+ "properties": {
185
+ "type": {
186
+ "enum": [
187
+ "link"
188
+ ]
189
+ },
190
+ "properties": {
191
+ "$ref": "#/definitions/linkedObject"
192
+ }
193
+ }
194
+ },
195
+ "namedCrs": {
196
+ "properties": {
197
+ "type": {
198
+ "enum": [
199
+ "name"
200
+ ]
201
+ },
202
+ "properties": {
203
+ "required": [
204
+ "name"
205
+ ],
206
+ "additionalProperties": false,
207
+ "properties": {
208
+ "name": {
209
+ "type": "string",
210
+ "FIXME": "semantic validation necessary"
211
+ }
212
+ }
213
+ }
214
+ }
215
+ },
216
+ "crs": {
217
+ "$schema": "http://json-schema.org/draft-04/schema#",
218
+ "title": "crs",
219
+ "description": "a Coordinate Reference System object",
220
+ "type": [
221
+ "object", "null"
222
+ ],
223
+ "required": [
224
+ "type", "properties"
225
+ ],
226
+ "properties": {
227
+ "type": {
228
+ "type": "string"
229
+ },
230
+ "properties": {
231
+ "type": "object"
232
+ }
233
+ },
234
+ "additionalProperties": false,
235
+ "oneOf": [
236
+ {
237
+ "$ref": "#/definitions/namedCrs"
238
+ }, {
239
+ "$ref": "#/definitions/linkedCrs"
240
+ }
241
+ ]
242
+ },
243
+ "bbox": {
244
+ "description": "A bounding box as defined by GeoJSON",
245
+ "FIXME": "unenforceable constraint: even number of elements in array",
246
+ "type": "array",
247
+ "items": {
248
+ "type": "number"
249
+ }
250
+ },
251
+ "geometryCollection": {
252
+ "title": "GeometryCollection",
253
+ "description": "A collection of geometry objects",
254
+ "required": [
255
+ "geometries"
256
+ ],
257
+ "properties": {
258
+ "type": {
259
+ "enum": [
260
+ "GeometryCollection"
261
+ ]
262
+ },
263
+ "geometries": {
264
+ "type": "array",
265
+ "items": {
266
+ "$ref": "#/definitions/geometry"
267
+ }
268
+ }
269
+ }
270
+ },
271
+ "feature": {
272
+ "title": "Feature",
273
+ "description": "A Geo JSON feature object",
274
+ "required": [
275
+ "geometry", "properties"
276
+ ],
277
+ "properties": {
278
+ "type": {
279
+ "enum": [
280
+ "Feature"
281
+ ]
282
+ },
283
+ "geometry": {
284
+ "oneOf": [
285
+ {
286
+ "type": "null"
287
+ }, {
288
+ "$ref": "#/definitions/geometry"
289
+ }
290
+ ]
291
+ },
292
+ "properties": {
293
+ "type": [
294
+ "object", "null"
295
+ ]
296
+ },
297
+ "id": {
298
+ "FIXME": "may be there, type not known (string? number?)"
299
+ }
300
+ }
301
+ },
302
+ "featureCollection": {
303
+ "title": "FeatureCollection",
304
+ "description": "A Geo JSON feature collection",
305
+ "required": [
306
+ "features"
307
+ ],
308
+ "properties": {
309
+ "type": {
310
+ "enum": [
311
+ "FeatureCollection"
312
+ ]
313
+ },
314
+ "features": {
315
+ "type": "array",
316
+ "items": {
317
+ "$ref": "#/definitions/feature"
318
+ }
319
+ }
320
+ }
321
+ }
322
+ }
323
+ }