Urban waterlogging simulation system, method, medium, and device
By optimizing the urban flooding simulation system through microservice architecture and hybrid database storage, a second-level response and efficient rendering of the evolution from rainfall data to flooding were achieved. This solved the problems of low data transmission efficiency, poor storage performance, and rendering lag in the existing system, and improved the real-time nature of flooding early warning and the timeliness of emergency decision-making.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING HUAZHAN HUIYUAN INFORMATION TECH CO LTD
- Filing Date
- 2026-03-11
- Publication Date
- 2026-06-30
AI Technical Summary
Existing urban flooding simulation systems suffer from low data transmission efficiency, poor storage performance, and rendering lag, making it difficult to meet the needs of real-time early warning and emergency decision-making.
It adopts a microservice architecture with message middleware as the central hub, integrating IoT data receiving and storage modules, online model real-time calculation modules, real-time data receiving and storage modules, data conversion and compression service modules, and data rendering modules. It realizes full-process automation from rainfall data triggering to dynamic rendering of urban flooding evolution. Through asynchronous communication and data decoupling, it utilizes a hybrid storage architecture of non-relational databases and relational spatial databases, combined with a client-side graphics hardware accelerated rendering engine, to optimize the data processing and rendering process.
It achieves a second-level response from rainfall triggering to the evolution of urban flooding, improves data query efficiency and rendering smoothness, ensures the real-time nature of urban flooding early warning and the timeliness of emergency decision-making, reduces the grid cell query response time from 1 second to milliseconds, and significantly improves rendering smoothness.
Smart Images

