System Architecture of Cloud-based Web GIS for Real ...

70 downloads 78889 Views 2MB Size Report
to develop a web mapping app for real-time macroeconomic impact decision ..... ArcGIS Server Cloud Builder on AWS. 6. ... ArcGIS Runtime SDK for Android.
System Architecture of Cloud-based Web GIS for Real-Time Macroeconomic Loss Estimation Reza Nourjou

Joel Thomas

GIS Consultant Washington D.C., USA

SPIN Global LLC Washington D.C., USA

[email protected]

[email protected]

ABSTRACT

utilities, especially as it relates to the prioritization of the restoration of critical hubs and services. A power outage is a short- or long-term loss of the electric power to an area; such outages cause economic loss to business & industrial units that are located within the area. Macroeconomic loss is a type of economic loss investigated on an area-specific geographic scale such as a county or regional level. The real-time macroeconomic loss algorithm presents an economic loss estimation as soon as a county experiences an outage situation relative to the anticipated duration of the outage. The loss estimation model includes the following elements: State, County, Time (1 day, 1 week, 1 month); Percentage Change (Sales = 10 Outages in electric utilities become a crisis when an unpredictable event such as a hurricane causes widespread outages that can generate vast negative economic outcomes over extended periods of time. When such a situation occurs, it is important to collect, process, and share information in order to create greater situational awareness. Real-time situational awareness enables decision makers to have a right and real-time perception of crisis and its impact, thus enabling shared consciousness. A web mapping application with the capability to display and analyze real-time macroeconomic loss estimation data as it relates to real-time outage data is valuable for operational decision support, as well as pre- and post-facto planning and policymaking. Data Sources: The U.S. electric & power companies report outage records in their respective service areas, made available in web data formats.1 For example, the Dominion company’s web site displays a list of counties served by Dominion where customers are experiencing power outages.2 Economics Loss Model: The macroeconomic model was provided by REMI3 , and enabled us to assess regional economic loss due to business disruptions for various periods of time. It is a simulation approach, and the economic losses are related to simulations that we ran in the model, but is not the entire model. Real-time situational awareness: A process to create real-time situational awareness, which is addressed in this paper, is a loop consisting of four main steps. This process need to be done in real-time, repeatedly, automatically, and continuously.

This paper presents a system architecture of a web GIS that is used to develop a web mapping app for real-time macroeconomic impact decision support tool. It incorporates web GIS on the cloud with an autonomous software system for real-time situational awareness (outage statue and economic loss) from power & electric utilities. Our web GIS is a system of systems, and we deployed ESRI’s ArcGIS platform, Amazon Web Services (AWS), enterprise spatial database, C#, RESTful API, and JSON format. The system implementation results in a web GIS that contains a GIS server with a set of REST APIs of GIS web services (map service, geodata service, etc) on the cloud that can be used by web mapping apps, mobile GIS apps, or desktop programs to share, display, analyze, and update a geodatabase, which is embedded in cloud. To evaluate our approach, we developed a web map application and an operations dashboard that used the created GIS web services and APIs. Our web GIS is applicable for the "Internet of Things" domain, public safety, cloud communication, crisis response, web map application, location-based services, and real-time GIS.

Categories and Subject Descriptors H.3.5 [Online Information Services]: Data sharing, Web-based services; H.2.8 [Database applications]: Spatial Databases and GIS

Terms Design

Keywords Web GIS, web data, cloud computing, spatial database service, GIS web services, situational awareness, real-time, system design and architecture, macroeconomic loss estimation, API, web map

1.

INTRODUCTION

Real-time macroeconomic loss information is a key element in situational awareness and is important for decision-makers in emergency management and industry partners such as electric & power

1. Collect and process outage data from numerous sources (web

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

1

A list of major electric&power distribution companies in the U.S. included in this study: Dominion, PJM, Duke Energy, Georgia Power, Southern Company, ComEd, SoCal Ed, PG&E. This paper selected the Dominion Virginia Power Company to evaluate and validate the proposed system architecture. 2 http://outagemap.dom.com.s3-website-us-east-1.amazonaws. com/external/report.html?report=report-panel-county-muni 3 REMI model methodology is fully transparent and information about can be found in our documentation at http://www.remi.com

MobiGIS 16, October 31-November 03 2016, Burlingame, CA, USA c 2016 ACM. ISBN 978-1-4503-4582-8/16/10. . . $15.00

DOI: http://dx.doi.org/10.1145/3004725.3004731

56

2.

data)

RELATED WORKS TO GIS ON CLOUD

GIS is a valuable tool in natural disasters that impact humans [4], [5] and there is no doubt that the emergence of cloud computing technology will lead to significant opportunities for GIS [1], [6]. Cloud-based GIS is an ideal approach to improve conventional GIS applications by providing services to users across the globe. Cloud GIS is the combination of running GIS software and services on cloud infrastructure and accessing GIS capabilities using the web. Analyzing and geoprocessing the large-scale spatial data is complex and computationally intensive [2]. Moreover, it is costly for a user to purchase or maintain professional software and hardware. Therefore it is unlikely that a traditional GIS can provide effective spatial information services. An example of cloud-based GIS is Google Maps, which combines satellite imagery with maps and geospatial data and provides Application Programming Interfaces (APIs) [3]. Another example is the ArcGIS Server on Amazon Web Services which allows you to deploy a web GIS or GIS server on Amazon Web Services (AWS). The ArcGIS software runs on Amazon’s hardware and is administered through web services. To cope with the weaknesses of conventional GIS, cloud-based GIS has advanced capabilities in collecting, processing, analyzing, and publishing geospatial data. Emergency service organizations can use cloud GIS to reduce cost. GIS users are able to gain access to low-cost services. The cloud GIS enables users to increase or decrease the capacity as needed.

2. Estimate macroeconomic loss 3. Display data through web maps 4. Share data and make data available and accessible for application Research question: How might one create a real-time situational awareness and decision support tool, whose main component is real-time macroeconomic loss estimation? Objective:This paper presents a cloud-based web GIS for realtime macroeconomic loss estimation and decision support. Our approach targets emergency managers and industry partners in the energy sector such as power suppliers and transmission companies. Our web GIS is a system of systems that integrates a set of interdependent systems. Contribution: Our contribution is a system architecture that enables us to develop cloud-based web GIS. This paper aims to explore its elements in the following details: 1) a list of systems, 2) relations between those systems, 3) system functions, 4) implementation, 5) data model, 6) problem-solving algorithms, 7) and work-flow. Novelty of Work: We proposed a real-time macroeconomic loss estimation tool for emergency managers and industry partners. It has the capability of interpolating data from numerous sources to provide decision support based on GIS web services. Importance & significance: To the best of our knowledge, this research is the first of its kind that is performed in the U.S. for the purposes of real-time planning and operational decision support. The methods and models used for both real-time power outages and macroeconomic modeling offer the most precise data calculations available. Our approach has the following advantages:

