Mobile-based Expert System for Selecting Broiler Farm Location Using PostGIS

Massive development of broiler farms has led to many socio-environmental problems. Based on idea that broiler farm must be located at suitable location, an expert system for site selection based on the socio-environmental factors and sustainable principles is urgently needed to cope with this problem. This study proposed the utilization of PostGIS as a spatial database to develop a mobile-based expert system as guidance for broiler farmers to choose the best location for broiler farm. There were four factors considered in the system: 1) ecology and environmental impact, 2) economic and infrastructure, 3) natural condition, and 4) natural disaster vulnerability, each of which consists of sub-factors. A mobile-based expert system has been developed by using open source web Geographical Information System (GIS) server and PostgreSQL/PostGIS, and can be installed on Android device and can be used to determine a suitable location for broiler farm development. The developed system has been implemented and validated in the case-study area in Parung, Bogor.


Introduction
By a large number of inhabitant and high population growth rate, Indonesia is facing the increasing demand for high-quality and high-quantity animal protein as well. Demand for broiler always increases every year as reported by Directorate General of Livestock and Animal Health, Republic of Indonesia [1] that the consumption rate of broiler meat was increasing from 3.076 kg/capita/year (2006), to become 3.494 kg/capita/year (2012).
As positive respond, many broiler farms are built to increase production. The same case with other business development, broiler farm development should also consider three important aspects of sustainable development: economic, social, and environment. However, in fact, the massive development of broiler farms has introduced socio-environmental problems. One solution is to solve these problems to develop a decision tool for selecting the proper and suitable areas for broiler farm establishment. This will guide brolier farmers to build a broiler farm house at inapropriate areas that will cause socio-environmental problems. This decision tool has been built in the web-based and mobile based platform to allow easier or more flexible access and use by broiler farmers or decision makers any time and anywhere.
The development of spatial-based decision support systems and expert systems has been done by previous researchers, such as a web-based geographic information system for Aceh natural hazards [2], spatial natural resources information system [3], management platform of traffic control devices [4], archeological web GIS application [5], and web-based GIS application for rabies spread [6]. However, there is no research on the development of mobilebased GIS application especially for poultry industry.
The purpose of this research was to develop and utilize a mobile-based expert system by implementing PostGIS as a spatial database which can be used as guidance for broiler farmer to take the decision to ensure the productivity by still paying attention to the environment and society. While the benefit of this research is that the expert system as the expected output can be used to help broiler farmers, government, and other stakeholders in decision making in order to develop new broiler farms in suitable location especially to cope with the environmental problem. As the main goal, the productivity should be raised, but still care to the environment and society. This research was limited to closed house type of broiler farm with the case study in Parung, Bogor, Indonesia. However, the developed system can be used as a prototype of the same system for various agricultural or another industry field.

Research Method 2.1. Study Area and Datasets
This research was conducted from February to September 2015. Parung, Bogor Regency, West Java, Indonesia was chosen as a study area, while the development process was done in Biotrop Campus, Bogor.
Datasets used in this research were digital suitability map which were created by Wijayanto [7] by using GIS-based multi-criteria analysis method. The map was in the form of shapefile (.shp) which was exported to the database become one table.

Procedures of System Development
The Method used in this system development refers to Extreme Programming (XP). The XP method was chosen because information and knowledge, experts, and all supporting data has been available [8]. The suitability map that was obtained from previous part was used as a base for the spatial module.
The analysis and design step adopted extreme programming method. This step consisted of four steps: analysis, design, implementation and testing, and finally release the application. Details about each step was explained below: 1) Analysis: In this step, system requirement was analyzed by understanding the latest technology for more usable and general system development. In this case, a mobile-based system was chosen concerning its usability, low cost, and current technology trending. To cope cross platform problem, this system was not developed as one platform application rather than was developed as a mobile web-based application which can be accessed from several mobile platform. 2) Design: Interface and database design was done in this step. Interface design was focused on the interaction between the user and the system. The interface which consists of input and output must be interactive, easy, and efficient to the user. The Database was designed by designing structure and data of web database. 3) Implementation: The system implementation was done to implement the system in a research level by using a localhost server. To view the system running, the common desktop browser was used, only by changing the windows size to mobile size aspect ratio. Testing by using mobile device could be done after the system have been uploaded to the online server. The system was tested on a mobile device in the form of installed application in Android device. 4) Software release: If the system can pass the test, then it was ready to be released. The system was released in the form of package system which was ready to be downloaded and installed on Android devices. In this research, a suitability map produced by AHP method [7] was used as input data. The suitability map then exported as one table in the spatial database which was PostgreSQL and PostGIS extension. Spatial databases are a new technology in the database systems which allow storing, retrieving and maintaining geospatial data [9]. While PostGIS is an extension to the PostgreSQL object-relational database system which allows GIS objects to be stored in the database [10].

