Comparing Sidecar-less Service Mesh from Cilium and Istio
Databases and web mapping the Open Source way
1. Databases and Web Mapping the Open Source Way
Open Source GIS Masterclass, Lancaster University
January 2010
Jo Cook
OA Digital
j.cook@oadigital.net
01524 880212
4. Databases
+
www.postgresql.org
postgis.refractions.net
● Serverbased database (not like access)
● Enterpriselevel, with support for
transactions and multiple users
5. How to connect to a database
● HOST: localhost, 192.168.3.40, myserver.com
● DATABASE
● USERNAME
● PASSWORD
● PORT: Usually 5432
7. Getting spatial data into PostgreSQL
● OGR2OGR
● SHP2PGSQL
Syntax:
$shp2pgsql /location/of/file.shp tablename
s coordinate system W latin1 | psql d
database U username W h host p
port
8. Querying data
● SQL: Structured Query Language
SELECT some comma delimited columns
FROM your_table WHERE some
condition is met;
● Use PSQL from command line or
PgAdmin3
9. Spatial Querying
● Find out which county a point is in:
SELECT name_2 FROM tblcounties WHERE
st_within(geomfromtext('point(1.3 54.26)',
4326), the_geom);
● Find out which counties border
Lancashire:
SELECT a.name_2 FROM tblcounties a,
tblcounties b WHERE b.name_2='Lancashire'
AND a.the_geom && b.the_geom;
11. Types of Map Server
● Minnesota Map Server (aka Mapserver)
cgi program on a web server.
Configuration via text files
● Geoserver
javabased program. Configuration via
web interface
17. Scripting
● SERVERSIDE:
php, asp
● CLIENTSIDE:
javascript
18. And finally...Web Mapping
<html>
<head>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">
var map;
function init() {
map = new OpenLayers.Map('map');
mylayer = new OpenLayers.Layer.MapServer( "World Map",
"http://localhost/cgibin/mapserv.exe",
{map: 'C:/world_mapfile.map'});
map.addLayer(mylayer);
map.zoomToMaxExtent();
}
</script>
</head>
<body onload="init()">
<div id="map" style="width: 600px; height: 300px"></div>
</body>
</html>
19. Base Mapping and Map Controls
● Can use base data from Google,
Microsoft, Yahoo, Openstreetmap etc,
but may need to reproject to EPSG
900913 (spherical mercator)
● Can add map controls such as layer
switchers, coordinates, reference maps
and so on
21. And Finally...
Open Source Web Mapping is Great Fun!!!
This work is licenced under the Creative Commons AttributionShare Alike 2.0 UK: England & Wales License.
To view a copy of this licence, visit http://creativecommons.org/licenses/bysa/2.0/uk/ or send a letter to Creative
Commons, 171 Second Street, Suite 300, San Francisco, California
94105, USA.
Jo Cook
OA Digital
http://oadigital.net
j.cook@oadigital.net
+44 (0)1524 880212