= Implement Geospatial Data Viewer in pgAdmin4 for PostGIS = * **Title:** Implement Geospatial Data Viewer in pgAdmin4 for PostGIS * **Organization:** [https://www.osgeo.org/ OSGeo] * **Mentors:** [http://www.up.ac.za/en/centre-for-geoinformation-science/article/2060495/victoria-rautenbach Victoria Rautenbach] and Frikan Erwee * **Student:** Xuri Gong, Peking University * **GSoC Proposal:** [https://trac.osgeo.org/postgis/raw-attachment/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS/Proposal%20for%20GSoC%20%202018.pdf Proposal for GSoC 2018.pdf] * **Repository:** [https://github.com/Gooong/pgadmin4 ] * **Project Result:** [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS_FinalReport Final Report] == Abstract [https://www.pgadmin.org/ pgAdmin] is the GUI management tool for PostgreSQL. The latest version pgAdmin4 is web-based and written in Python and jQuery with Bootstrap, using the Flask framework. But currently there is no geospatial data viewer in pgAdmin4, and external applications, such as QGIS are required if we want to browser the data in a map. It’s not convenient for users to view geometries directly in pgAdmin4 “Data Output” table panel. I propose to implement a geospatial data viewer in pgAdmin4 that will allow users to view the tables in a spatial database and the results of queries executed. With the viewer I intend to develop, users can directly view geospatial data on a map within the pgAdmin4 GUI. == Weekly Reports: * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#CommunityBondingPeriodApril24-May13 Community Bonding Period (April 24 - May 13)] * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#Week1May14-20 Week 1 (May 14 - 20)] * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#Week2May21-27 Week 2 (May 21 - 27)] * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#Week3May28-June3 Week 3 (May 28 - June 3)] * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#Week4June4-10 Week 4 (June 4 - 10)] * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#Week5June11-17 Week 5 (June 11 - 17)] * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#Week6June18-24 Week 6 (June 18 - 24)] * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#Week7June25-July1 Week 7 (June 25 - July 1)] * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#Week8July2-8 Week 8 (July 2 - 8)] * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#Week9July9-15 Week 9 (July 9 - 15)] * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#Week10July16-22 Week 10 (July 16 - 22)] * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#Week11July23-29 Week 11(July 23 - 29)] * [https://trac.osgeo.org/postgis/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS#Week12July30-August5 Week 12(July 30 - August 5)] * [https://trac.osgeo.org/postgis/wiki/FinalReport_GeospatialDataViewerInPgAdmin4ForPostGIS Final Report] === Community Bonding Period (April 24 - May 13) * Set up dev environment and my wiki page for TODO list and weekly report. * Introduce myself and this project in [https://www.postgresql.org/message-id/CAA7HE_eP8DJL0E9gbtuedgg4XJbu22yYV2tUC3ABq%2Bc6zmq6Bw%40mail.gmail.com pgAdmin4], [https://lists.osgeo.org/pipermail/postgis-devel/2018-April/027106.html PostGIS] and [https://lists.osgeo.org/pipermail/soc/2018-April/003984.html SoC] mailing list. * Discuss with mentors about the implementation plan. **Here is the draft of my technical notes:** [https://docs.google.com/document/d/15ptfUxnE7kwExfomIGaRu_FaC91b7F_m049XurkozHY/edit?usp=sharing GSoC Technical notes] * Remain constant touch with my mentors using Google Hangouts. Set up user requirements and discuss the design details with mentors. Settle the final design according to user requirements and feasibility. **Here is the design document:** [https://docs.google.com/document/d/1NE1RLTp9uw9fgduZEerrKKbQZEJCPyrSyQKa0-BDZsI/edit?usp=sharing pgAdmin4 Geo Viewer Design Document] * Get deeper into pgAdmin4 source code and learn more about require.js lib. === Week 1 (May 14 - 20) Create web UI for viewing map[part one]: Add the "map view" panel in pgadmin4 sqleditor. === Week 2 (May 21 - 27) Create web UI for viewing map[part two]: Add layout and openlayers map in the "map view" panel. === Week 3 (May 28 - June 3) Implement parse_geo_data function to parse the query result data. === Week 4 (June 4 - 10) Add openlayers map and render the parsed result data in the map. === Week 5 (June 11 - 17) Add function to group geometries with the same srid and render the group with max geometry number. Related discussion can be found [https://docs.google.com/document/d/15ptfUxnE7kwExfomIGaRu_FaC91b7F_m049XurkozHY/edit?disco=AAAAB5iDaq8 here]. This is the [https://github.com/Gooong/pgadmin4/commit/721747b3fece92ec6efa566680560e424ddf03e5 code commit link] in my repository. I have also updated the design document for this function. === Week 6 (June 18 - 24) **What did you get done this period?** - Add column option for the viewer. For query result with more than one geometry type column, the viewer will offer column option for user to choose which column to show in the map. - Create map_view_column_option.jsx and map_view_column_info.jsx file for the column option. See commit [https://github.com/Gooong/pgadmin4/commit/789d143285b4beb5bd966e4ebd96a43caf6f7dfa 'add column option for the viewer'] **What do you plan on doing next week?** - Optimize the column option. - Implement geometry selection functionality. === Week 7 (June 25 - July 1) **What did you get done this period?** - Handle resize event to resize the map when the panel size change: https://github.com/Gooong/pgadmin4/commit/d1f8de0a693790801034773ad376341e64ab0767 - Fix bug and add css for column option: https://github.com/Gooong/pgadmin4/commit/df49476b2cbc3e3e0d3da5f2dff18b9f2d72e36c Now the viewer can handle multi geo columns data and mixed srids in one column, here is the screen shot: - [https://trac.osgeo.org/postgis/raw-attachment/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS/geoviewer%20screenshot%201.png screenshot1.png] - [https://trac.osgeo.org/postgis/raw-attachment/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS/geoviewer%20screenshot%202.png screenshot2.png] **What do you plan on doing next week?** - It will still throw many warnings when importing openlayers lib, I will ask for help in the pgadmin community. - Continue implementing geometry selection functionality mentioned in [https://docs.google.com/document/d/1NE1RLTp9uw9fgduZEerrKKbQZEJCPyrSyQKa0-BDZsI/edit?usp=sharing the design document] 4.3. === Week 8 (July 2 - 8) **What did you get done this period?** - Implementing geometry selection functionality mentioned in [https://docs.google.com/document/d/1NE1RLTp9uw9fgduZEerrKKbQZEJCPyrSyQKa0-BDZsI/edit?usp=sharing the design document] 4.3: https://github.com/Gooong/pgadmin4/commit/d135255a7523a2da3f22e73bfb32375b63e07852 - Change the vector render mode to "image" to improve performance: https://github.com/Gooong/pgadmin4/commit/d135255a7523a2da3f22e73bfb32375b63e07852 Now the viewer support geometry selection functionality, here is the screen shot: - [https://trac.osgeo.org/postgis/raw-attachment/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS/Screenshot%20from%202018-07-08%2020-14-24.png screenshot3.png] **What do you plan on doing next week?** - Fix the bug caused by unknown SRID. - Implement property table to show the property of selected geometry. === Week 9 (July 9 - 15) **What did you get done this period?** - Fix the bug caused by undefined SRID: https://github.com/Gooong/pgadmin4/commit/cac6cfffb5c62c2dcbf5669aa01a82442fb9aae4 - Remove background layer when the SRID is not 4326 or 3857: https://github.com/Gooong/pgadmin4/commit/cac6cfffb5c62c2dcbf5669aa01a82442fb9aae4 - Implement property tabe to show the properties of selected geometry: https://github.com/Gooong/pgadmin4/commit/0e6119560ba96ba1d66bfe69b13b99967560d3ed **What do you plan on doing next week?** - Create and execute unit tests in the regression frame for all modules to help catch regressions in the code. - Check the code style to meet the [https://pgadmin.org/docs/pgadmin4/dev/coding_standards.html pgAdmin coding standards]. === Week 10 (July 16 - 22) **What did you get done this period?** - Create visualiser for individual geometry in datagrid: https://github.com/Gooong/pgadmin4/commit/d6407baa3a0a96adac169d183bed8bc044dbb8f5 - Fix image url errors in leaflet: https://github.com/Gooong/pgadmin4/commit/3b160b668c4f9b5867b4b2189714c934a5de85c6 This visualiser is independent from the geoviewer and is in the [https://github.com/Gooong/pgadmin4/tree/geometry_visualiser geometry_visualiser branch]. Here is the screen shot: - [https://trac.osgeo.org/postgis/raw-attachment/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS/geometry_visualiser_screenshot1.png Screenshot1.png] - [https://trac.osgeo.org/postgis/raw-attachment/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS/geometry_visualiser_screenshot2.png Screenshot2.png] **What do you plan on doing next week?** - Create test for both geometry_visualiser and geoviewer. - Check the code style to meet the [https://pgadmin.org/docs/pgadmin4/dev/coding_standards.html pgAdmin coding standards]. === Week 11(July 23 - 29) **What did you get done this period?** - Add tests for geometry_viewer: https://github.com/Gooong/pgadmin4/commit/500160c9e050d42d0e725ff84e7e1ed85213e050 - Add comlumn header button in datagird: https://github.com/Gooong/pgadmin4/commit/3aa7a3c197283c01d6bf3497c8ac85ea0596ab9f - Clean code, add documents and check code style: - https://github.com/Gooong/pgadmin4/commit/0e14a2fcf8224c3e29b8b295d3cd9198982bf349 - https://github.com/Gooong/pgadmin4/commit/1850e926cb952175dc2524df4600ff9216ce80e4 - https://github.com/Gooong/pgadmin4/commit/1c16cdf8474c7ce4bdb4b3e5fb03918d99debeaa - Add property table: https://github.com/Gooong/pgadmin4/commit/0c26ab99293a2a6c69514c71f9267295dfbec5fa **What do you plan on doing next week?** - Send the patch in pgAdmin-hacker mailing list for code review. - Prepare for final evaluation. === Week 12(July 30 - August 5) **What did you get done this period?** - Add documents for the viewer: https://github.com/Gooong/pgadmin4/commit/8a9ef50f13554b421b56df14ef0b541cb7bc67e9 - Fix bugs and add adjustment: - https://github.com/Gooong/pgadmin4/commit/5d88c875545b4136a6d46a5391d12cae974a59f7 - https://github.com/Gooong/pgadmin4/commit/279be7c5d717c653e8276c224e2d0ad1e2a823f4 - https://github.com/Gooong/pgadmin4/commit/e9b8e3fa8c38021a42e9a31c9b1898bd868e0cec - Send the patch in pgadmin-hackers mailing list: https://www.postgresql.org/message-id/CAA7HE_fnAKtAqfzz2jNZGfYnB5BAcuSt_ZCsJ%2Be-nwFPDHCdxg%40mail.gmail.com **What do you plan on doing next week?** - Create the final report page and finish the final evaluation.