System Development Analysis
Analysis is the first step in system or software design and development. This step is very important before the next is done. There were three aspects of analysis in this system development, which are: 1) user needs analysis, 2) functional needs analysis, and 3) nonfunctional needs analysis. The user needs analysis is part of the ongoing process of system development that will effectively meet the needs of users. This process also helps to determine the technological requirements necessary to justify these needs. Target user of this system are: 1) farmer, 2) private companies, and 3) government institution. Each user has the same role and right in using this system, however the interest is different to each other. Table 1 below shows the interest of each target user based on analysis. The functional needs analysis aims to predict the system working needed by users. Table 2 shows the system functional needs which were considered in system development. Functional needs Description 1 About the system To know the profile of the system and system developer 2 Direction to use To know the direction to use the system (user guide) 3 Contact or feedback To send recommendation, advice, information, or any feedback about the system 4 Analysis To analyze the suitability based on spatial input Needs included as non-functional needs were: 1) comfort of color and display, 2) speed of access, 3) ability of the system to serve in real time. In comfort factor, components that were emphasized in the design of this system were the selection of colors, the layout, and the use of icons. In determining location, spatial input by moving the marker on the map might be difficult. Thus, a capability of location detection by using GPS is very important. Based on the analysis, it was decided that the system would be developed as Android application.

System Design
The developed system consists of three parts: 1) user interface, 2) database, and 3) processor. The user interface enables interaction between users of the system [11]. User interface as the input section will be seen by the user. The user interface was installed on the user device, in this case, an Android device. Database was related to data management and storage. The suitability map step was exported as one table in the database. The database was not attached on the user device but stored on the server. PostgreSQL with PostGIS extension was used as a spatial database management system. The processor processes the input from the user, do the database query and calculation, and serve the appropriate information to the user as requested. The processor was developed by using some web programming language: php, javascript, jQuery, html+css, and application programming interface (API) such as GoogleMaps API. Figure 1 shows the working scheme of the system. Black arrow represent request flow while brown arrow represents data or information flow. The working scheme of the system is: 1) User sends a request, then the request will be sent through the internet to the server 2) On the server, the processor will process the request and decide whether it is required to do a database query to retrieve data from the database or the processor needs to retrieve another data from external source. 3) If it is required to do a database query, the processor will do a database query to retrieve data from the database. 4) Data from the database will be retrieved, and will be processed by the processor to become information. Information will be sent to the user through the internet. If it is required to do data retrieval from an external source, the processor will retrieve data from external source, in this case, is data from Badan Meteorologi, Klimatologi, dan Geofisika (BMKG, the Agency of Meteorology, Climatology, and Geophysics). BMKG serves climatic data (such as temperature, humidity, rain prediction, etc) of every city in Indonesia.
Climatic data is needed to analyze the suitability of area which are not located in Parung as a study area. The data are served as .xml file which can be read by using XML parsing. Data from the external source will be retrieved and processed by the processor to become information. Information will be sent to the user through the internet.

Figure 1. System working scheme
Object-relational database design conceptually illustrates relationships data objects that will be implemented into the system [8]. Figure 2 shows the design for database tables. The main tables are suitability table, village table, and village_central table which are all spatial tables.