3.

SOLUTION

Our solution is used to develop an app that enables emergency managers to conduct hazard-driven regional economic loss assessments. The intended use of the tool is to aid decision makers ability to understand impacts, mitigate risk, and use the information to assist with triage of response efforts based upon anticipated losses and vulnerabilities.

• It enables us to develop a web GIS for real-time macroeconomic loss estimation as a part of situational awareness. • The REMI macroeconomic loss estimation model is superior to other available macroeconomic models in that it incorporates four major modeling approaches: Input-Output, General Equilibrium, Econometric, and Economic Geography.

4.

SYSTEM ARCHITECTURE OF WEB GIS

• It provides an important decision support tool for disaster emergency management and crisis response in the energy sector.

Our system architecture is shown in Figure 1. Integration (connection) of eleven components (systems) forms this web GIS. This architecture deploys ESRI ArcGIS and Amazon Web Services (AWS). Functions of those components are presented in Table 1. Table 2 presents a list of tools used to implement or develop those systems.

• It integrates the best available data from existing systems to develop more holistic real-time situational awareness.

4.1

• It provides a flexible and scalable architecture to be used, extended and integrated with related applications such as locationbased social networks, location-based services, Internet of Things (IoT) applications, mobile application for public safety, and damage assessments in multiple hazard types such as floods, tornadoes, hurricanes and earthquakes. • It provides a feature service ( as a geodata server and spatial database service) to access, update, share, query, process, analyze, display, and map data of a shared geodatabase trough REST API. • It uses the cloud technology in our web GIS to store and share data, to server and run GIS web services, embed the GIS server, embed software programs for computation, and connect all software entities together.

