@@ -39,6 +39,8 @@ angular.module('SEED.controller.inventory_detail_map', []).controller('inventory
3939 const init = ( ) => {
4040 $scope . bounding_box = $scope . item_state . bounding_box . replace ( / ^ S R I D = \d + ; / , '' ) ;
4141 $scope . centroid = $scope . item_state . centroid . replace ( / ^ S R I D = \d + ; / , '' ) ;
42+ const footprint = $scope . item_state . property_footprint || $scope . item_state . taxlot_footprint ;
43+ $scope . footprint = footprint ?. replace ( / ^ S R I D = \d + ; / , '' ) ;
4244
4345 // store a mapping of layers z-index and visibility
4446 $scope . layers = { } ;
@@ -49,13 +51,15 @@ angular.module('SEED.controller.inventory_detail_map', []).controller('inventory
4951 $scope . layers . building_centroid_layer = { zIndex : 4 , visible : 1 } ;
5052 $scope . layers . taxlot_bb_layer = { zIndex : 5 , visible : 0 } ;
5153 $scope . layers . taxlot_centroid_layer = { zIndex : 6 , visible : 0 } ;
54+ $scope . layers . footprint = { zIndex : 7 , visible : 1 } ;
5255 } else {
5356 // taxlots
5457 $scope . layers . points_layer = { zIndex : 2 , visible : 1 } ;
5558 $scope . layers . building_bb_layer = { zIndex : 3 , visible : 0 } ;
5659 $scope . layers . building_centroid_layer = { zIndex : 4 , visible : 0 } ;
5760 $scope . layers . taxlot_bb_layer = { zIndex : 5 , visible : 1 } ;
5861 $scope . layers . taxlot_centroid_layer = { zIndex : 6 , visible : 1 } ;
62+ $scope . layers . footprint = { zIndex : 7 , visible : 1 } ;
5963 }
6064
6165 // Map
@@ -64,91 +68,35 @@ angular.module('SEED.controller.inventory_detail_map', []).controller('inventory
6468 zIndex : $scope . layers . base_layer . zIndex // Note: This is used for layer toggling.
6569 } ) ;
6670
67- // This uses the bounding box instead of the lat/long. See BuildingPoint function in inventory_map_controller for reference
68- const buildingBoundingBox = ( ) => {
69- const format = new ol . format . WKT ( ) ;
70-
71- const feature = format . readFeature ( $scope . bounding_box , {
72- dataProjection : 'EPSG:4326' ,
73- featureProjection : 'EPSG:3857'
74- } ) ;
75-
76- feature . setProperties ( $scope . item_state ) ;
77- return feature ;
78- } ;
79-
80- const buildingSources = ( ) => {
81- const features = [ buildingBoundingBox ( ) ] ;
82- return new ol . source . Vector ( { features } ) ;
83- } ;
84-
85- // Define building UBID bounding box
86- const buildingBB = ( ) => {
87- const format = new ol . format . WKT ( ) ;
88-
89- const feature = format . readFeature ( $scope . bounding_box , {
90- dataProjection : 'EPSG:4326' ,
91- featureProjection : 'EPSG:3857'
92- } ) ;
93- feature . setProperties ( $scope . item_state ) ;
94- return feature ;
95- } ;
96-
97- // Define building UBID centroid box
98- const buildingCentroid = ( ) => {
99- const format = new ol . format . WKT ( ) ;
100-
101- const feature = format . readFeature ( $scope . centroid , {
102- dataProjection : 'EPSG:4326' ,
103- featureProjection : 'EPSG:3857'
104- } ) ;
105- feature . setProperties ( $scope . item_state ) ;
106- return feature ;
107- } ;
108-
109- const buildingBBSources = ( ) => {
110- const features = [ buildingBB ( ) ] ;
111- return new ol . source . Vector ( { features } ) ;
112- } ;
113-
114- const buildingCentroidSources = ( ) => {
115- const features = [ buildingCentroid ( ) ] ;
116- return new ol . source . Vector ( { features } ) ;
117- } ;
118-
119- // Define taxlot UBID bounding box
120- const taxlotBB = ( ) => {
71+ const getFeature = ( field ) => {
12172 const format = new ol . format . WKT ( ) ;
122-
123- const feature = format . readFeature ( $scope . bounding_box , {
73+ const feature = format . readFeature ( field , {
12474 dataProjection : 'EPSG:4326' ,
12575 featureProjection : 'EPSG:3857'
12676 } ) ;
12777 feature . setProperties ( $scope . item_state ) ;
12878 return feature ;
12979 } ;
13080
131- // Define taxlot UBID centroid box
132- const taxlotCentroid = ( ) => {
133- const format = new ol . format . WKT ( ) ;
134-
135- const feature = format . readFeature ( $scope . centroid , {
136- dataProjection : 'EPSG:4326' ,
137- featureProjection : 'EPSG:3857'
138- } ) ;
139- feature . setProperties ( $scope . item_state ) ;
140- return feature ;
141- } ;
81+ const getSources = ( field ) => {
82+ if ( ! field ) return null ;
14283
143- const taxlotBBSources = ( ) => {
144- const features = [ taxlotBB ( ) ] ;
84+ const features = [ getFeature ( field ) ] ;
14585 return new ol . source . Vector ( { features } ) ;
14686 } ;
14787
148- const taxlotCentroidSources = ( ) => {
149- const features = [ taxlotCentroid ( ) ] ;
150- return new ol . source . Vector ( { features } ) ;
151- } ;
88+ // This uses the bounding box instead of the lat/long. See BuildingPoint function in inventory_map_controller for reference
89+ const buildingSources = ( ) => getSources ( $scope . bounding_box ) ;
90+ // Property UBID bounding box
91+ const buildingBBSources = ( ) => getSources ( $scope . bounding_box ) ;
92+ // Property UBID Centroid
93+ const buildingCentroidSources = ( ) => getSources ( $scope . centroid ) ;
94+ // Building footprint polygon
95+ const buildingFootprintSources = ( ) => getSources ( $scope . footprint ) ;
96+ // Taxlot UBID bounding box
97+ const taxlotBBSources = ( ) => getSources ( $scope . bounding_box ) ;
98+ // Taxlot UBID Centroid
99+ const taxlotCentroidSources = ( ) => getSources ( $scope . centroid ) ;
152100
153101 const clusterSource = ( ) => new ol . source . Cluster ( {
154102 source : buildingSources ( ) ,
@@ -183,6 +131,12 @@ angular.module('SEED.controller.inventory_detail_map', []).controller('inventory
183131 style : buildingStyle
184132 } ) ;
185133
134+ $scope . footprint_layer = new ol . layer . Vector ( {
135+ source : buildingFootprintSources ( ) ,
136+ zIndex : $scope . layers . footprint . zIndex ,
137+ style : buildingStyle
138+ } ) ;
139+
186140 $scope . taxlot_bb_layer = new ol . layer . Vector ( {
187141 source : taxlotBBSources ( ) ,
188142 zIndex : $scope . layers . taxlot_bb_layer . zIndex ,
@@ -202,6 +156,11 @@ angular.module('SEED.controller.inventory_detail_map', []).controller('inventory
202156 } else {
203157 layers = [ base_layer , $scope . taxlot_bb_layer , $scope . taxlot_centroid_layer ] ;
204158 }
159+
160+ if ( $scope . footprint ) {
161+ layers . push ( $scope . footprint_layer ) ;
162+ }
163+
205164 $scope . map = new ol . Map ( {
206165 target : 'map' ,
207166 layers
0 commit comments