Adding data into ExtJS grid from PostgreSQL with PHP-The JSON format

GIS
Data loading from a database into an application is useful more so if there will be frequent changes on the data stored in the databases. The data is loaded from the database when the application is loading. Any changes on the data are reflected into the grid carrying our data in the application. I will demonstrate using PHP and ExtJS on how to query a database and return the data into a JSON format that will be used in our JavaScript application. First, we write a script that will query our database in PHP (data.php)  //data.php $db = pg_connect("host=somehost port=someport dbname=**** user=**** password=****") or die('could not connect:'.pg_last_error()); $result = pg_query($db, "SELECT *,ST_AsGeoJSON(geom) FROM Africa") or die("Data load failed:".pg_last_error()); $rows = array(          'type'      => 'FeatureCollection',         'features'  => array()  …
Read More
Open Source Web Mapping

Open Source Web Mapping

GIS, Web-GIS
During my second year of college, I came across this technology where maps could be rendered online (web mapping) and users could interact with the maps for visualization and analysis. I found this technology interesting and decided to give it a shot. I encountered the “usual” barriers experienced by any beginner in coding. Then, I came across these interesting and well explained platforms for web mapping (Open Source platforms). After a couple months of research, I settled for ExtJS, OpenLayers, GeoExt, GeoServer, PHP, QGIS, PostgreSQL /PostGIS and HTML/CSS as my development platforms for my web maps. I knew this was a huge project for me to undertake but always motivated by the capabilities the platforms offered me. Spending days and nights on-line trying to come up with something meaningful was…
Read More