Web Data

Real-time outage data is available and accessible in web pages, and would be provided with web data formats such as JSON. We investigated outage data publicly available on the Dominion Power company’s web site.4 Its web site displays a list of the service areas, cities and counties served by Dominion Virginia Power company where customers are experiencing power outages. These data are displayed in a table and a web map and are updated each 15 minutes to show a real-time and live status of power outage. An outage record is associated with several types of information: name of state, name of county as a service area, number of costumers, number of customers without electricity, and time of last update. The web RESTful API5 enables us to access and receive outage 4 http://outagemap.dom.com.s3-website-us-east-1.amazonaws. com/external/report.html?report=report-panel-county-muni 5 http://outagemap.dom.com.s3-website-us-east-1.amazonaws. com/resources/data/external/interval_generation_data/2016_08_ 25_06_30_30/report_region.json?_=

• It allows us to create web GIS services as a RESTful API which can be used by any application.

57

Figure 1: System architecture of cloud-based web GIS for real-time macroeconomic loss estimation.

4.2.1

data by the JSON format. Figure 2 present outage statues of two counties by the JSON format.

Data Model

The aim of a data model is to support creating the enterprise geodatabase. In this paper, we designed a data model as Figure 3 shows. It is designed as a unified modeling language (UML) class diagram that presents data, attributes, and relationships between entities. The layer Counties contains county features as spatial data. A county entity is associated with temporal and dynamic attributes as follows: • County: indicates the name of county. • State: indicates the name of state where this county is located. • FIPS: indicates an unique key (identification) • cust_a: indicates a number of customers without electricity located in this state. This information is dynamic and temporal, and it needs to be updated frequently. This information is real-time if it is observed in the current time.

Figure 2: A part of outage data received for two counties from Dominion’s web site in the JSON format.

4.2

• cust_s: indicates a number of customers who are located in this state. • date_generated: indicates a date and time that outage data are collected /updated last time.

Enterprise Geodatabase

• Dynamic_Loss: indicates an estimated macroeconomic loss that commercial, residential and industrial customers would experience due to outages in the county. This information is dynamic and temporal and is re-calculated whenever new outage data is collected.

Data is the core of information systems, and enables us to create and publish web GIS services. An enterprise database, which is considered a centralized database in web GIS, contains and shares all data (geographic and non geographic information) required for other components to do data-related operations.

58

Table 1: System Functions and Actions System (component) 1. Web Data 2. Administrator

3. Enterprise Geodatabase 4. Cloud Computing Platform

5. GIS Server 6. Replicated Geodatabase 7. GIS Web Services 8. Autonomous Software 9. Desktop App 10. Web Mapping App 11. Mobile GIS App

Functions - Make real-time outage information publicly available and accessible through web pages (map, table) on the Internet - Update outage statues continuously - Design and create the enterprise geodatabase - Prepare and insert base data into the enterprise geodatabase - Create (publish) GIS Web Services - Synchronize and replicate the enterprise geodatabase and the replicated geodatabase - Administrate the web GIS - Contain all data required by other components for data-related tasks - Provide all data used in creating web GIS services - Embed the autonomous software - Embed the database management system (SQL Server) and the replicated geodatabase - Embed the GIS server and related GIS web services - Make the GIS web services accessible and available - Create and manage GIS web services - Contains data required by GIS web services - Provide a centralized and shared geodatabase as a Geatada server - Share GIS resources as web services (REST API) such as map services, geodata service, feature services - Collect and extract outage information from web data - Estimate macroeconomic loss - Edit and update the replicated geodatabase via REST API - Use GIS web services - Use GIS web services in web app - Use GIS web services in mobile device

Table 2: Tools used for System Implementation Component 1. Web Data 2. Administrator 3. Enterprise Geodatabase 4. Cloud Computing Platform 5. GIS Server 6. Replicated Geodatabase 7. GIS Web Services 8- Autonomous Software

9. Desktop App 10. Web Mapping App

with fixed attributes to display REMI data on the map.

