Skip to main content
added 121 characters in body
Source Link
alphabetasoup
  • 9k
  • 4
  • 40
  • 79

PostGIS query against exclusive layerwith external bounding box

I am editing a shapefile as wide as an island wide. The data are stored in POSTGISa Postgres/PostGIS database. I want to display only features from my defined bounding box. The bounding box itself is a custom layer that i made myself and it is not stored in the database.

Does anyone know howHow can I do this be achieved? Great thanks.

Update... PostGIS: the PostGIS manual has this particular example

SELECT m.name, sum(ST_Length(r.the_geom))/1000 as roads_km FROM bc_roads AS r, bc_municipality AS m WHERE ST_Contains(m.the_geom,r.the_geom) GROUP BY m.name ORDER BY roads_km;

SELECT
  m.name,
  sum(ST_Length(r.the_geom))/1000 as roads_km
FROM
  bc_roads AS r,
  bc_municipality AS m
WHERE
  ST_Contains(m.the_geom,r.the_geom)
GROUP BY m.name
ORDER BY roads_km;

Since I dont have the bounding box geometry in the database, is there another way to mimic the bounding box geometry? It would be something like this

SELECT layer, (x1,y1), (x1,y2), (x2,y2), (x2, y1) AS bbox FROM layer WHERE ST_Contains(layer.the_geom, bbox);

SELECT
 layer,
 (x1,y1), (x1,y2), (x2,y2), (x2, y1) AS bbox
FROM
 layer
WHERE
 ST_Contains(layer.the_geom, bbox);

PostGIS query against exclusive layer

I am editing shapefile an island wide. The data are stored in POSTGIS database. I want to display only features from my defined bounding box. The bounding box itself is a custom layer that i made myself and not stored in the database.

Does anyone know how can I do this? Great thanks.

Update... PostGIS manual has this particular example

SELECT m.name, sum(ST_Length(r.the_geom))/1000 as roads_km FROM bc_roads AS r, bc_municipality AS m WHERE ST_Contains(m.the_geom,r.the_geom) GROUP BY m.name ORDER BY roads_km;

Since I dont have the bounding box geometry in the database, is there another way to mimic the bounding box geometry? It would be something like this

SELECT layer, (x1,y1), (x1,y2), (x2,y2), (x2, y1) AS bbox FROM layer WHERE ST_Contains(layer.the_geom, bbox);

PostGIS query with external bounding box

I am editing a shapefile as wide as an island. The data are stored in a Postgres/PostGIS database. I want to display only features from my defined bounding box. The bounding box itself is a custom layer that i made myself and it is not stored in the database.

How can this be achieved?

Update: the PostGIS manual has this particular example

SELECT
  m.name,
  sum(ST_Length(r.the_geom))/1000 as roads_km
FROM
  bc_roads AS r,
  bc_municipality AS m
WHERE
  ST_Contains(m.the_geom,r.the_geom)
GROUP BY m.name
ORDER BY roads_km;

Since I dont have the bounding box geometry in the database, is there another way to mimic the bounding box geometry? It would be something like this

SELECT
 layer,
 (x1,y1), (x1,y2), (x2,y2), (x2, y1) AS bbox
FROM
 layer
WHERE
 ST_Contains(layer.the_geom, bbox);
added 532 characters in body
Source Link

I am editing shapefile an island wide. The data are stored in POSTGIS database. I want to display only features from my defined bounding box. The bounding box itself is a custom layer that i made myself and not stored in the database.

Does anyone know how can I do this? Great thanks.

Update... PostGIS manual has this particular example

SELECT m.name, sum(ST_Length(r.the_geom))/1000 as roads_km FROM bc_roads AS r, bc_municipality AS m WHERE ST_Contains(m.the_geom,r.the_geom) GROUP BY m.name ORDER BY roads_km;

Since I dont have the bounding box geometry in the database, is there another way to mimic the bounding box geometry? It would be something like this

SELECT layer, (x1,y1), (x1,y2), (x2,y2), (x2, y1) AS bbox FROM layer WHERE ST_Contains(layer.the_geom, bbox);

I am editing shapefile an island wide. The data are stored in POSTGIS database. I want to display only features from my defined bounding box. The bounding box itself is a custom layer that i made myself and not stored in the database.

Does anyone know how can I do this? Great thanks.

I am editing shapefile an island wide. The data are stored in POSTGIS database. I want to display only features from my defined bounding box. The bounding box itself is a custom layer that i made myself and not stored in the database.

Does anyone know how can I do this? Great thanks.

Update... PostGIS manual has this particular example

SELECT m.name, sum(ST_Length(r.the_geom))/1000 as roads_km FROM bc_roads AS r, bc_municipality AS m WHERE ST_Contains(m.the_geom,r.the_geom) GROUP BY m.name ORDER BY roads_km;

Since I dont have the bounding box geometry in the database, is there another way to mimic the bounding box geometry? It would be something like this

SELECT layer, (x1,y1), (x1,y2), (x2,y2), (x2, y1) AS bbox FROM layer WHERE ST_Contains(layer.the_geom, bbox);

Source Link

PostGIS query against exclusive layer

I am editing shapefile an island wide. The data are stored in POSTGIS database. I want to display only features from my defined bounding box. The bounding box itself is a custom layer that i made myself and not stored in the database.

Does anyone know how can I do this? Great thanks.