Figure 2. Database design
The suitability table is the suitability map in shapefile which was exported to become database table. One feature in the shapefile would be one row in the database table. There are five fields in suitability table: village_id, suitability, score, area, and geom. Field of village_id is the primary key, represents the ID of village of the location. This field is used to find the name of the village from the village table. Field of suitability represent the suitability, this field will be read and showed to the user. The score field represents the suitability in numerical value. The value of 1 is for very unsuitable location and the value of 5 is for very suitable location. This field was created to make query process become easier. The field of area represents the area (in hectares) of each location. The field of geom is the most important field. This field contains the  The village_central table contains only two fields: village_id as primary key, and geom. This table used in location selection by selecting the name of the village. The field of geom is the coordinate of the centroid of each village. The concept is: when user selects a desa, then the system will direct the marker to move to the centroid of the village, based on the coordinate in this table.
The regency table is used in location selection by using form (for a location outside Parung). This table contains all cities or kabupaten in Indonesia. The other three tables: settlement, disaster, and waterbdy, were used in reasoning feature.

System Implementation
The idea for this system working is that if the user put a point on a certain location, the system should be able to read whether the point is located on a certain polygon or another polygon in the suitability map, and then read the attribute of the polygon as requested by the query. Figure 4 shows the illustration of point location calculation.  Figure 4, there are three rectangle polygons which are polygon a, polygon b, and polygon c. A polygon is theoretically constructed by nodes which are connected by line. In Figure 4, polygon a is constructed by four nodes: (1,1), (1,8), (7,8), and (7,1), and polygon b and c also constructed by each node as shown in the figure. If user input coordinate of a point, the system will calculate the location of the point, whether it is located on polygon a, polygon b, or polygon c. Based on the coordinate of nodes, a point is located on polygon a if and only if the x coordinate of the point is more than or equal to 1 and less than or equal to 7, and the y coordinate is more than or equal 1 and less than or equal 8. In Figure 4, the user put a point in the coordinate of (6, 7). By using the certain algorithm, since the x coordinate is more than 1 but 365 less than 7 and the coordinate of y is more than 1 but less than 8, the system will read that the point is located on polygon a, and then read the attributes of polygon a to be served as information. Also if user put a point on q (11,4), the system will read that point q is located on polygon b by the same algorithm, and if user put a point on r (13,5), the system will read that point r is not located on any polygon a, b, or c. The system was implemented by using several web programming languages, such as html, CSS, PHP, Javascript, and jQuery. A copy of code below is an example of query code written in PHP. This code will return the result of location suitability based on the coordinate input which is represented by longitude ($lng variable) and latitude ($lat variable). Some PostGIS function is used in this code, which are ST_Within, ST_SetSRID, and ST_MakePoint.

Developed System
The developed system has been implemented on a web-based mobile platform and can be installed on an Android device. The system installer can be downloaded from http://arif.mit.biotrop.org or http://broilerfarmloc.web.id. Main features in this system include location detection using GPS, suitability analysis based on the spatial input, suitability analysis based on form input, a location recommender based on farm capacity, and other information related to a broiler industry. Figure 5 and Figure 6 display the current implemented system running on mobile device. Up to this time, we have not found any research, specifically on an application system for analyzing and selecting suitable broiler farm locations based on spatial and geographical data and information. Some relevant and related researches have been working on the use of GIS for determining a suitable location for wildlife habitat restoration [12], for selecting suitable sites for animal waste application [13] and for selecting suitable areas for dairy cattle farm [14]. In poultry field, a research has been done on producing a suitable map for a chicken farm in Kalimantan [15], without developing an application system for a chicken farm selection. Our research has been focused on the development of an application system for selecting suitable broiler production areas based on spatial and geographical data combined with the legal aspects (governmental rules and policies) for establishing broiler house in Indonesia.

System Validation
To validate the correctness of our developed system, real field/ground checking was conducted to confirm the match between the real field condition and the decision produced by our system. The ground checking was carried out on several spots in the study area (i.e. Parung region). The validation survey points are shown in Figure 7.