Tools - ArcGIS for Desktop 10.3 - Microsoft SQL Server 2016 - ArcGIS for Desktop - Amazon Web Services (AWS) - ArcGIS for Server 10.4 - ArcGIS Server Cloud Builder on AWS - SQL Server Standard - ArcGIS for Desktop - ArcGIS for Server - C#.NET - Network Programming in the .NET - LINQ and JSON in .NET - ArcGIS Runtime SDK for .NET - ArcGIS REST API - Operations Dashboard for ArcGIS - ArcGIS Online - Web AppBuilder for ArcGIS - HTML - JavaScript - Dojo

11. Mobile GIS App

- JavaScript - ArcGIS API for JavaScript 3.17 - Visual Studio Code - ArcGIS Runtime SDK for Android - Android Studio

Figure 3: A data model of enterprise geodatabase.

4.3

Administrator

An administrator is a user who administrates the web GIS. Whenever the layer County is updated, a copy of the data is inserted and stored in the table "History". This table allows us to track how long a single customer has been out of power, to show what would happen if the current outage level lasted for a week, month etc. In fact, given this is presenting economic results and outage observations in real-time, updating every 30 minutes, this table is valuable for relevant queries. The table REMI presents macroeconomic loss on the regional level. This data, which is fixed, is used by autonomous software for macroeconomic loss estimation. In addition, we created 12 layers

4.4

Cloud Computing Platform

Cloud computing is a type of Internet-based computing that provides shared computer processing resources and data to computers and other devices on demand. It is a model for enabling ubiquitous, on-demand access to a shared pool of configurable computing resources (e.g., computer networks, servers, storage, applications and services) 6 . 6

59

https://en.wikipedia.org/wiki/Cloud_computing

A cloud computing platform such as Amazon Web Services and Microsoft Azure could benefit the web GIS and enhance the system performance in real-time situation awareness. It enables us to install, store, and execute software components such as autonomous software, GIS server, replicated geodatabase, and GIS services.

4.5

GIS Server

A GIS server7 allows us to share GIS resources with users over the web through web services which allow a powerful server computer to receive and process requests for information sent by other devices.

4.6

Replicated Geodatabase

This is a geodata server that provides all data needed by the GIS server to serve the web GIS services. This database is a version of the enterprise geodatabse and is replicated and synchronized with it. In addition, it is provides a centralized spatial database in the our web GIS and share data.

4.7

GIS web Services

GIS Web services make it easy to share GIS resources across applications over the Internet. They conform to web standards (REST API). A web GIS service is a GIS related work such as mapping, geoprocessing, deogeographic features (geodata). These services can be optimized easily for, and integrated with, web, mobile, and desktop applications, as well as other services. This paper created four web GIS services as Table 3 shows. A feature service allows us to serve data over the Internet. Clients can execute queries to get data and perform edits. A map service makes maps, features, and attribute data available on the Internet for applications.

Figure 4: Work flow of real-time macroeconomic loss estimation for real-time situational awareness.

5

10

using using using using using

