Install the server:
sudo apt-get install postgresql-9.1 postgresql-contrib-9.1 pgadmin3
Execute the psql command under user postgres (sudo -u postgres)
and connect to database postgres (psql postgres):
| -- Abordagem tradicional (vetor/vetor): | |
| SELECT foo.value, ST_area(foo.geom::geography)/10000 AS area_ha | |
| FROM ( SELECT c.value, | |
| ST_Union(ST_Intersection(f.geom, c.geom)) as geom | |
| FROM fazendas f, capacidade_vect c | |
| WHERE ST_Intersects(f.geom, c.geom) | |
| AND f.gid = 6 | |
| GROUP BY c.value | |
| ) as foo | |
| ORDER BY foo.value; |
#Mac OS X
As configured in my dotfiles.
start new:
tmux
start new with session name:
| <?php | |
| /** | |
| * PostGIS to GeoJSON | |
| * Query a PostGIS table or view and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc. | |
| * | |
| * @param string $geotable The PostGIS layer name *REQUIRED* | |
| * @param string $geomfield The PostGIS geometry field *REQUIRED* | |
| * @param string $srid The SRID of the returned GeoJSON *OPTIONAL (If omitted, EPSG: 4326 will be used)* | |
| * @param string $fields Fields to be returned *OPTIONAL (If omitted, all fields will be returned)* NOTE- Uppercase field names should be wrapped in double quotes | |
| * @param string $parameters SQL WHERE clause parameters *OPTIONAL* |