Re: [postgis-users] clip a polygon layer with another polygon later
On Jun 8, 2012, at 10:30 PM, Brent Wood wrote: > Without looking too much into it, I figure you can do this using a case when > statement to identify & return the appropriate geometry for the different > cases, with perhaps a coalesce to handle nulls?? I realized that my query was goofy. So, I tried the following UPDATE polys SET the_geom = COALESCE(t.clipped_geom, null) FROM( SELECT id, ST_Intersection(o.the_geom, p.the_geom) AS clipped_geom FROMpolys p JOIN outline o ON ST_Intersects(o.the_geom, p.the_geom) ) AS t WHERE polys.id = t.id; but no joy. No errors, but the actual features are not clipped. Interestingly, QGIS has a geoprocessing plugin to "clip" one layer using another layer. I tried that, and that worked perfectly creating a shape file with the right features. I want to replicate that in code. > > > Brent Wood > > > --- On Sat, 6/9/12, Puneet Kishor wrote: > > From: Puneet Kishor > Subject: [postgis-users] clip a polygon layer with another polygon later > To: "PostGIS Users Discussion" > Date: Saturday, June 9, 2012, 2:50 PM > > Given > > CREATE TABLE outline ( > id, > the_geom > ); > > and > > CREATE TABLE polys ( > id, > the_geom > ); > > I want to update polys.the_geom with only those that are clipped by > "outline". That is, all the "polys" that are completely within the > ouline.the_geom rows should remain intact, all those that are intersected > should only have there overlapping portion retained, and all that are outside > outline.the_geom should be set to null. > > I am unable to figure out how to do this in one query. The following doesn't > work > > UPDATE polys > SET the_geom = ST_Intersection(o.the_geom, p.the_geom) > FROM outline o JOIN > polys p ON ST_Intersects(o.the_geom, p.the_geom) > WHEREST_Intersects(o.the_geom, p.the_geom) = 'true'; > > > > -- > Puneet Kishor ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] clip a polygon layer with another polygon later
Given CREATE TABLE outline ( id, the_geom ); and CREATE TABLE polys ( id, the_geom ); I want to update polys.the_geom with only those that are clipped by "outline". That is, all the "polys" that are completely within the ouline.the_geom rows should remain intact, all those that are intersected should only have there overlapping portion retained, and all that are outside outline.the_geom should be set to null. I am unable to figure out how to do this in one query. The following doesn't work UPDATE polys SET the_geom = ST_Intersection(o.the_geom, p.the_geom) FROMoutline o JOIN polys p ON ST_Intersects(o.the_geom, p.the_geom) WHERE ST_Intersects(o.the_geom, p.the_geom) = 'true'; -- Puneet Kishor ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] Need sme help to debug a code
hi, While using postgis with mapserver ... i am getting black image in place of raster image... please help ... LAYER NAME coolwktraster TYPE raster STATUS DEFAULT #CONNECTIONTYPE ogr DATA "PG:host=localhost port=5433 dbname='postgis' user='postgres' password='asdf' schema='public' table='test' " #CONNECTION "user='postgres' password='asdf123' dbname='postgis' host=localhost port=5432" #DATA "rast form world using SRID=-1 using unique id" PROCESSING "NODATA=0" PROCESSING "SCALE=AUTO" #... other standard raster processing functions here #... classes are optional but useful for 1 band data PROJECTION "init=epsg:3003" END METADATA "wms_title" "OFC 1:10.000 single" "wms_srs" "EPSG:3003 EPSG:4326" END ... Error report: [Sat Jun 09 01:49:25 2012].727000 CGI Request 1 on process 2096 [Sat Jun 09 01:49:25 2012].729000 msDrawMap(): rendering using outputformat named png (AGG/PNG). [Sat Jun 09 01:49:25 2012].729000 msDrawMap(): WMS/WFS set-up and query, 0.000s [Sat Jun 09 01:49:25 2012].731000 msDrawRasterLayerLow(coolwktraster): entering. [Sat Jun 09 01:49:26 2012].252000 LoadGDALImage(coolwktraster): NODATA value 0 in GDAL file or PROCESSING directive largely ignored. Not yet fully supported for unclassified scaled data. The NODATA value is excluded from auto-scaling min/max computation, but will not be transparent. [Sat Jun 09 01:49:26 2012].259000 LoadGDALImage(coolwktraster): NODATA value 0 in GDAL file or PROCESSING directive largely ignored. Not yet fully supported for unclassified scaled data. The NODATA value is excluded from auto-scaling min/max computation, but will not be transparent. [Sat Jun 09 01:49:26 2012].265000 LoadGDALImage(coolwktraster): NODATA value 0 in GDAL file or PROCESSING directive largely ignored. Not yet fully supported for unclassified scaled data. The NODATA value is excluded from auto-scaling min/max computation, but will not be transparent. [Sat Jun 09 01:49:26 2012].269000 msDrawMap(): Layer 0 (coolwktraster), 0.540s [Sat Jun 09 01:49:26 2012].269000 msDrawMap(): Drawing Label Cache, 0.000s [Sat Jun 09 01:49:26 2012].269000 msDrawMap() total time: 0.542s [Sat Jun 09 01:49:26 2012].424000 msSaveImage(stdout) total time: 0.155s [Sat Jun 09 01:49:26 2012].425000 mapserv request processing time (loadmap not incl.): 0.698s [Sat Jun 09 01:49:26 2012].425000 msFreeMap(): freeing map at 025D1FE8. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Topology: Simplifying Coastlines with Islands
Quoting Sandro Santilli : On Tue, May 29, 2012 at 03:23:06PM +0200, Sandro Santilli wrote: I recon that for long island, splitting the unsimplified edge on the closest point to the island might make it simplifiable. Probably a single point is not enough for the Brazil case, but a recursive approach would find next closest point and succeed. Just wanted to get back on this as I think it's the logical continuation of the SimplifyEdgeGeom approach. On "collision" exception you would basically have the information about the edge being simplified (let's call it "E") _and_ the colliding obstacle (let's call it "O", be it a node or edge). You would then compute the closest point of "O" onto "E" and split "E" by that point. Then re-run on each of the sub-edges "E1" and "E2" resulting from the split. Re-joining the sub-edges after simplification may or may not be something you'll want to do within the same function. I'll love to know if such approach would have all the required lower-level editing functions in place. Hello Sandro, Just want to let you know that I did not have the opportunity to proceed with this. Extremely busy with other work. Sorry about that. I hope to be able to look into topology again a few weeks from now. Best regards, Michiel. P.S. The reason that my function only selects faces with a single edge, is it aims to delete islands, completely surrounded by sea. Small coastal islands practically always consist of only one edge. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ST_Intersects not finding everythng?
Sorry for the false warning. I was doing some direct testing with PgAdmin today, and I can confirm that it is not a PostGIS 2.0 issue. (I was being completely misled by my toolware chain which was reporting that all the 1545 records were being found, but was actually hiding some of them! so I thought that I had them all and a few were missing, but really I did not have them all!). -- View this message in context: http://postgis.17.n6.nabble.com/ST-Intersects-not-finding-everythng-tp4998091p4998129.html Sent from the PostGIS - User mailing list archive at Nabble.com. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] gdalinfo gives no georeferencing information for a PostGIS raster
Robin, The output you're seeing is as expected. When calling gdalinfo with no "mode" setting, I believe the mode is defaulted to "mode=1". According to the docs... "mode = 1. Also called ONE_RASTER_PER_ROW mode. In this case, a raster table is considered as a bunch of different raster files. This mode is intended for raster tables storing different raster files. It's the default mode if you don't provide this field in connection string. " Basically, this one treats the table as a dataset and each row within as a subdataset. Subdatasets can be substantially different from the container dataset. The output you're seeing is for the dataset. What you're looking for (and probably were expecting) was mode = 2. "mode = 2. Also called ONE_RASTER_PER_TABLE mode. In this case, a raster table is considered as a unique raster file, even if the table has more than one row. This mode is intended for reading tiled rasters from database. " Here, you should see what you expect to see. So for your call to gdalinfo... dalinfo "PG:host=localhost port=5432 dbname='testgis' user='postgres' password='' schema='ch13' table=kauai mode=2" -bborie On Fri, Jun 8, 2012 at 4:21 AM, Robin Wilson wrote: > Hi, > > I'm fairly new to PostGIS (version 2) and I'm struggling with a problem > where gdalinfo doesn't seem to give the correct georeferencing information > for a raster in PostGIS. I've asked a StackOverflow question about it, and I > wondered if anyone here may be able to help - either on this mailing list or > on the SO question? > > http://gis.stackexchange.com/questions/26958/gdalinfo-gives-no-georeferencing-information-for-a-postgis-raster#comment36245_26958 > > Best regards, > > Robin > > > > ___ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > -- Bborie Park Programmer Center for Vectorborne Diseases UC Davis 530-752-8380 bkp...@ucdavis.edu ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] PostgreSQL/PostGIS x64 Error on PostGIS Install
Ok, Mark, thanks for the confirmation. I suppose then that I would have to dump the contents of the 32 bit setup then import to the 64 bit setup which I'm assuming is possible. Offhand, do you, or does anyone else, know if replication from 32 bit to 64 bit works? What I'm trying to do is maintain one master data structure on a server (currently 32 bit) and replicate to various clients; most are 32 bit but I've just started experimenting with 64 bit clients. I haven't looked at 32 bit to 32 bit replication, never mind complicating matters with 64 bit, as yet but it's on the To Do list. Many thanks. Regards, Donald -Original Message- From: postgis-users-boun...@postgis.refractions.net [mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Mark Cave-Ayland Sent: 08 June 2012 14:19 To: PostGIS Users Discussion Subject: Re: [postgis-users] PostgreSQL/PostGIS x64 Error on PostGIS Install On 07/06/12 14:00, Donald Kerr wrote: > Thanks, Regina. > > After uninstalling, I tried a fresh install of PostgreSQL followed by > a fresh install of PostGIS. The difference this time is that I did not > use the existing data structure and started with a new one. The > installation went well and without error. > > I uninstalled then repeated the above process with my existing data > structure and got the same error as before. The data structure was > created using the 32 bit version of PostgreSQL/PostGIS: > postgresql-9.1.3-1-windows.exe (Not 9.1.4). > > Is there an incompatibility between 64 bit and 32 bit data structures? > Any pointers appreciated. Ah yes. Due to the different variable sizes between 64 and 32 bits, the underlying binary structures on disk will be different and therefore incompatible. HTH, Mark. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] PostgreSQL/PostGIS x64 Error on PostGIS Install
On 07/06/12 14:00, Donald Kerr wrote: Thanks, Regina. After uninstalling, I tried a fresh install of PostgreSQL followed by a fresh install of PostGIS. The difference this time is that I did not use the existing data structure and started with a new one. The installation went well and without error. I uninstalled then repeated the above process with my existing data structure and got the same error as before. The data structure was created using the 32 bit version of PostgreSQL/PostGIS: postgresql-9.1.3-1-windows.exe (Not 9.1.4). Is there an incompatibility between 64 bit and 32 bit data structures? Any pointers appreciated. Ah yes. Due to the different variable sizes between 64 and 32 bits, the underlying binary structures on disk will be different and therefore incompatible. HTH, Mark. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] gdalinfo gives no georeferencing information for a PostGIS raster
Hi, I'm fairly new to PostGIS (version 2) and I'm struggling with a problem where gdalinfo doesn't seem to give the correct georeferencing information for a raster in PostGIS. I've asked a StackOverflow question about it, and I wondered if anyone here may be able to help - either on this mailing list or on the SO question? http://gis.stackexchange.com/questions/26958/gdalinfo-gives-no-georeferencing-information-for-a-postgis-raster#comment36245_26958 Best regards, Robin ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Error adding raster support
Hi Bborie, I compiled PostGIS 2 from the source. It is not available in the repos for Ubuntu 10.04. Thank you. -- View this message in context: http://postgis.17.n6.nabble.com/Error-adding-raster-support-tp4998034p4998112.html Sent from the PostGIS - User mailing list archive at Nabble.com. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] Installation error: database "template_postgis_20" does not exist
Hi When I try and install PostGIS 2.0 using Stack Builder on Windows 7 64-bit I get a warning: WARNING: The installer has detected that the PostGIS template database 'template_postgis_20' already exists. The message then informs me that the installer will create a new 'template_postgis_20' and any manual changes will be lost. When I proceed with the installation I get the error, 'Removal of template_postgis_20 failed.' The error log tells me: psql: FATAL: database "template_postgis_20" does not exist Following http://postgis.17.n6.nabble.com/Installing-postgis-from-an-NSIS-installer-td3562113.html, I created 'template_postgis_20' This case the installation proceeds further, but fails with the error 'Database installation of PostGIS functions failed. The error log contains, psql: FATAL: database "template_postgis" does not exist psql: FATAL: database "template_postgis_20" does not existt So I create both "template_postgis" and "template_postgis_20", but the error occurs again and a new line is appended to the log: psql: FATAL: database "template_postgis_20" does not exist I have also tried installing 32-bit and older version, but get the same problem. Deleting the PostgreSQL data dirs also has no effect. Thanks - Dave David Kidd Lecturer in Geographical Information Systems and Science Kingston University London 0208 417 2541 http://evoviz.org/ http://evoviz.blogspot.co.uk/ http://www.entangled-bank.org.uk/ This email has been scanned for all viruses by the MessageLabs Email Security System. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users