@@ -50,14 +50,7 @@ class ShelterAccessApp {
5050 this . currentBasemapConfig = null ;
5151 this . layerUpdateInProgress = false ;
5252
53- // Performance monitoring
54- this . performanceMetrics = {
55- layerUpdates : 0 ,
56- viewStateChanges : 0 ,
57- lastUpdateTime : Date . now ( ) ,
58- averageUpdateTime : 0 ,
59- updateTimes : [ ]
60- } ;
53+
6154
6255 // Mapbox token for terrain and other services
6356 this . mapboxToken = 'pk.eyJ1Ijoibm9hbWpnYWwiLCJhIjoiY20zbHJ5MzRvMHBxZTJrcW9uZ21pMzMydiJ9.B_aBdP5jxu9nwTm3CoNhlg' ;
@@ -125,17 +118,13 @@ class ShelterAccessApp {
125118 */
126119 async loadShelterCoverageData ( ) {
127120 try {
128- console . log ( '🚀 Loading precomputed shelter coverage data...' ) ;
129121 const response = await fetch ( 'data/shelter_coverage_precomputed.json' ) ;
130122 if ( ! response . ok ) {
131123 throw new Error ( `HTTP error! status: ${ response . status } ` ) ;
132124 }
133-
134125 this . shelterCoverageData = await response . json ( ) ;
135- console . log ( `✅ Loaded precomputed coverage for ${ Object . keys ( this . shelterCoverageData . shelter_coverage_map ) . length } shelters` ) ;
136-
137126 } catch ( error ) {
138- console . error ( '❌ Error loading precomputed shelter coverage:' , error ) ;
127+ console . error ( 'Error loading precomputed shelter coverage:' , error ) ;
139128 this . shelterCoverageData = null ;
140129 }
141130 }
@@ -213,8 +202,7 @@ class ShelterAccessApp {
213202 // Initial load of optimal locations and coverage analysis
214203 await this . updateOptimalLocations ( ) ;
215204
216- // Start performance monitoring
217- this . _startPerformanceMonitoring ( ) ;
205+
218206
219207 // Initialize legend
220208 this . updateLegend ( ) ;
@@ -580,9 +568,7 @@ class ShelterAccessApp {
580568 // When heatmap is active, only show heatmap - hide all other layers
581569 const coveredCount = this . accessibilityData . filter ( d => d . type === 'covered' ) . length ;
582570 const uncoveredCount = this . accessibilityData . filter ( d => d . type === 'uncovered' ) . length ;
583- console . log ( `🔥 Unified Heatmap data: ${ this . accessibilityData . length } total points` ) ;
584- console . log ( ` 🟢 Covered: ${ coveredCount } buildings (${ ( coveredCount / this . accessibilityData . length * 100 ) . toFixed ( 1 ) } %)` ) ;
585- console . log ( ` 🔴 Uncovered: ${ uncoveredCount } buildings (${ ( uncoveredCount / this . accessibilityData . length * 100 ) . toFixed ( 1 ) } %)` ) ;
571+
586572
587573 // Create simplified heatmap layer with intuitive weighting
588574 layers . push ( new deck . ScreenGridLayer ( {
@@ -1090,9 +1076,7 @@ class ShelterAccessApp {
10901076 updateVisualization ( ) {
10911077 if ( ! this . deckgl || this . layerUpdateInProgress ) return ;
10921078
1093- const startTime = performance . now ( ) ;
10941079 this . layerUpdateInProgress = true ;
1095- this . performanceMetrics . layerUpdates ++ ;
10961080
10971081 try {
10981082 const layers = [ ] ;
@@ -1101,8 +1085,6 @@ class ShelterAccessApp {
11011085 this . _ensureBaseTileLayer ( ) ;
11021086 if ( this . baseTileLayer ) {
11031087 layers . push ( this . baseTileLayer ) ;
1104- } else {
1105- console . warn ( '⚠️ No base tile layer available' ) ;
11061088 }
11071089
11081090 // Add data layers
@@ -1113,23 +1095,19 @@ class ShelterAccessApp {
11131095 this . currentLayers = layers ;
11141096 this . deckgl . setProps ( { layers : this . currentLayers } ) ;
11151097
1116- console . log ( `🔄 Updated visualization: ${ layers . length } layers (${ this . baseTileLayer ? 'with' : 'without' } basemap)` ) ;
1117-
11181098 } catch ( error ) {
1119- console . error ( '❌ Layer update failed:' , error ) ;
1099+ console . error ( 'Layer update failed:' , error ) ;
11201100
11211101 // Attempt recovery with minimal layers
11221102 try {
11231103 const dataLayers = this . createLayers ( ) ;
11241104 const recoveryLayers = this . baseTileLayer ? [ this . baseTileLayer , ...dataLayers ] : dataLayers ;
11251105 this . deckgl . setProps ( { layers : recoveryLayers } ) ;
1126- console . log ( '🔧 Recovery update successful' ) ;
11271106 } catch ( recoveryError ) {
1128- console . error ( '❌ Recovery failed:' , recoveryError ) ;
1107+ console . error ( 'Recovery failed:' , recoveryError ) ;
11291108 }
11301109 } finally {
11311110 this . layerUpdateInProgress = false ;
1132- this . _trackUpdatePerformance ( startTime ) ;
11331111 }
11341112
11351113 this . updateCoverageAnalysis ( ) ;
@@ -1175,7 +1153,7 @@ class ShelterAccessApp {
11751153 const basemapConfig = this . basemaps [ this . currentBasemap ] ;
11761154
11771155 if ( ! basemapConfig ) {
1178- console . error ( `❌ Invalid basemap: ${ this . currentBasemap } ` ) ;
1156+ console . error ( `Invalid basemap: ${ this . currentBasemap } ` ) ;
11791157 return ;
11801158 }
11811159
@@ -1185,19 +1163,15 @@ class ShelterAccessApp {
11851163 this . currentBasemapConfig . url !== basemapConfig . url ||
11861164 this . currentBasemapConfig . name !== basemapConfig . name ) {
11871165
1188- console . log ( `🗺️ Creating new tile layer for ${ basemapConfig . name } ` ) ;
1189-
11901166 // Clear old layer reference
11911167 this . baseTileLayer = null ;
11921168
11931169 try {
11941170 // Create new tile layer
11951171 this . baseTileLayer = this . createStandardTileLayer ( basemapConfig ) ;
11961172 this . currentBasemapConfig = { ...basemapConfig } ; // Store copy
1197-
1198- console . log ( `✅ Created tile layer for ${ basemapConfig . name } ` ) ;
11991173 } catch ( error ) {
1200- console . error ( `❌ Failed to create tile layer for ${ basemapConfig . name } :` , error ) ;
1174+ console . error ( `Failed to create tile layer for ${ basemapConfig . name } :` , error ) ;
12011175 this . baseTileLayer = null ;
12021176 this . currentBasemapConfig = null ;
12031177 }
@@ -1267,8 +1241,6 @@ class ShelterAccessApp {
12671241 * Create simplified tile layer with minimal configuration
12681242 */
12691243 createStandardTileLayer ( basemapConfig ) {
1270- console . log ( `🗺️ Creating tile layer: ${ basemapConfig . name } ` ) ;
1271-
12721244 return new deck . TileLayer ( {
12731245 id : `basemap-${ this . currentBasemap } ` ,
12741246 data : basemapConfig . url ,
@@ -1283,13 +1255,11 @@ class ShelterAccessApp {
12831255 return null ;
12841256 }
12851257
1286- // Use tile.boundingBox for bounds - this is the correct format from deck.gl
12871258 const { boundingBox } = tile ;
12881259 if ( ! boundingBox || boundingBox . length !== 2 || boundingBox [ 0 ] . length !== 2 ) {
12891260 return null ;
12901261 }
12911262
1292- // boundingBox format: [[west, south], [east, north]]
12931263 const bounds = [ boundingBox [ 0 ] [ 0 ] , boundingBox [ 0 ] [ 1 ] , boundingBox [ 1 ] [ 0 ] , boundingBox [ 1 ] [ 1 ] ] ;
12941264
12951265 return new deck . BitmapLayer ( {
@@ -1298,14 +1268,6 @@ class ShelterAccessApp {
12981268 image : props . data ,
12991269 bounds : bounds
13001270 } ) ;
1301- } ,
1302-
1303- onTileLoad : ( tile ) => {
1304- console . log ( `✅ Tile loaded: ${ tile . index . z } /${ tile . index . x } /${ tile . index . y } ` ) ;
1305- } ,
1306-
1307- onTileError : ( error ) => {
1308- console . warn ( '⚠️ Tile loading error:' , error ) ;
13091271 }
13101272 } ) ;
13111273 }
@@ -1332,7 +1294,7 @@ class ShelterAccessApp {
13321294 this . updateCoverageAnalysis ( ) ;
13331295
13341296 } catch ( error ) {
1335- console . error ( '❌ Loading optimal locations failed:' , error ) ;
1297+ console . error ( 'Loading optimal locations failed:' , error ) ;
13361298 } finally {
13371299 this . isAnalyzing = false ;
13381300 }
@@ -1484,7 +1446,6 @@ class ShelterAccessApp {
14841446 handleViewStateChange ( viewState ) {
14851447 // Store pending view state
14861448 this . _pendingViewState = viewState ;
1487- this . performanceMetrics . viewStateChanges ++ ;
14881449
14891450 // Clear existing timer
14901451 if ( this . _viewStateDebounceTimer ) {
@@ -1624,8 +1585,6 @@ class ShelterAccessApp {
16241585 changeBasemap ( basemap ) {
16251586 if ( this . currentBasemap === basemap ) return ; // No change needed
16261587
1627- console . log ( `🔄 Changing basemap from ${ this . currentBasemap } to ${ basemap } ` ) ;
1628-
16291588 const oldBasemap = this . currentBasemap ;
16301589 this . currentBasemap = basemap ;
16311590
@@ -1653,8 +1612,6 @@ class ShelterAccessApp {
16531612
16541613 // Immediate update for basemap changes - no debouncing needed
16551614 this . updateVisualization ( ) ;
1656-
1657- console . log ( `✅ Basemap changed from ${ oldBasemap } to ${ basemap } ` ) ;
16581615 }
16591616
16601617 /**
@@ -1670,102 +1627,12 @@ class ShelterAccessApp {
16701627 this . _basemapDebounceTimer = null ;
16711628 }
16721629
1673- // Clean up performance monitoring
1674- if ( this . performanceMonitoringInterval ) {
1675- clearInterval ( this . performanceMonitoringInterval ) ;
1676- this . performanceMonitoringInterval = null ;
1677- }
1678-
1679- console . log ( '🧹 App cleanup completed' ) ;
1680- }
1681-
16821630
1683-
1684- /**
1685- * Track performance metrics for layer updates
1686- */
1687- _trackUpdatePerformance ( startTime ) {
1688- const updateTime = performance . now ( ) - startTime ;
1689- this . performanceMetrics . updateTimes . push ( updateTime ) ;
1690-
1691- // Keep only last 100 measurements for average calculation
1692- if ( this . performanceMetrics . updateTimes . length > 100 ) {
1693- this . performanceMetrics . updateTimes . shift ( ) ;
1694- }
1695-
1696- // Calculate average update time
1697- this . performanceMetrics . averageUpdateTime =
1698- this . performanceMetrics . updateTimes . reduce ( ( sum , time ) => sum + time , 0 ) /
1699- this . performanceMetrics . updateTimes . length ;
17001631 }
17011632
1702- /**
1703- * Get simplified performance report
1704- */
1705- getPerformanceReport ( ) {
1706- const uptime = Date . now ( ) - this . performanceMetrics . lastUpdateTime ;
1707-
1708- return {
1709- performance : {
1710- ...this . performanceMetrics ,
1711- uptimeMs : uptime ,
1712- averageUpdateTimeMs : Math . round ( this . performanceMetrics . averageUpdateTime * 100 ) / 100 ,
1713- layerUpdatesPerSecond : this . performanceMetrics . layerUpdates / ( uptime / 1000 ) ,
1714- viewStateChangesPerSecond : this . performanceMetrics . viewStateChanges / ( uptime / 1000 )
1715- } ,
1716- recommendations : this . _getPerformanceRecommendations ( )
1717- } ;
1718- }
17191633
1720- /**
1721- * Get performance recommendations based on metrics
1722- */
1723- _getPerformanceRecommendations ( ) {
1724- const recommendations = [ ] ;
1725-
1726- if ( this . performanceMetrics . averageUpdateTime > 50 ) {
1727- recommendations . push ( '⚠️ Slow layer updates detected. Consider reducing layer complexity or data size.' ) ;
1728- }
1729-
1730- if ( this . performanceMetrics . viewStateChanges / ( Date . now ( ) - this . performanceMetrics . lastUpdateTime ) * 1000 > 10 ) {
1731- recommendations . push ( '⚠️ High view state change frequency. Debouncing is working to prevent excessive updates.' ) ;
1732- }
1733-
1734- if ( recommendations . length === 0 ) {
1735- recommendations . push ( '✅ Performance is optimal' ) ;
1736- }
1737-
1738- return recommendations ;
1739- }
17401634
1741- /**
1742- * Log performance report to console
1743- */
1744- logPerformanceReport ( ) {
1745- const report = this . getPerformanceReport ( ) ;
1746- console . group ( '🚀 Performance Report' ) ;
1747- console . log ( 'Performance Metrics:' , report . performance ) ;
1748- console . log ( 'Recommendations:' , report . recommendations ) ;
1749- console . groupEnd ( ) ;
1750- }
17511635
1752- /**
1753- * Start periodic performance monitoring
1754- */
1755- _startPerformanceMonitoring ( ) {
1756- // Log performance report every 30 seconds in development
1757- if ( window . location . hostname === 'localhost' || window . location . hostname === '127.0.0.1' ) {
1758- this . performanceMonitoringInterval = setInterval ( ( ) => {
1759- this . logPerformanceReport ( ) ;
1760- } , 30000 ) ;
1761- }
1762-
1763- // Initial performance log after 5 seconds
1764- setTimeout ( ( ) => {
1765- console . log ( '🚀 Initial performance check after 5 seconds:' ) ;
1766- this . logPerformanceReport ( ) ;
1767- } , 5000 ) ;
1768- }
17691636
17701637 /**
17711638 * Update attribution display
@@ -1867,8 +1734,6 @@ class ShelterAccessApp {
18671734 // Store raw data and extract for current radius
18681735 this . allAccessibilityData = accessibilityDataAll ;
18691736 this . updateAccessibilityDataForRadius ( ) ;
1870- console . log ( `🚀 Loaded accessibility data: ${ accessibilityDataAll . accessibility_points . length } buildings, ${ accessibilityDataAll . radii_available . length } radii` ) ;
1871-
18721737 } catch ( error ) {
18731738 console . error ( 'Error loading accessibility data:' , error ) ;
18741739 this . accessibilityData = null ;
@@ -1894,8 +1759,6 @@ class ShelterAccessApp {
18941759 type : point . coverage [ radiusKey ] ? 'covered' : 'uncovered' ,
18951760 weight : point . coverage [ radiusKey ] ? 1 : - 1 // +1 for covered (green), -1 for uncovered (red)
18961761 } ) ) ;
1897-
1898- console . log ( `🔄 Extracted ${ radiusKey } data: ${ this . accessibilityData . length } points` ) ;
18991762 }
19001763
19011764
@@ -1926,7 +1789,6 @@ class ShelterAccessApp {
19261789
19271790 // Safety check: return early if tooltip element doesn't exist
19281791 if ( ! tooltip ) {
1929- console . warn ( 'Tooltip element not found' ) ;
19301792 return ;
19311793 }
19321794
0 commit comments