I have some queries which clip rasters from polygon.  So how I can see my result query in postgis or How I can check my query true or false ?
122899
Reading the solution to  got me thinking.   How can I graphically display a SQL query?   It doesn't need to be cartographic quality. A sketch for debugging  purposes would be sufficient.  For example, this SQL is in the accepted solution:  SELECT  ST_Touches(temp.point1, temp.point2) as geom_touches , ST_Intersects(temp.point1, temp.point2) as geom_intersect  FROM (  SELECT * FROM  ST_Buffer(ST_Transform(ST_GeomFromText('POINT(-105.05083 39.74823)', 4326), 2877), 1500) as point1 , ST_Buffer(ST_Transform(ST_GeomFromText('POINT(-105.04428 39.74779)', 4326), 2877), 1500) as point2   )as temp   How could I draw ST_Touches() and ST_Intersects() - the geometry,  not the boolean?
52459
I've a Google map with bunch of polygons on it.  Here is a problem I'm interested in: Given a lat,lng point, what's the best way to determine all the polygons that this point lies in?  The obvious way is to run a "point in polygon" algorithm iteratively for each polygon, but I was wondering if there an efficient algorithm to answer such queries especially if you have thousands of polygons.
46082
CartoDb Recommend  that the following query is faster than an St_intersects Query  SELECT * FROM {table_name} WHERE the_geom &amp;&amp; ST_SetSRID(ST_MakeBox2D(ST_Point(-73.9980, 40.726), ST_Point(-73.995, 40.723)), 4326)   I have the following Query that works just fine and returns GeoJson as needed,   WITH c AS (SELECT -73.976440429688, 40.743095232182, -73.970947265625, 40.738933241136, 4326 As srid)  , bbox AS (SELECT ST_Transform ( ST_MakeEnvelope( -73.976440429688, 40.743095232182 ,-73.970947265625 , 40.738933241136 , 4326) , 900913 ) As geom FROM c ) SELECT row_to_json(fc)     FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features     FROM (SELECT 'Feature' As type, osm_id As id,         ( SELECT row_to_json(t)           FROM (SELECT osm_id, "name" ) t )As properties,          ST_AsGeoJSON(ST_Transform (lg.way ,4326 ) )::json As geometry      FROM planet_osm_polygon As lg, bbox         WHERE ( building is NOT NULL) AND ST_Intersects(lg.way, bbox.geom)             ) As f ) fc;                   I have been trying to create the same JSon result using ST_MakeBox2D in a similar fasion to the CartoDb example and failing miserably.  My objective is to have the fastest possible query for any geometry that any part of itself WITHIN the bounding box.  My Questions are:   Which method will return the fastest possible result, assuming that the Columns in the WHERE clause are indexed properly? How do I change my query to use St_makeBox2D with the geom &amp;&amp; syntax as per the CartoDb Example?
49385
I have a table of polygons (census block groups) in Postgres. I want to tag each block group with the town (another polygon table) it mainly resides within. Is this possible? I'm thinking I'd need to essentially create something like: select b.*, t.name   from blockgroups b, towns t   where (st_area(st_intersection(b.wkb_geometry, t.wkb_geometry))/st_area(b.wkb_geometry)) &gt; .5    but this query is taking forever (I've got about 5,000 block groups and 375 towns...). Any suggestions on how to make this query work either at all if it's incorrect, or faster if it is correct?
30574
What PostGIS documentation have you come across that has been helpful when tuning PostGIS for a production environment?  I would like to get together with my DBA to setup a Postgresql/PostGIS installation that is fit for production. I have read that there is some tweaking involved to achieve this, and I was hoping to find the answer on the .  So far I have found some documents on the OpenGeo site helpful, .  And this  is the kind of information I have found helpful, this is probably just basic DB stuff but to me its good stuff.  I would be interested to see what resources have helped others in achieving a stable production installation of PostGIS.
54545
I'm using PostGIS 1.5.2, with geometries in SRID:900913. I need create a circles using a list of points as centre, with a radius of 600 kilometers. I'm using this query:  INSERT INTO circles (geom) (    SELECT ST_Buffer(point, 600000, 'quad_segs=8')     FROM points );   But circles created have not 600 kilometers of radius (radius is near this length, but not exactly).  Are there other methods to create circles in PostGIS?  NOTE: Information represented is from Spain. Correct projection is 4326, but client use Google rasters, so I am storing data in 900913 to avoid reprojections and increase performance.
113953
I have a road network as line layer and a land cover as polygon layer, I want to find number of subpolygon for each polygon that divided by line layer in QGIS?  I used union function in Geoprocessing Tools in Vector menu of QGIS and then polygonize function to convert union result to polygon but in table of new polygon there is NULL data.
100471
I am calling in some WMS layers using OpenLayers. One of the layers is a raster. I have it working fine. But how does this fit into the spatial database model? I thought a WMS is a protocol for handling vector data. How raster data stored? Are they within PostGIS? Does GeoServer handle raster data?
42010
How can I compute a raster showing the number of return points per square meter using SAGA GIS or other open source software?    My goal is to obtain a mask which would show me the places (cells) where there were no hits and would help me in interpreting LiDAR-derived data.
80301
I imported the data from openstreetmap using osm2pgsql and copied it another table structure. If I made a query for containing rows using st_intersects, st_contain or someone else, postgis don't use the gist-INDEX. Always a seq-scan will be made. If I filter the rows first using the &amp;&amp;-operator (bbox of geometries), postgis uses the gist-index for the postgis functions. I don't understand why, where is the problem and how can I change this.  Here I've created a simplified table of the original (you can also use a planet_osm_polygon for queries):  CREATE TABLE osm_addr2 (osm_id bigint, geometry geometry); CREATE INDEX osm_addr2_geom ON osm_addr2 USING gist (geometry);   Here I created a very simple example query:  EXPLAIN ANALYSE SELECT * FROM osm_addr2 AS addr  WHERE -- addr.geometry &amp;&amp; (SELECT geometry FROM osm_addr2 WHERE osm_id=-332537) AND    st_intersects(addr.geometry, (SELECT geometry FROM osm_addr2 WHERE osm_id=-332537));   Using st_intersects only, I have the following result (first line only):  Seq Scan on osm_addr2 addr  (cost=24.50..336.10 rows=387 width=40) (actual time=0.001..0.001 rows=0 loops=1)  If I uncomment the &amp;&amp;-operator the index will be used  (first line only):  Index Scan using osm_addr2_geom on osm_addr2 addr  (cost=49.15..57.41 rows=1 width=40) (actual time=0.031..0.031 rows=0 loops=1)  I'm using postgresql 9.3 with postgis 2.1, see postgis_full_version():  POSTGIS="2.1.4 r12966" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.7.1, 23 September 2009" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.8.0" LIBJSON="UNKNOWN" RASTER  I can reproduce this on Ubuntu 14.04 and Debian 7. I hope anyone can help because using the intersection operator will inflate my queries.
100823
I have just updated a table of polygons with a query which returned:  UPDATE parcel SET wkb_geometry = ST_Multi(wkb_geometry)  UPDATE 399212  Query returned successfully in 25 secs.   Now, all of the rows should contain multipolygons.  However, when I try validating geometries with ST_MakeValid, it turns out that there are geometry collections in stead of multipolygons.  How can I fix this or remove the geometry collections?   UPDATE parcel SET wkb_geometry = ST_MakeValid(wkb_geometry)  WHERE ST_IsValid(wkb_geometry) = 'f'  ERROR:  Geometry type (GeometryCollection) does not match column type (MultiPolygon) NOTICE:  Too few points in geometry component at or near point -121.78764087332523 37.700189714113364
94140
I'm trying to draw some polygons in QGIS 2.2 and I lose it, because everytime I misclick, I don't find a way to undo that point and start drawing again.  I'm sure there's a way. Does anyone know it?
71515
I'm trying to create a line snapping tool in my Android app where I'm using the spatialite-android lib. I'm using the function ST_Snap where I want to snap a linestring with another linestring on the point where a line string is touching another one. here is the preview    Here is my gis query   SELECT ST_AsText(ST_Snap(line, input, ST_Distance(input,line)*10.0))  FROM (SELECT    ST_GeomFromText('LINESTRING(88.4656805545 22.6896467287,88.4632558376 22.6896841575,88.4614285827 22.6882649519)',4326) As input,    ST_GeomFromText('LINESTRING(88.4654606134 22.690117835,88.4655571729 22.6896761149)',4326) As line);   But the above query snapping the line to the end. I'm guessing the query is not appropriate.  This is what happening
22768
I am trying to clip or filter lidar files (.las, .xyz) using a shapefile that contains multiple polygons.  Is there open source software that can do this spatial operation?  My .las files are enormous, and I should say that I am very new to DEM data and analysis so any help would be very welcome.
36713
I'd like to begin by saying that I have very little knowledge and understanding when it comes to GIS (despite extensive experience with Google Maps API). PostGIS appears to be a whole new ball game on its own.  I've recently installed PostGIS (v2.1.5) with my PostgreSQL (v9.4) instance in order to begin storing and working with GIS data. I'm currently using Google Maps API v3's DrawingManager to draw polygons, circles, rectangles and markers which need to be stored in the database, and later retrieved to display the polygons again on Google Maps; These shapes will also be used for various aggregate queries.  I currently have two tables. The one is called "locations" which will store the polygons, circles and rectangles created with Google Maps' DrawingManager. The second, called "rawdata" will contain a set of records with a POINT (lat, long) inside of it.  First and foremost, I do not entirely understand the concept of projections and how they work, but, based on what I've read online is that calculations and accuracy may vary, significantly. I understand that Google Maps works with the Web Mercator projection which I believe is officially known as the EPSG:3857 projection (or CRS), while the preferred method for storing and working with geometry() shapes in PostGIS is in the EPSG:4326. As such and in reference to my create table statements below, I have chosen to store my geometry data in EPSG:4326 in the tables.  An easier method would to be store my geometry in the newer geographic format, but I do not wish to impose those performance and lack of functionality drawbacks as I will be working with a significant amount of data (hundreds of thousands, if not millions of records).  I am trying to test the ST_Point_Inside_Circle() function but this appears to be inaccurate and I can only assume so because the function expects degrees as the radius parameter, yet Google Maps supplies me with a radius in meters. In reference to , I have tried converting meters to degrees by multiplying meters by 0.00001. However, the greater the radius in meters, the more inaccurate it appears to be. What can I do to achieve an accurate result?  SELECT ST_Point_Inside_Circle(ST_SetSRID(ST_MakePoint(28.239418677985668, -25.75443387513752), 4326), 28.241967111825943, -25.759674774140656, (583 * 0.00001));  Google Maps reports the distance in meters between the two points (center of circle and point) as 637 meters, yet ST_Point_Inside_Circle returns true when trying to convert 583 to degrees. This leads me to the assumption that one cannot convert meters to degrees using 0.00001.  What is the correct way to determine the radius with meters?
16280
I was wondering how to check the value of a pixel at a mouse click in QGIS (as of 2.4).  In ArcGIS, the Identify tool does the job for both rasters and vectors. However, in QGIS, the Identify tool seems to be greyed out when only one raster layer is loaded.
112104
I am trying to realize a postgres request :   select distinct nom_reg_12  from region_15,repartition  where st_intersects(region_15.geom,                    (select geom                     from repartition                     where id_espece='Tetrarti'))=true;    but i get the following error :      More than one row returned by a subquery used as an expression   in the first time I tried this and it work fine :   select distinct nom_reg_12  from region_15,repartition  where st_intersects(region_15.geom,repartition.geom)=true;   and then I tried this a part to get the geometry I want :   select geom from repartition where id_espece='Tetrarti'