= Final Report: Implement Geospatial Data Viewer in pgAdmin4 for PostGIG = * **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/tree/geoviewer ] * **Result:** [https://www.postgresql.org/message-id/CAA7HE_fnAKtAqfzz2jNZGfYnB5BAcuSt_ZCsJ%2Be-nwFPDHCdxg%40mail.gmail.com Code patch has been sent] == Status Before GSoC [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-3.1, 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. == My Proposal And Work. 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. With the geometry viewer I have created, now users can view individual geometry and the whole output geometries in the map. They can also view the properties directly by clicking the geometry. Here are some screenshots: [[Image(https://trac.osgeo.org/postgis/raw-attachment/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS_FinalReport/screen_1.png, 600px)]] [[Image(https://trac.osgeo.org/postgis/raw-attachment/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS_FinalReport/screen_2.png, 600px)]] [[Image(https://trac.osgeo.org/postgis/raw-attachment/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS_FinalReport/screen_3.png, 600px)]] [[Image(https://trac.osgeo.org/postgis/raw-attachment/wiki/GeospatialDataViewerInPgAdmin4ForPostGIS_FinalReport/screen_4.png, 600px)]] == Future Work - **Optimize performance:** - Cluster markers using [https://github.com/Leaflet/Leaflet.markercluster Leaflet.markercluster]. - Enable vectortile layer using [https://github.com/mapbox/geojson-vt geojson-vt]. Here is an example:[https://www.getbounds.com/blog/leaflet-and-geojson-tiles/ leaflet-and-geojson-tiles]. - PgAdmin4 only load 1000 records by default. When users click 'view' button in the column header, show the map firstly and load the other records in the background and then add the records dynamically. - **New features:** - Custom geometry style, e.g SELECT *, '!#333333' AS __fillcolor, '!#232323' as __strokecolor, 0.5 as __strokewidth FROM xxx. - Custom background tile layer. Enable users to select different tile layers and specify their own layer url. - Highlight selected feature. Add 'zoom home extent' button. Remove the geometry column from the feature pop-up box.