L i s t < O u t a g e _ C l a s s > E x t r a c t W e b D a t a ( s t r i n g u r l _ w e b d a t a , DateTime RealTime ) { / / −−> C o l l e c t O u t a g e s L i s t < O u t a g e _ C l a s s > O u t a g e s = new L i s t < O u t a g e _ C l a s s > ( ) ; / / 2−−> Send a R e q u e s t H t t p W e b R e q u e s t r e q u e s t = WebRequest . C r e a t e ( u r l _ w e b d a t a ) a s H t t p W e b R e q u e s t ; r e q u e s t . ContentType = " a p p l i c a t i o n / json " ; r e q u e s t . Accept = " a p p l i c a t i o n / j s o n " ; r e q u e s t . Method = WebRequestMethods . H t t p . Get ;

15

Table 3: GIS Web Services Service Name s1 s2 s3 s4

Service Type Feature Service Feature Service Map Service Map Service

Data - Counties - History - Counties - History - REMI - CountyREMI100Day - CountyREMI75Day - CountyREMI50Day - CountyREMI10Day

/ / 3−−> R e c e i v e / A c c e s s t h e Data HttpWebResponse r e s p o n s e = r e q u e s t . G e t R e s p o n s e ( ) a s HttpWebResponse ;

20

u s i n g ( v a r r e a d e r = new S t r e a m R e a d e r ( r e s p o n s e . G e t R e s p o n s e S t r e a m ( ) ) ) { / / 4−−> Read t h e Whole R e c e i v e d Data i n JSON d a t a v a r DataJSON = r e a d e r . ReadToEnd ( ) ;

25

J a v a S c r i p t S e r i a l i z e r s e r i a l i z e r = new J a v a S c r i p t S e r i a l i z e r ( ) ; dynamic j s o n O b j e c t = s e r i a l i z e r . D e s e r i a l i z e < dynamic > ( DataJSON ) ; 30 / / 5−−> County−Outage Data i n JSON Fomrat dynamic C o u n t i e s D a t a J S O N = j s o n O b j e c t [ " f i l e _ d a t a " ] [ " a r e a s " ] ; / / 6 −−> Read S t a t e s f o r e a c h ( dynamic s t a t e 0 i n C o u n t i e s D a t a J S O N [ 0 ] [ " a r e a s " ] ) { / / 7 −−> Read C o u n t i e s f o r e a c h ( dynamic c o u n t y 0 i n s t a t e 0 [ " a r e a s " ] ) { O u t a g e s . Add ( new O u t a g e _ C l a s s ( ) { County = s t a t e 0 [ " a r e a _ n a m e " ] , S t a t e = county0 [ " area_name " ] , cust_a = county0 [ " cust_a " ] [ " val " ] , cust_s = county0 [ " cust_s " ] , date_generated = county0 [ " date_generated " ] }); } }

35

4.8

Autonomous Software

The core of web GIS is an autonomous software that has three important capabilities: 1) extract and collect outage information from distributed web data, 2) assess macroeconomic loss on the county level, and 3) edit and update the shared geodatabase (replicated geodatabase). Figure 4 shows a work flow used by this system for macroeconomics loss estimation in real-time. Our autonomous software executes this process in real-time, repeatedly, continuously, and automatically in order to provide a real-time situational awareness. The autonomous software is located in the cloud.

40

45

50

Extract Web Data

Listing 1 presents a C# code that is used by the software to extract and collect outage data from Dominion’s web page.

} return Outages ; }

55

4.8.1

System . Net ; System . IO ; System . Web . S c r i p t . S e r i a l i z a t i o n ; System . C o l l e c t i o n s . G e n e r i c ; System ;

60

Listing 1: C# code to extract and collect outage data from web data

c l a s s Outage_Class { public string State { get ; set ; p u b l i c s t r i n g County { g e t ; s e t p u b l i c double c u s t _ s { g e t ; s e t p u b l i c double c u s t _ a { g e t ; s e t p u b l i c DateTime d a t e _ g e n e r a t e d }

4.8.2

1

} ; } ; } ; } { get ; set ; }

Assess Macroeconomic Loss

Algorithm 1 presents a macroeconomic loss model8 that is used

7 We deployed ArcGIS for Server to implement a GIS server in this paper. Please see Table 2

8

60

This is the initial version

for macroeconomic loss estimation in counties due to outages. Also this algorithm updates the attribute Dynamic_Loss of each feature county in the GIS layer "Counties". This model is based on REMI methods whose data, REMI, are inserted into the enterprise geodatabase in the table REMI. Please see Figure 3. The autonomous software has an autonomy to execute this algorithm in real-time whenever new outage data is observed ( extracted and collected from the web data). The autonomous software uses web GIS services as REST APIs to access, query, edit (add new feature or modify attributes), and update data, which are located and managed by the replicated geodatabase. Updated data Counties are shared with other components via the the replicated geodatabase. % Loss Assessment Model Data: Counties, REM I Result: % Update the Data Counties 2 for c0 ∈ Counties do 3 end 4 p ← 100 ∗ c0 .cust_a/c0 .cust_s; 5 if p = 100 then 6 p0 ← 100; 7 end 8 else if p >= 75 and p < 100 then 9 p0 ← 75; 10 end 11 else if p >= 50 and p < 75 then 12 p0 ← 50; 13 end 14 else if p >= 10 and p < 50 then 15 p0 ← 10; 16 end 17 else 18 p0 ← 0; 19 end 20 for r0 ∈ REM I do 21 end 22 if r0 .State = c0 .State and r0 .County = c0 .County and r0 .P ercentage_Change = p0 and r0 .T imeF rame = ”One Day” then 23 end 24 r2 ← r0 ; 25 break the loop; 26 if r2 = ∅ then 27 c0 .Dynamic_Loss ← 0; 28 end 29 else 30 c0 .Dynamic_Loss ← r2 .T otal_Output/(24.0 ∗ 4.0) 31 end Algorithm 1: A Loss Model used by the Autonomous Software

