Suitable area based on all factors

22 1 User send a request, then the request will be sent through internet to the server 2 On the server, processor will process the request and decide wheter it is required to do database query to retrieve data from database or the processor needs to retrieve another data from external source. 3 If it is required to do database query, processor will do database query to retrieve data from database. 4 Data from database will be retrieved, and will be processed by processor to become information. Information will be sent to the user through internet. 5 If it is required to do data retrieval from external source, processor will retrieve data from external source, in this case is data from the Agency of Meteorology, Climatology, and Geophysics BMKG. BMKG serves climatic data such as temperature, humidity, rain prediction, etc of every cities in Indonesia. Climatic data is needed to analyze the suitability of area which are not located in Parung as study area. The data are served as .xml file which can be read by using xml parsing. 6 Data from external source will be retrieved and processed by processor to become information. Information will be sent to the user through internet. Database Design Object-relational database design conceptually illustrates relationships data objects that will be implemented into the system Al Ikhsan 2012. Figure 22 shows the design for database tables. The main tables are kesesuaian table, desa table, and desa_central table which are all spatial table. The kesesuaian 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 kesesuaian table: id_desa, kesesuaian, skor, luas, and geom. Field of id_desa is the primary key, represents the ID of desa or kelurahan of the location. This fields is used to find the name of desa from the desa table. Field of kesesuaian represent the suitability, this field will be read and showed to the user. The skor field represent the suitability in numerical value. The value of 1 for very unsuitable location and the value of 5 for very suitable location. This field was created to make query process become easier. The field of luas represent the area in hectares of each location. While the field of geom is the most important field. This field contains the coordinate of nodes of the polygon of location. Figure 23 shows some rows of kesesuaian table in the database. Figure 22. Database design 23 Figure 23. Some rows of Kesesuaian suitability table in database The desa_central table contains only two fields: id_desa as primary key, and geom. This table used in location selection by selecting name of desa. The field of geom is the coordinate of centroid of each desa. The concept is: when user select a desa, then the system will direct the marker to move to centroid of the desa, based on the coordinate in this table. The kabkot table is used in location selection by using form for location outside Parung. This table contains all cities or kabupaten in Indonesia. The other three tables: pemukiman, bencana, and perairan, are used in reasoning feature. System Implementation The idea for this system working is that if 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 other polygon in the suitability map, and then read the attribute of the polygon as requested by the query. Figure 24 shows the illustration of point location calculation. Figure 24. Illustration of point location calculation In Figure 24, 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 24, 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 nodes as shown in the figure. If user input coordinate of a point, the system will calculate location of the point, whether it is located on polygon a, polygon b, or polygon c. Based on coordinate of nodes, a point is located on polygon a if and only if the x coordinate 24 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 24, user put a point in coordinate of 6, 7. By using certain algorithm, since the x coordinate is more than 1 but less than 7 and 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 language, such as html, css, php, javascript, and jQuery. Copy of code below is example of query code written in php. This code will return the result of location suitability based on coordinate input which is represented by longitude lng variable and latitude lat variable. Some PostGIS function are used in this code, which are ST_Within, ST_SetSRID, and ST_MakePoint. This sample code used the same principle as shown by Figure 24. cek kesesuaian cek_suai=SELECT b.nama_desa, b.luas, a.kesesuaian FROM kesesuaian AS a, desa AS b WHEREST_WithinST_SetSRIDST_MakePointlng,lat,4326 , a.geom AND a.id_desa=b.id_desa; kueri= cek_suai; output_suai = run_kueripg_conn_string, kueri; suai=output_suai; kesesuaian = suai[2]; The developed system is a web-based mobile application that can be installed on an Android device. The installer is in the form of .apk file, can be downloaded from http:arif.mit.biotrop.org or http:broilerfarmloc.web.id. After the application is installed, there will be an icon in the application list. Figure 25 shows the application icon in the application list shown by red circle. a b c Figure 25. Application after installed on mobile device. Application icon on drawer a, splash screen b, and homescreen c