TQ
dev.com

Blog about software development

Subscribe

PHP-CRUD-API gets GeoJSON support

04 Jun 2019 - by 'Maurits van der Schee'

PHP-CRUD-API is an automatic API script: Upload a single PHP file and get an instant REST API to your PostgreSQL, MySQL/MariaDB or SQL Server database. Currently support for GeoJSON FeatureCollection views on tables has been added. The REST API already supported GIS (Geographic Information System) functionality through WKT (Well Known Text) formatted output for geometry columns in the database. The GeoJSON support allows to quickly add a table as a map layer to for instance QGIS.

Add vector layer in QGIS

To add a GeoJSON vector layer in QGIS you click in the menu on "Layer", "Add Layer", "Add Vector Layer...". In the popup window you need to select "Protocol" and in the "Type" drop-down you select "GeoJSON". In the "URI" text box you enter the request to the API, such as "http://localhost:8000/geojson/users". See below screenshot:

Note: You can also add parameters, such as "join" and "filter", to the URI to create more complex queries.

Links


PS: Liked this article? Please share it on Facebook, Twitter or LinkedIn.