/ / REST API o f a F e a t u r e S e r v i c e t o E d i t t h e GIS L a y e r " C o u n t i e s " / / P l e a s e change [ GISServer . . . ] t o a r e a l a d d r e s s s t r i n g u r i _ C o u n t i e s = " h t t p : / / [ GISServer . . . ] / s1 / F e a t u r e S e r v e r / 0 " ; 15

20

25

30

1

35

40

45

50

55

60

65

70

75

80

85

90

4.8.3

Modify the Geodatabase

The replicated geodatabase is considered a centralized spatial database that shares data and make data available and accessible for applications via feature services. Therefore, the autonomous software is an ability to access and edit geodatabase using relevant GIS services. Listing 2 presents a C# code for implementing this capability. It can be used for related tasks. Listing 2: C# code to edit the geodatabase via web services (REST API)

95

5

10

/ / REST API o f a F e a t u r e S e r v i c e t o Add R e c o r d s t o T a b l e " H i s t o r y " s t r i n g u r i _ H i s t o r y = " h t t p : / / [ GISServer . . . ] / s2 / F e a t u r e S e r v e r / 1 " ; / / A c c e s s t o Data " C o u n t i e s " i n t h e G e o d a t a b a s e v a r D a t a C o u n t i e s = new S e r v i c e F e a t u r e T a b l e ( ) ; DataCounties . ServiceUri = uri_Counties ; await DataCounties . I n i t i a l i z e A s y n c ( null ) ; i f ( D a t a C o u n t i e s . I s I n i t i a l i z e d == f a l s e ) { C o n s o l e . W r i t e L i n e ( " {0} E x c e p t i o n c a u g h t . " ) ; r e t u r n ; } D a t a C o u n t i e s . O u t F i e l d s = E s r i . ArcGISRuntime . T a s k s . Query . O u t F i e l d s . A l l ; / / A c c e s s t o Data "REMI" i n . . . v a r DataREMI = new S e r v i c e F e a t u r e T a b l e ( ) ; DataREMI . S e r v i c e U r i = uri_REMI ; a w a i t DataREMI . I n i t i a l i z e A s y n c ( n u l l ) ; i f ( DataREMI . I s I n i t i a l i z e d == f a l s e ) { C o n s o l e . W r i t e L i n e ( " {0} E x c e p t i o n c a u g h t . " ) ; r e t u r n ; } DataREMI . O u t F i e l d s = E s r i . ArcGISRuntime . T a s k s . Query . O u t F i e l d s . A l l ; / / A c c e s s t o Data " H i s t o r y " i n . . . v a r D a t a H i s t o r y = new S e r v i c e F e a t u r e T a b l e ( ) ; DataHistory . ServiceUri = uri_History ; await DataHistory . In i ti a li ze A sy n c ( null ) ; i f ( D a t a H i s t o r y . I s I n i t i a l i z e d == f a l s e ) { C o n s o l e . W r i t e L i n e ( " {0} E x c e p t i o n c a u g h t . " ) ; r e t u r n ; } D a t a H i s t o r y . O u t F i e l d s = E s r i . ArcGISRuntime . T a s k s . Query . O u t F i e l d s . A l l ; / / Read Data REMI and S t o r e i n a L i s t L i s t REMI = new L i s t ( ) ; v a r REMIs = a w a i t DataREMI . QueryAsync ( new Q u e r y F i l t e r ( ) { WhereClause = " 1 = 1 " } ); f o r e a c h ( F e a t u r e r 0 i n REMIs ) { REMI . Add ( new REMI_Class { County = ( s t r i n g ) r 0 . A t t r i b u t e s [ " County " ] , Economic_Variable = ( string ) r0 . A t t r i b u t e s [ " Economic_Variable " ] , Percentage_Change = ( string ) r0 . A t t r i b u t e s [ " Percentage_Change " ] , S t a t e = ( string ) r0 . A t t r i b u t e s [ " S t a t e " ] , Timeframe = ( s t r i n g ) r 0 . A t t r i b u t e s [ " Timeframe " ] , Total_County_GDP = ( d o u b l e ) r 0 . A t t r i b u t e s [ " Total_County_GDP " ] , T o t a l _ J o b s = ( double ) r0 . A t t r i b u t e s [ " T o t a l _ J o b s " ] , T o t a l _ O u t p u t = ( double ) r0 . A t t r i b u t e s [ " T o t a l _ O u t p u t " ] }); } / / Query and S e a r c h Data C o u n t i e s string state0 = null ; / / i n p u t a number ; string county0 = null ; / / i n p u t a number ; v a r Q u e r y F e a t u r e s = a w a i t D a t a C o u n t i e s . QueryAsync ( new Q u e r y F i l t e r ( ) { W h e r e C l a u s e = " S t a t e = ’ " + s t a t e 0 + " ’ AND " + " County = ’ " + c o u n t y 0 + " ’ " } ); F e a t u r e FCounty0 = Q u e r y F e a t u r e s . F i r s t ( ) ; / / E d i t t h e A t t r i b u t e s o f t h e S e l e c t e d C o u n t y FCounty0 . A t t r i b u t e s [ " c u s t _ s " ] = n u l l ; / / i n p u t a number ; FCounty0 . A t t r i b u t e s [ " c u s t _ a " ] = n u l l ; / / i n p u t a number ; FCounty0 . A t t r i b u t e s [ " Dynamic_Loss " ] = n u l l ; / / c a l c u l a t e t h e l o s s s FCounty0 . A t t r i b u t e s [ " d a t e _ u p d a t e d " ] = n u l l ; / / input a date ; / / Update t h e Data C o u n i e s i n G e o d a t a b a s e a w a i t D a t a C o u n t i e s . UpdateAsync ( FCounty0 ) ; / / D e f i n e t h e URI o f Web GIS S e r v i c e s : REST API