Figure CN122309589A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of urban flooding risk monitoring technology, and in particular to an urban flooding simulation system, method, medium and equipment. Background Technology
[0002] With rapid urbanization and frequent extreme weather events, urban flooding has become a major risk threatening public safety and urban operations. To address this challenge, building a flood risk simulation and visualization system capable of real-time early warning and emergency decision-making has become a core requirement for smart city water management. Currently, relevant technical solutions for urban flood risk simulation data processing and rendering mainly include three aspects: "model calculation—data storage—visualization." However, the overall system lacks timeliness and cannot meet the needs of real-time early warning and emergency decision-making. Specifically, this includes:
[0003] (1) The model calculation results rely on manual transmission or import and export of fixed format files. There is a lack of automated linkage mechanism between each link, resulting in low efficiency and failure to meet the timeliness requirements of real-time early warning.
[0004] (2) Insufficient data storage and query performance for massive datasets further exacerbates system response latency: When using a single database (such as MySQL) to store all data, the response time exceeds 1 second when performing spatial queries on tens of millions of grid cells. In TB-level data scenarios, the mixed storage of raw data and rendered data further causes read / write lag, and the data extraction efficiency decreases by more than 60%.
[0005] (3) Poor rendering smoothness and excessive front-end loading and drawing time: Poor rendering smoothness and adaptability: In the full data loading mode, a single grid data in GeoJSON format exceeds 500MB, and it takes more than 30 seconds to transmit massive grid data to the WEB end, far exceeding the user's acceptable 5-second loading threshold. At the same time, dynamic rendering relies on pre-generated static frames, the switching frame rate is low, screen tearing is easy to occur, and the trend of water accumulation and diffusion cannot be intuitively presented.
[0006] Therefore, current urban flooding simulation systems suffer from problems such as low data transmission efficiency, poor storage performance, and rendering lag. Summary of the Invention
[0007] In view of the above-mentioned shortcomings and deficiencies of the prior art, this application provides an urban flooding simulation system, method, medium and equipment, the main purpose of which is to solve the problems of low data transmission efficiency, poor storage performance and rendering lag in the current urban flooding simulation system.
[0008] To achieve the above objectives, the main technical solutions adopted in this application include:
[0009] In a first aspect, embodiments of this application provide an urban flooding simulation system. The system uses a message middleware as its central hub and a microservice architecture to automate the entire process from rainfall data triggering to dynamic rendering of flooding evolution. The message middleware is used for asynchronous communication and data decoupling between modules in the microservice architecture.
[0010] Optionally, the microservice architecture integrates the following modules to automate the entire process from rainfall data triggering to dynamic rendering of urban flooding evolution; the system includes:
[0011] The Internet of Things (IoT) data receiving and storage module is used to monitor rainfall data in real time and generate model calculation instructions when the rainfall data meets preset trigger conditions.
[0012] The online model real-time calculation module, in response to the model calculation instruction, calls the encapsulated hydrological and hydrodynamic model to perform simulation calculations to obtain the original time-series waterlogging simulation data, and pushes the original time-series waterlogging simulation data to the message middleware;
[0013] The real-time data receiving and storage module subscribes to the message middleware, receives and parses the original time-series flood simulation data, and writes the original time-series flood simulation data into a non-relational database in time sequence.
[0014] The data conversion and compression service module monitors the non-relational database or the message middleware, cleans the original time-series flood simulation data, and performs grid thinning and compression based on spatial proximity and fusion algorithms to obtain flood simulation spatial grid data for rendering.
[0015] The data service distribution module receives the urban flooding simulation spatial grid data and stores it in a relational spatial database. Based on the relational spatial database, it publishes vector tile services and provides a data query interface based on time series.
[0016] The data rendering module is used to dynamically request vector map tile data of the corresponding area from the data service distribution module according to the current map view parameters; and to use the client graphics hardware acceleration rendering engine to parse and render the tile data in real time, so as to realize the visualization of the waterlogging evolution process.
[0017] Optionally, the online model real-time calculation module responds to the model calculation instruction by calling the encapsulated hydrological and hydrodynamic model to perform simulation calculations to obtain raw time-series waterlogging simulation data, and pushes the raw time-series waterlogging simulation data to the message middleware, including:
[0018] Based on the rainfall data, a designed rainfall sequence is generated using a rainstorm model algorithm and automatically formatted as an input file;
[0019] The input file is loaded and executed using the PySWMM component, which is wrapped in Python, to drive the SWMM model to complete the simulation calculation.
[0020] The simulation results are extracted through the Output class interface of the PySWMM component to generate the original time-series flood simulation data, and the data is pushed to the Kafka message middleware.
[0021] Optionally, the data conversion and compression service module performs grid thinning and compression on the original time-series flood simulation data, including:
[0022] Grid data with zero water depth are removed;
[0023] The grid data is classified according to multiple preset water depth ranges;
[0024] For grid data within the same water depth range, spatially adjacent grid cells are identified based on a spatial proximity analysis algorithm, and a spatial fusion algorithm is used to merge adjacent grid cells into one or more polygonal features.
[0025] Optionally, the geometry of the new polygonal feature formed by the spatial fusion algorithm is the outer envelope polygon of all merged grid cells, and the water depth attribute value is a representative value or average value of the attribute values of the merged grid cells.
[0026] Optionally, the data rendering module dynamically requests vector map tile data for the corresponding area from the data service distribution module based on the current map view parameters; and utilizes a client-side graphics hardware acceleration rendering engine to parse and render the tile data in real time, thereby visualizing the evolution of urban flooding, including:
[0027] Receive data ready instructions from the data service distribution module via WebSocket;
[0028] Based on the data ready command and the current map view's range and zoom level, dynamically request the corresponding PBF format vector tile data from the vector tile service;
[0029] The MapboxGL framework is used to parse the PBF format vector slice data, and the WebGL API is used for real-time shading and rendering.
[0030] Optionally, the data service distribution module publishes vector tile services based on the relational spatial database, including:
[0031] Based on multiple preset map zoom levels, the waterlogging simulation spatial grid data is cut and reorganized to generate a vector tile dataset with a multi-level detail (LOD) structure.
[0032] A map service interface is provided based on the vector tile dataset.
[0033] Secondly, embodiments of this application provide an urban flooding simulation method, applied to an urban flooding simulation system as described in any one of the first aspects above, the method comprising:
[0034] Real-time monitoring of rainfall data, and generation of model calculation instructions when the rainfall data meets preset trigger conditions;
[0035] In response to the model calculation instruction, the encapsulated hydrological and hydrodynamic model is invoked to perform simulation calculations to obtain the original time-series waterlogging simulation data, and the original time-series waterlogging simulation data is pushed to the message middleware;
[0036] Subscribe to the message middleware, receive and parse the original time-series flood simulation data, and write the original time-series flood simulation data into a non-relational database in time sequence;
[0037] Monitor the non-relational database or the message middleware, clean the original time-series flood simulation data, and perform grid thinning and compression based on spatial proximity and fusion algorithms to obtain flood simulation spatial grid data for rendering.
[0038] Receive the waterlogging simulation spatial grid data and store it in a relational spatial database; publish vector tile services based on the relational spatial database; and provide a data query interface based on time series.
[0039] Based on the current map view parameters, the system dynamically requests vector map tile data for the corresponding area from the data service distribution module; and uses the client-side graphics hardware acceleration rendering engine to parse and render the tile data in real time, thereby visualizing the process of urban flooding.
[0040] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the urban flooding simulation method described in the second aspect.
[0041] Fourthly, this application provides an electronic device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the computer program to implement the urban flooding simulation method described in the second aspect.
[0042] By employing the above technical solutions, this application provides an urban flooding simulation system, method, medium, and device. The system uses a message middleware as its central hub and integrates the following modules through a microservice architecture to achieve full-process automation from rainfall data triggering to dynamic rendering of flooding evolution. The message middleware is used for asynchronous communication and data decoupling between modules within the microservice architecture. This application's microservice architecture, centered on the message middleware, integrates data triggering, online model calculation, data conversion and compression, and dynamic rendering into a fully automated urban flooding simulation system. This eliminates the reliance on manual transmission of flooding simulation data in traditional solutions, achieving a second-level response time from rainfall triggering to visualization of flooding evolution. Simultaneously, the introduction of the message middleware enables asynchronous decoupling and efficient collaboration between microservice modules, avoiding blockages and delays in the transmission of massive amounts of data between modules, ensuring the real-time nature of flooding warnings and the timeliness of emergency decision-making. Attached Figure Description
[0043] Figure 1 A schematic diagram of a module for an urban flooding simulation system provided in this application embodiment;
[0044] Figure 2 A schematic diagram of the processing framework of an urban flooding simulation system provided in an embodiment of this application;
[0045] Figure 3 This is a schematic diagram of the simulation process of the SWMM model provided in the embodiments of this application;
[0046] Figure 4 A timing diagram of an urban flooding simulation method provided in an embodiment of this application. Detailed Implementation
[0047] To better understand the above technical solutions, exemplary embodiments of this application will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application can be understood more clearly and thoroughly, and that the scope of this application can be fully conveyed to those skilled in the art.
[0048] To address the issues of slow data transmission, poor storage, and rendering lag in current urban flooding simulation systems, this application proposes an urban flooding simulation system. Specifically, it can be developed using JAVA and Python on the IntelliJ IDEA platform, based on Elasticsearch and PostgreSQL database technologies, GeoServer and SWMM secondary development technologies. The system uses a message middleware as its central hub and a microservice architecture to automate the entire process from rainfall data triggering to dynamic rendering of flooding evolution. The message middleware is used for asynchronous communication and data decoupling between modules within the microservice architecture.
[0049] In this embodiment, a microservice architecture centered on a message middleware integrates data triggering, online model calculation, data transformation and compression, and dynamic rendering into a fully automated urban flooding simulation system. This eliminates the reliance on manual transmission of flooding simulation data in traditional solutions, achieving a second-level response from rainfall triggering to visualization of flooding evolution. Simultaneously, the introduction of a message middleware enables asynchronous decoupling and efficient collaboration between various microservice modules, avoiding blockages and delays in the transmission of massive amounts of data between modules, and ensuring the real-time nature of flooding warnings and the timeliness of emergency decision-making.
[0050] Furthermore, combined Figure 1 As shown, the system includes:
[0051] The IoT data receiving and storage module is used to monitor rainfall data in real time and generate model calculation instructions when the rainfall data meets preset trigger conditions.
[0052] The IoT data receiving and storage module collects rainfall data in real time through smart sensing devices (such as rain gauges and liquid level sensors) deployed in key urban areas. This rainfall data includes real-time data such as rainfall amount, pipe network liquid level, flow rate, and flow velocity. By receiving and collecting this rainfall data in real time, and under preset trigger conditions (e.g., rainfall exceeding 2mm within 5 minutes), the module triggers the invocation of a hydrological and hydrodynamic model for urban flooding calculations, generating computational instructions to control the model's calculations.
[0053] The online model real-time calculation module responds to model calculation instructions, calls the encapsulated hydrological and hydrodynamic model to perform simulation calculations to obtain the original time-series waterlogging simulation data, and pushes the original time-series waterlogging simulation data to the message middleware.
[0054] The online model real-time calculation module transmits relevant real-time data to the hydrological and hydrodynamic model for real-time simulation calculation via service interface calls, obtains the original time-series waterlogging simulation data, and pushes it to the message middleware.
[0055] Hydrological and hydrodynamic models are a general term for a class of models capable of simulating urban flooding. Flooding simulation data is used to analyze and assess urban flooding conditions; the original time-series flooding simulation data is obtained by sorting the data in chronological order.
[0056] The real-time data receiving and storage module subscribes to the message middleware, receives and parses the original time-series flood simulation data, and writes the original time-series flood simulation data into a non-relational database in time sequence.
[0057] During the real-time model operation, the real-time data receiving and storage module receives, parses, and stores data in real time by subscribing to message middleware, storing the original time-series flood simulation data in a non-relational database.
[0058] The data conversion and compression service module monitors non-relational databases or message middleware, cleans the original time-series flood simulation data, and performs grid thinning and compression based on spatial proximity and fusion algorithms to obtain flood simulation spatial grid data for rendering.
[0059] The data conversion and compression service module cleans the original time-series flood simulation data by monitoring non-relational databases or message middleware, and then performs grid thinning and compression based on spatial proximity and fusion algorithms, thereby significantly reducing the amount of data and obtaining flood simulation spatial grid data for rendering. This facilitates the display of massive amounts of data while ensuring data accuracy.
[0060] The data service distribution module receives spatial grid data from urban flooding simulation and stores it in a relational spatial database. Based on the relational spatial database, it publishes vector tile services and provides a data query interface based on time series.
[0061] After converting and compressing the original time-series urban flooding simulation data, the spatial grid data of the urban flooding simulation is grouped according to the time series. Simultaneously, the data is published as a vector tile service through a relational spatial database and returned to the business rendering and display end for rendering and display. Vector tiling is a map data organization and transmission method that pre-cuts map data (such as processed spatial grid polygons) into multiple small tiles according to different scaling levels. When a user browses the map, the front end only loads the tiles required within the current screen area, instead of loading all the data for the entire city at once. This greatly reduces the amount of data transmitted, which is key to achieving smooth web display of massive spatial data.
[0062] The data rendering module is used to dynamically request vector map tile data of the corresponding area from the data service distribution module based on the current map view parameters; and to use the client graphics hardware acceleration rendering engine to parse and render the tile data in real time, so as to visualize the process of waterlogging evolution.
[0063] Specifically, the data rendering module receives the data ready command from the data service distribution module via the WebSocket protocol. Then, based on the latitude and longitude range and zoom level of the current map view, it dynamically requests PBF format vector tiles for the corresponding area. The WebGL API interface is used to parse and render the tile data in real time, supporting dynamic playback of the flooding evolution process over time, and visually reflecting changes in water depth through color mapping.
[0064] As can be seen from the modules described above, a microservice architecture centered on a message middleware decouples IoT data receiving, model calculation, and data storage modules. Asynchronous communication via the message middleware enables the automatic publishing and subscription of model calculation results, replacing manual transmission and solving the problem of inefficiency and delayed early warning caused by the manual transmission of flood simulation data.
[0065] A hybrid storage architecture combining non-relational and relational spatial databases is employed. Raw time-series flood simulation data is stored in a non-relational database optimized for time-series retrieval, while processed flood simulation spatial grid data is stored in a relational spatial database with built-in spatial indexes. This achieves hierarchical data storage and dedicated querying, with the two working collaboratively to reduce query response time for tens of millions of grid cells from over one second to milliseconds, resolving storage limitations and read / write lag issues in terabyte-scale data scenarios.
[0066] First, the data conversion and compression service module intelligently thins the original mesh, significantly reducing the number of geometries to be rendered. Second, the data service distribution module publishes the lightweight spatial mesh data as a vector tile service, reducing data transfer volume. Finally, the data rendering module utilizes the client-side graphics hardware-accelerated rendering engine to dynamically load and render vector tiles according to the view extent, improving rendering smoothness.
[0067] In this embodiment, a microservice architecture centered on a message middleware is first used to decouple the IoT data receiving, model calculation, and data storage modules. Asynchronous communication via the message middleware enables automatic publishing and subscription of model calculation results, replacing manual transmission and thus solving the problem of low efficiency caused by multi-model coupling and resulting in delayed early warnings. Next, a hybrid storage architecture combining a non-relational database and a relational spatial database is adopted. The original time-series flood simulation data is stored in a non-relational database optimized for time-series retrieval, while the processed flood simulation spatial grid data is stored in a relational spatial database with built-in spatial indexes. This achieves hierarchical data storage and dedicated querying, resolving issues of poor storage and read / write lag. Finally, intelligent thinning of the original mesh significantly reduces the number of geometry objects to be rendered. Combined with publishing the lightweight spatial grid data as a vector tile service, data transmission volume is reduced. Simultaneously, the client-side graphics hardware-accelerated rendering engine dynamically loads and renders vector tiles according to the view extent, improving rendering smoothness.
[0068] The overall processing framework of the urban flooding simulation system is as follows: Figure 2 As shown, the following will be combined with Figure 2 The specific execution process will be explained.
[0069] Optionally, the online model real-time computation module responds to the model computation command by calling the encapsulated hydrological and hydrodynamic model to perform simulation calculations to obtain the original time-series waterlogging simulation data, and pushes the original time-series waterlogging simulation data to the message middleware. This includes: generating a design rainfall sequence based on rainfall data using a rainstorm model algorithm and automatically formatting it into a model input file; loading and executing the input file through the Python-encapsulated PySWMM component to drive the SWMM model to complete the simulation calculation; extracting the simulation results through the Output class interface of the PySWMM component to generate the original time-series waterlogging simulation data, and pushing the data to the Kafka message middleware.
[0070] In this embodiment, the online model real-time computation module utilizes the PySWMM component to efficiently encapsulate and automatically invoke the model. Specifically, the module first receives real-time rainfall data from the IoT data receiving and storage module, generates a time-series design rainfall process curve using the built-in Chicago storm model algorithm, and automatically formats it into a standard input file. Subsequently, the module uses a Python script to call the Simulation class of the PySWMM component to load the input file, driving SWMM to execute the simulation process. During the simulation, the module monitors the computation status in real time. After the simulation, it extracts time-series water depth, flow rate, and other results data for each node and pipe segment through the Output class interface of the PySWMM component and serializes them into JSON (JavaScript object representation format). Finally, the module publishes the raw time-series flood simulation data in JSON format to a designated topic in the Kafka message middleware for other downstream modules to subscribe to. By automating and standardizing model computation, manual intervention is reduced, and the efficiency of computation triggering and execution is improved.
[0071] See Figure 3 As a feasible implementation method, a hydrological and hydrodynamic urban flooding model is constructed based on the SWMM platform as the basic model service. Urban drainage network data is digitized to form a drainage hydraulic model, simulating the drainage process of the urban drainage network. Rainfall events are triggered by equipment rainfall data, and a 5-minute rainfall sequence is generated as input using the Chicago storm model. The program then calls Python to simulate urban flooding, calculating the location, depth, and volume of water accumulation points.
[0072] The SWMM engine is encapsulated in Python and used as the system's backend. During simulation calculations, the generated project file (.inp format) is used to call the engine. The frontend implements a window for adjusting SWMM simulation parameters. When modifications to the simulation parameters are needed, it reads rain gauge data or user input. The backend modifies the project file based on the input information and generates a new file (.inp format). During resimulation, the new project file is used to call the calculation engine, generating a report file (.rpt format) and a results file (.out format). The system then uses the simulation results information from the generated results file. The specific process is as follows:
[0073] (1) The rainfall section of the SWMM input file is generated.
[0074] The rainfall sequence in the input file is primarily generated using the Chicago Storm model. It can also generate rainfall data for different scenarios based on the return period. The core formula of the Chicago Storm model is: i=(a*t^b) / ((t+c)^d).
[0075] Where: i is the rainfall intensity (mm / min), t is the rainfall time (min), a, b, c, d are regional rainfall parameters, the rainstorm process line is divided into an ascending segment and a descending segment, the peak occurs at time r*D, r is the peak position coefficient, and D is the total rainfall duration.
[0076] The core functions are listed below:
[0077] The generated process curves of the Chicago rainstorm are shown in Table 1.
[0078] chicago_rainfall(intensity_params,total_duration,time_step,r=0.5)
[0079] Table 1
[0080]
[0081] Convert rainfall data to SWMM input format as shown in Table 2.
[0082] convert_to_swmm_format(rainfall_df,rain_gage_id="RG1")
[0083] Table 2
[0084]
[0085] (2) Model calculation
[0086] The Simulation class in the PySWMM component provides a complete encapsulation of the SWMM model calculation process, enabling efficient model execution through a concise yet powerful interface. The calculation process first creates a Simulation instance and loads the input file, specifying the output paths for the report and result files. Then, the entire simulation process is automatically completed using the execute() method, or controlled step-by-step using start()-step()-end(). During the calculation, the Simulation class maintains the model state in real time, including metadata such as the current simulation time and calculation progress percentage, while also providing real-time access interfaces to model elements (nodes, pipe segments, sub-catchments, etc.).
[0087] The Output class of the PySWMM component provides efficient reading and flexible analysis capabilities for SWMM calculation result files. By instantiating an Output object and loading the binary result file, users can easily access all hydraulic and hydrological variables recorded during the simulation, including time series data such as node depth, pipe segment flow, and sub-catchment runoff. This class supports multiple data extraction methods: it can obtain the complete time series of specific elements to extract the node's depth change process, and it can also query system-level statistics to obtain the maximum flow value. It provides millisecond-level precision query capabilities in the time dimension and supports data extraction by slicing by simulation time point or time range. In terms of analysis functions, the Output class natively supports common operations such as variable unit conversion and mass balance calculation. Its seamless integration with the Python data analysis library Pandas makes time series analysis, statistical calculation, and visualization more convenient. For large model results, memory mapping technology is used to achieve efficient reading and writing, avoiding the risk of memory overflow. Furthermore, the `variables` attribute allows for dynamic acquisition of the list of available variables, greatly enhancing the flexibility and scalability of the analysis process, enabling the entire chain of processing from basic data extraction to complex spatiotemporal analysis to be completed efficiently within the Python ecosystem.
[0088] Optionally, the data conversion and compression service module performs grid thinning and compression on the original time-series flood simulation data, including: removing grid data with zero water depth; classifying the grid data according to multiple preset water depth ranges; and for grid data within the same water depth range, identifying spatially adjacent grid cells based on a spatial proximity analysis algorithm, and using a spatial fusion algorithm to merge adjacent grid cells into one or more polygonal features.
[0089] In this embodiment, the data transformation and compression service module listens to the Kafka message middleware or polls the Elasticsearch NoSQL database to obtain raw time-series flood simulation data. The module first cleans the data, removing invalid grid cells with water depths of zero or below a threshold to reduce data redundancy. Then, it classifies the grid data according to multiple preset water depth grading intervals. For grid data within the same depth interval, the module identifies adjacent grid cells based on a spatial proximity analysis algorithm and calls a spatial fusion algorithm to merge adjacent cells into one or more polygonal features. This process significantly reduces the number of geometric objects to be rendered while preserving spatial distribution characteristics, achieving lightweight data processing.
[0090] Furthermore, since the water depth range of the grid data needs to be pre-classified, in practical applications, if the preset water depth range is inappropriate, it can lead to "under-scaling" (the data volume is still large) or "over-scaling" (critical data is filtered out, resulting in the loss of important details). This application's embodiments address this issue by considering that the currently fixed depth classifications (e.g., 0-10cm, 10-30cm...) cannot adapt to the distribution of water accumulation data under different rainfall intensities and terrains. A light rain may result in most of the water accumulating in the 0-5cm range, while a heavy rain may result in a large number of areas with water depths exceeding 30cm. Moreover, the situation regarding road flooding and depression flooding differs; road flooding is shallow but widespread, while depression flooding is deep but limited in area.
[0091] To address this issue, a hierarchical method based on cumulative frequency is proposed. The aim is to dynamically adapt the hierarchical boundaries to the statistical characteristics of the simulation results, ensuring a relatively balanced number of grid cells within each level. Specifically, the data conversion and compression service module hierarchically classifies the grid data according to multiple preset water depth ranges, including:
[0092] Obtain all grid cells with water depth greater than zero in the current simulation time series to form an effective grid set, and then obtain the water depth value d of each grid cell to form a depth value set D={d1,d2,...,dn};
[0093] Sort the depth value set D in ascending order and construct the empirical cumulative distribution function F(d). The empirical cumulative distribution function F(d) is defined as follows: for any depth value d, its function value is equal to the proportion of the number of grids corresponding to all depth values less than or equal to d in the set D to the total number of grids n.
[0094]
[0095] Here, count{} represents the number of depth values d that satisfy the condition, and the empirical cumulative distribution function characterizes the overall distribution of the current water depth. For example, F(d) = 0.75 indicates that 75% of the area has a water depth less than d.
[0096] Determine the target classification level and classification boundaries.
[0097] Hierarchical Boundary Where j is the nth level to be determined, j=1,2,...,k-1; k is the target number of levels (e.g., 5 levels), k=1,2,...,5. Then, four level boundaries are obtained, such as 20%, 40%, 60%, and 80%. Accuracy can be ensured during the calculation process using methods such as linear interpolation.
[0098] Finally, the data is classified according to four classification boundaries. This method can adapt to the data characteristics of different flooding scenarios, and while ensuring visual distinguishability, it makes the data volume of each level relatively balanced, providing better input for subsequent spatial fusion and further improving the balance between compression efficiency and rendering effect.
[0099] Optionally, the geometry of the new polygonal feature formed by the spatial fusion algorithm is the outer envelope polygon of all merged grid cells, and the water depth attribute value is a representative or average value of the attribute values of the merged grid cells.
[0100] In this embodiment, the spatial fusion algorithm can be implemented based on Python's Shapely library. The algorithm first traverses all grid cells within the same water depth range, determining the adjacency between cells based on their spatial position. For all spatially adjacent grid cells, the algorithm calculates their minimum bounding polygon and merges them into a new polygon feature. After merging, the geometry of the new polygon is the bounding polygon of all participating cells, and its water depth attribute value can be set to the representative value or arithmetic mean of the merged grid cells according to business requirements, thus achieving reasonable data aggregation. This algorithm achieves significant data compression while maintaining the macroscopic shape of the water area, reducing the number of geometric features required for subsequent rendering by approximately 70%, which is a key preliminary step for achieving smooth dynamic rendering.
[0101] Furthermore, when performing the spatial fusion step, the data conversion and compression service module in this embodiment also considers that homogeneous spatial fusion may submerge critical risk points. Traditional fusion algorithms operate solely based on geometric proximity and attribute similarity, which may result in some small but strategically important waterlogging points (e.g., intersections of main urban roads, railway underpasses, entrances to underground parking garages, and areas surrounding critical public facilities such as hospitals and schools) being merged into larger surrounding waterlogged areas during the fusion process. In the final visualization rendering, these critical locations, which pose extremely high risks to urban operations and public safety, will lose their independent graphic representation and visual salience, potentially affecting the accuracy and timeliness of emergency decision-making.
[0102] Based on this, this embodiment identifies "important units" with key risk points through spatial overlay analysis and assigns them a "retention" attribute in the fusion logic, thereby ensuring that key risk information is completely and independently preserved during data compression and visualization. Specifically, the data conversion and compression service module is further configured as follows:
[0103] Load the pre-set spatial database of the target area, and perform spatial overlay analysis (e.g., using algorithms such as intersection analysis) on the spatial data of the target area and the spatial grid data of the urban flooding simulation, and identify and mark the grid cells related to the target area as key cells;
[0104] Therefore, when executing the spatial fusion algorithm, the key unit is retained as an independent geometric element and does not participate in the fusion with other mesh units. Alternatively, when fusion with other mesh units, if other mesh units are adjacent to the key unit, the fusion is stopped with the key unit as the boundary.
[0105] In this embodiment, by introducing a "key unit" retention mechanism, this application implements an intelligent spatial compression strategy. This ensures that pre-defined key high-risk locations are clearly displayed in the urban flooding risk visualization map, preventing them from being submerged in wide-area waterlogged rendering blocks. This enhances the practical support value of the visualization results for emergency command, ensuring data accuracy while pursuing rendering efficiency.
[0106] Optionally, the data rendering module dynamically requests vector map tile data for the corresponding area from the data service distribution module based on the current map view parameters; and uses the client-side graphics hardware acceleration rendering engine to parse and render the tile data in real time, realizing visualization of the waterlogging evolution process, including: receiving data ready instructions from the data service distribution module via WebSocket; dynamically requesting corresponding PBF format vector tile data from the vector tile service based on the data ready instructions and the current map view's range and zoom level; parsing the PBF format vector tile data using the MapboxGL framework, and performing real-time shading and rendering via the WebGL API.
[0107] In this embodiment, the data rendering module is implemented based on the WebGIS technology stack of a modern network geographic information system. After startup, the module listens in real time for data readiness commands pushed by the data service distribution module via a long connection using the WebSocket network communication protocol. Then, based on the geographic range and zoom level of the current map view, the module dynamically constructs the resource locator URL for vector tile requests and requests PBF format tile data for the corresponding area from the vector tile service. The front end parses the PBF data and converts it into graphical features that can be rendered by the WebGL graphics library. Hardware-accelerated real-time shading and rendering are achieved through the WebGL application programming interface, supporting dynamic playback of the flood evolution process in a time sequence. This method of loading only data within the visible area significantly reduces network transmission and memory overhead.
[0108] Optionally, the data service distribution module publishes vector tile services based on a relational spatial database, including: cutting and reorganizing the spatial grid data of the urban flooding simulation according to multiple preset map zoom levels to generate a vector tile dataset with a multi-level detail (LOD) structure; and providing a map service interface based on the vector tile dataset.
[0109] In this embodiment, the data service distribution module stores the processed urban flooding simulation spatial grid data using PostgreSQL combined with PostGIS, and publishes vector tile services using GeoServer or a self-developed tile service. The module spatially segments and reassembles the urban flooding simulation spatial grid data according to multiple preset map zoom levels, generating a vector tile dataset with a multi-level detail (LOD) structure. The tiles are stored in PBF format, balancing compression ratio and parsing efficiency. The module also provides a map service interface, supporting dynamic requests for tile data based on parameters such as timestamp, area range, and zoom level, thus facilitating integration into various application scenarios.
[0110] Optionally, the non-relational database is Elasticsearch; the relational spatial database is a combination of PostgreSQL and PostGIS.
[0111] In this embodiment, Elasticsearch is used as a non-relational database to store the original time-series flood simulation data. Simultaneously, PostgreSQL combined with PostGIS extensions is used as a relational spatial database to store the cleaned and merged flood simulation spatial grid data. This achieves hierarchical data storage and dedicated query capabilities, solving the problems of poor storage and read / write lag in massive data scenarios. Elasticsearch is chosen as the non-relational database due to its powerful full-text search, time-series aggregation, and high-concurrency write capabilities; PostgreSQL combined with PostGIS extensions has mature spatial indexing and complex query capabilities, supporting efficient spatial analysis and tile generation.
[0112] Based on the above embodiments, this application also proposes an urban flooding simulation method, applied to the urban flooding simulation system as described in any of the above embodiments; the method includes:
[0113] Real-time monitoring of rainfall data, and generation of model calculation instructions when rainfall data meets preset trigger conditions;
[0114] In response to the model calculation command, the encapsulated hydrological and hydrodynamic model is invoked to perform simulation calculations to obtain the original time-series waterlogging simulation data, and the original time-series waterlogging simulation data is pushed to the message middleware;
[0115] Subscribe to the message middleware to receive and parse the raw time-series flood simulation data, and write the raw time-series flood simulation data into a non-relational database according to the time sequence.
[0116] Monitor non-relational databases or message middleware, clean the original time-series flood simulation data, and perform grid thinning and compression based on spatial proximity and fusion algorithms to obtain flood simulation spatial grid data for rendering.
[0117] Receive spatial grid data of urban flooding simulation and store it in a relational spatial database. Publish vector tile service based on the relational spatial database and provide a data query interface based on time series.
[0118] Based on the current map view parameters, the system dynamically requests vector map tile data for the corresponding area from the data service distribution module; and uses the client-side graphics hardware acceleration rendering engine to parse and render the tile data in real time, thereby visualizing the process of urban flooding.
[0119] By using urban flooding simulation methods, combined with Figure 4 The time-series diagram of the urban flooding simulation method shown provides an overall explanation of the above-mentioned processing procedures in the embodiments of this application:
[0120] Program trigger: The background monitors rainfall data from IoT rain gauges, determines whether there is rainfall based on the returned results, and if there is rainfall, triggers the generation of a rainfall event and calculates the urban flooding risk analysis model based on the rainfall data.
[0121] Model calculation: The acquired rainfall data is input into the model to drive model calculation.
[0122] Model output: The model outputs the changes every 5 minutes (configurable).
[0123] Output result push: The model output result file is parsed and pushed to the message middleware Kafka in JSON format.
[0124] Data storage: Business systems subscribe to Kafka to obtain results and store the raw data in a non-relational database.
[0125] Data Processing: Upon receiving the relevant model result data, Python is used in conjunction with adjacency algorithms, spatial overlay algorithms, and spatial fusion algorithms to fuse and thin the relevant data, compress the model result data, and save the spatial data to a relational spatial database. Model data services are provided through the RESTful interface specification.
[0126] WebGL rendering: It is implemented by combining WebGL with 3D GIS technology to achieve the rendering and spatial display of massive result data.
[0127] The solution proposed in the above embodiments of this application has been verified in a certain city area, and the technical effects are quantified as follows:
[0128] (1) The response time for grid cell spatial queries has been reduced from the traditional 1.2 seconds to 300 milliseconds, and the data extraction efficiency has been improved by 75%;
[0129] (2) Rendering smoothness meets the standard: Web loading time is reduced from the traditional 35 seconds to 800 milliseconds;
[0130] (3) Practical application value: In the application of the city's flood warning system, the emergency decision-making and response efficiency based on the rendering results of this scheme is improved by 50%.
[0131] To achieve the above objectives, this application also provides an electronic device that can be configured on a computer side, etc. The device includes a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the methods proposed in the above embodiments.
[0132] Optionally, the aforementioned physical devices may also include a user interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, etc. The user interface may include a display screen, input units such as a keyboard, etc., and optional user interfaces may also include USB interfaces, card reader interfaces, etc. The network interface may optionally include standard wired interfaces, wireless interfaces (such as Wi-Fi interfaces), etc.
[0133] Those skilled in the art will understand that the physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or combine certain components, or have different component arrangements.
[0134] Accordingly, this embodiment also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method proposed in the above embodiment.
[0135] Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as CD-ROM, USB flash drive, mobile hard drive, etc.) and includes several instructions to cause a computer device (such as personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of this application.
[0136] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the aforementioned physical device, supporting the operation of information processing programs and other software and / or programs. The network communication module is used to enable communication between the various components within the storage medium, as well as communication with other hardware and software in the information processing physical device.
[0137] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented using software plus necessary general-purpose hardware platforms, or it can be implemented through hardware. By applying the solution of this embodiment, compared with related technologies, asynchronous communication via message middleware enables automatic publishing and subscription of model calculation results, replacing manual transmission, thereby solving the problem of low efficiency due to multi-model coupling and resulting in delayed early warnings. A hybrid storage architecture of non-relational databases and relational spatial databases is adopted, realizing hierarchical storage and dedicated querying of data, solving the problems of poor storage and read / write lag. Intelligent thinning and vector slicing improve rendering smoothness.
[0138] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0139] In the description of this specification, the terms "one embodiment," "some embodiments," "embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0140] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make modifications, alterations, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. An urban flooding simulation system, characterized in that, The system uses a message middleware as its central hub and a microservice architecture to automate the entire process from rainfall data triggering to dynamic rendering of urban flooding evolution. The message middleware is used for asynchronous communication and data decoupling between modules in the microservice architecture.
2. The urban flooding simulation system according to claim 1, characterized in that, The microservice architecture integrates the following modules to achieve full-process automation from rainfall data triggering to dynamic rendering of urban flooding evolution; The system includes: The Internet of Things (IoT) data receiving and storage module is used to monitor rainfall data in real time and generate model calculation instructions when the rainfall data meets preset trigger conditions. The online model real-time calculation module, in response to the model calculation instruction, calls the encapsulated hydrological and hydrodynamic model to perform simulation calculations to obtain the original time-series waterlogging simulation data, and pushes the original time-series waterlogging simulation data to the message middleware; The real-time data receiving and storage module subscribes to the message middleware, receives and parses the original time-series flood simulation data, and writes the original time-series flood simulation data into a non-relational database in time sequence. The data conversion and compression service module monitors the non-relational database or the message middleware, cleans the original time-series flood simulation data, and performs grid thinning and compression based on spatial proximity and fusion algorithms to obtain flood simulation spatial grid data for rendering. The data service distribution module receives the urban flooding simulation spatial grid data and stores it in a relational spatial database. Based on the relational spatial database, it publishes vector tile services and provides a data query interface based on time series. The data rendering module is used to dynamically request vector map tile data of the corresponding area from the data service distribution module according to the current map view parameters; and to use the client graphics hardware acceleration rendering engine to parse and render the tile data in real time, so as to realize the visualization of the waterlogging evolution process.
3. The urban flooding simulation system according to claim 2, characterized in that, The online model real-time calculation module responds to the model calculation command by calling the encapsulated hydrological and hydrodynamic model to perform simulation calculations to obtain raw time-series waterlogging simulation data, and pushes the raw time-series waterlogging simulation data to the message middleware, including: Based on the rainfall data, a designed rainfall sequence is generated using a rainstorm model algorithm and automatically formatted as an input file; The input file is loaded and executed using the PySWMM component, which is wrapped in Python, to drive the SWMM model to complete the simulation calculation. The simulation results are extracted through the Output class interface of the PySWMM component to generate the original time-series flood simulation data, and the data is pushed to the Kafka message middleware.
4. The urban flooding simulation system according to claim 2, characterized in that, The data conversion and compression service module performs grid thinning and compression on the original time-series flood simulation data, including: Grid data with zero water depth are removed; The grid data is classified according to multiple preset water depth ranges; For grid data within the same water depth range, spatially adjacent grid cells are identified based on a spatial proximity analysis algorithm, and a spatial fusion algorithm is used to merge adjacent grid cells into one or more polygonal features.
5. The urban flooding simulation system according to claim 4, characterized in that, The geometry of the new polygonal feature formed by the spatial fusion algorithm is the outer envelope polygon of all merged grid cells, and the water depth attribute value is the representative value or average value of the attribute values of the merged grid cells.
6. The urban flooding simulation system according to claim 2, characterized in that, The data rendering module dynamically requests vector map tile data for the corresponding area from the data service distribution module based on the current map view parameters. The client-side graphics hardware acceleration rendering engine is used to parse and render the slice data in real time, enabling visualization of the waterlogging evolution process, including: Receive data ready instructions from the data service distribution module via WebSocket; Based on the data ready command and the current map view's range and zoom level, dynamically request the corresponding PBF format vector tile data from the vector tile service; The MapboxGL framework is used to parse the PBF format vector slice data, and the WebGL API is used for real-time shading and rendering.
7. The urban flooding simulation system according to claim 2, characterized in that, The data service distribution module publishes vector tile services based on the relational spatial database, including: Based on multiple preset map zoom levels, the waterlogging simulation spatial grid data is cut and reorganized to generate a vector tile dataset with a multi-level detail (LOD) structure. A map service interface is provided based on the vector tile dataset.
8. A method for simulating urban flooding, characterized in that, Applied to an urban flooding simulation system as described in any one of claims 1-7; the method comprises: Real-time monitoring of rainfall data, and generation of model calculation instructions when the rainfall data meets preset trigger conditions; In response to the model calculation instruction, the encapsulated hydrological and hydrodynamic model is invoked to perform simulation calculations to obtain the original time-series waterlogging simulation data, and the original time-series waterlogging simulation data is pushed to the message middleware; Subscribe to the message middleware, receive and parse the original time-series flood simulation data, and write the original time-series flood simulation data into a non-relational database in time sequence; Monitor the non-relational database or the message middleware, clean the original time-series flood simulation data, and perform grid thinning and compression based on spatial proximity and fusion algorithms to obtain flood simulation spatial grid data for rendering. Receive the waterlogging simulation spatial grid data and store it in a relational spatial database; publish vector tile services based on the relational spatial database; and provide a data query interface based on time series. Based on the current map view parameters, the system dynamically requests vector map tile data for the corresponding area from the data service distribution module; and uses the client-side graphics hardware acceleration rendering engine to parse and render the tile data in real time, thereby visualizing the process of urban flooding evolution.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of claim 8.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method of claim 8.