/ / REST API o f a Map S e r v i c e To A c c e s s t h e T a b l e "REMI" s t r i n g uri_REMI = " h t t p : / / [ G I S S e r v e r . . . ] / s 4 / MapServer / 5 " ;

115

/ / 8−−>> Add a New R e c o r d t o Data H i s t o r y v a r N H i s t o r y 0 = new G e o d a t a b a s e F e a t u r e ( D a t a H i s t o r y . Schema ) ; var A t t r i b u t e s 0 = NHistory0 . A t t r i b u t e s ; A t t r i b u t e s 0 [ " County " ] = FCounty0 . A t t r i b u t e s [ " County " ] ; A t t r i b u t e s 0 [ " S t a t e " ] = FCounty0 . A t t r i b u t e s [ " S t a t e " ] ; A t t r i b u t e s 0 [ " c u s t _ s " ] = FCounty0 . A t t r i b u t e s [ " c u s t _ s " ] ; A t t r i b u t e s 0 [ " c u s t _ a " ] = FCounty0 . A t t r i b u t e s [ " c u s t _ a " ] ; A t t r i b u t e s 0 [ " FIPS " ] = FCounty0 . A t t r i b u t e s [ " FIPS " ] ; A t t r i b u t e s 0 [ " d a t e _ u p d a t e d " ] = FCounty0 . A t t r i b u t e s [ " d a t e _ u p d a t e d " ] ; A t t r i b u t e s 0 [ " Dynamic_Loss " ] = FCounty0 . A t t r i b u t e s [ " Dynamic_Loss " ] ; v a r recNo = a w a i t D a t a H i s t o r y . AddAsync ( N H i s t o r y 0 ) ; / / Update G e o d a t a b a s e by E d i t e d

County

var e d i t R e s u l t _ u p d a t e s = await DataCounties . ApplyEditsAsync ( f a l s e ) ; / / Update G e o d a t a b a s e by New H i s t o r y var e d i t R e s u l t _ a d d = await DataHistory . ApplyEditsAsync ( f a l s e ) ; / /

Suggest Documents