Re: [postgis-users] Length of a line above polygon
Yes, you're right. This should solve this problem: SELECT areas.id, SUM( ST_Length( ST_Intersection( lines.geometry , areas.geometry ) ) ) FROM lines,areas GROUP BY areas.id ; ST_intersects returns true if there is an intersection and ST_Intersection returns the share geometry. Greetings, Denis On 07/04/2012 08:47 AM, Matej Mailing wrote: Hi, Thank you for the answer. However, I don't get the right result. For example, when there is a line that is long 500 meters and it crosses 5 polygons (on each of them maybe just a meter or few meters, except one where lies a majority of the line), I get the full length of the lines for corresponding polygons - i.e. as every polygon that is crossed is crossed by the total line length. What I want to get is the actual length of the part of the line that crosses every specific polygon. TIA, Matej 2012/7/3 Denis Rouzaud denis.rouz...@gmail.com: Hi, You can use something like SELECT areas.id, SUM( ST_Length( lines.geometry) ) FROM lines,areas WHERE ST_Intersects(lines.geometry,areas.geometry) GROUP BY areas.id ; Greetings, Denis On 07/03/2012 01:36 PM, Matej Mailing wrote: Hi all, We have a layer that contains polygons and another that contains lines that lie on them. Parts of the lines are laying inside the polygons and I would like to get a sum of all the lengths of lines that lie on the polygons. What is the easiest way to achieve this? TIA, Matej ___ 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] Length of a line above polygon
Messages crossed, but seems we agree ;) On 07/04/2012 08:51 AM, Matej Mailing wrote: I think I have just found it out. I just add ST_Intersection to have a query like: SELECT areas.id, SUM( ST_Length( ST_Intersection(lines.geometry, areas.geometry) ) ) FROM lines,areas WHERE ST_Intersects(lines.geometry,areas.geometry) GROUP BY areas.id ; Now the numbers seem to be correct :-) Hopefully this could be of some use to anyone else when having such a problem. Thanks, Matej 2012/7/4 Matej Mailing mail...@tam.si: Hi, Thank you for the answer. However, I don't get the right result. For example, when there is a line that is long 500 meters and it crosses 5 polygons (on each of them maybe just a meter or few meters, except one where lies a majority of the line), I get the full length of the lines for corresponding polygons - i.e. as every polygon that is crossed is crossed by the total line length. What I want to get is the actual length of the part of the line that crosses every specific polygon. TIA, Matej 2012/7/3 Denis Rouzaud denis.rouz...@gmail.com: Hi, You can use something like SELECT areas.id, SUM( ST_Length( lines.geometry) ) FROM lines,areas WHERE ST_Intersects(lines.geometry,areas.geometry) GROUP BY areas.id ; Greetings, Denis On 07/03/2012 01:36 PM, Matej Mailing wrote: Hi all, We have a layer that contains polygons and another that contains lines that lie on them. Parts of the lines are laying inside the polygons and I would like to get a sum of all the lengths of lines that lie on the polygons. What is the easiest way to achieve this? TIA, Matej ___ 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] Length of a line above polygon
Hi, You can use something like SELECT areas.id, SUM( ST_Length( lines.geometry) ) FROM lines,areas WHERE ST_Intersects(lines.geometry,areas.geometry) GROUP BY areas.id ; Greetings, Denis On 07/03/2012 01:36 PM, Matej Mailing wrote: Hi all, We have a layer that contains polygons and another that contains lines that lie on them. Parts of the lines are laying inside the polygons and I would like to get a sum of all the lengths of lines that lie on the polygons. What is the easiest way to achieve this? TIA, Matej ___ 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
[postgis-users] get the biggest intersection
Hi all, I have a table of line and a table of polygons. For a given line, I would like to get the polygon which has the biggest intersection with the line. I tried something like this: CREATE OR REPLACE FUNCTION distribution.get_zone_id(geometry) RETURNS integer AS ' DECLARE inputgeom ALIAS FOR $1; id_poly integer; BEGIN SELECT id INTO id_poly FROM polygons WHERE ST_Intersects(inputgeom,geometry) IS TRUE ORDER BY ST_Length(ST_Intersection(inputgeom,geometry)) DESC LIMIT 1; RETURN id_poly; END ' LANGUAGE 'plpgsql'; But I have the following error: ERROR: Error performing intersection: TopologyException: side location conflict at 553524.92178241001 147945.03792368001 If anyone has any idea, tip or whatever, it is very welcome! Greetings, Denis ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] get the biggest intersection
Hi Stefen, Hi Fred, Thank you both for your answer. There was effectively an invalidity in a geometry. Now my function is working great. But still, do you think it is a good idea to use an order by and limit 1 to have the desired result? Thanks again, Denis On 06/20/2012 04:27 PM, Stephen Woodbridge wrote: Try: select count(*) from polygons where not isvalid(geometry); if count 0 then select count(*) from polygons where not isvalid(geometry) and not isvalid(st_buffer(geometry, 0.0)); you can do an update to fix these: update polygons set geometry=st_buffer(geometry, 0.0) where not isvalid(geometry); -Steve W On 6/20/2012 7:54 AM, Denis Rouzaud wrote: Hi all, I have a table of line and a table of polygons. For a given line, I would like to get the polygon which has the biggest intersection with the line. I tried something like this: CREATE OR REPLACE FUNCTION distribution.get_zone_id(geometry) RETURNS integer AS ' DECLARE inputgeom ALIAS FOR $1; id_poly integer; BEGIN SELECT id INTO id_poly FROM polygons WHERE ST_Intersects(inputgeom,geometry) IS TRUE ORDER BY ST_Length(ST_Intersection(inputgeom,geometry)) DESC LIMIT 1; RETURN id_poly; END ' LANGUAGE 'plpgsql'; But I have the following error: ERROR: Error performing intersection: TopologyException: side location conflict at 553524.92178241001 147945.03792368001 If anyone has any idea, tip or whatever, it is very welcome! Greetings, Denis ___ 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 ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] get the biggest intersection
Hi, Thanks again. Well, I have water pipes and consumption areas. So, the described method should be correct. Moreover, the intersection is a first draft, as it has to be manually corrected afterwards: a pipe might belong to an area which it does not intersect. I was more thinking in terms of sql efficiency. But I tested, and it seems fast enough regarding my db volume. Best regards, Denis On 06/20/2012 05:34 PM, Stephen Woodbridge wrote: On 6/20/2012 10:43 AM, Denis Rouzaud wrote: Hi Stefen, Hi Fred, Thank you both for your answer. There was effectively an invalidity in a geometry. Now my function is working great. But still, do you think it is a good idea to use an order by and limit 1 to have the desired result? Yes, I have done similar queries. As an alternative you could split the lines into multiple segments and then assign attributes to them based on the polygons they fall into. Imagine the case of a polyline that travels from city A to city B and 5% of the polyline is in A and 15% of the polyline is in B and 80% of the polyline is not in A or B but the rural arear between the cities. In you case you would always report it as being in B and 85% of the time that would be wrong. Chopping the linestring into the 3 pieces is a lot more work but would give better results. So the correct answer for you has more to do with what your data represents and if your polygons are discrete or form a coverage, etc. and how tolerant you are to reporting errors as described above. -Steve Thanks again, Denis On 06/20/2012 04:27 PM, Stephen Woodbridge wrote: Try: select count(*) from polygons where not isvalid(geometry); if count 0 then select count(*) from polygons where not isvalid(geometry) and not isvalid(st_buffer(geometry, 0.0)); you can do an update to fix these: update polygons set geometry=st_buffer(geometry, 0.0) where not isvalid(geometry); -Steve W On 6/20/2012 7:54 AM, Denis Rouzaud wrote: Hi all, I have a table of line and a table of polygons. For a given line, I would like to get the polygon which has the biggest intersection with the line. I tried something like this: CREATE OR REPLACE FUNCTION distribution.get_zone_id(geometry) RETURNS integer AS ' DECLARE inputgeom ALIAS FOR $1; id_poly integer; BEGIN SELECT id INTO id_poly FROM polygons WHERE ST_Intersects(inputgeom,geometry) IS TRUE ORDER BY ST_Length(ST_Intersection(inputgeom,geometry)) DESC LIMIT 1; RETURN id_poly; END ' LANGUAGE 'plpgsql'; But I have the following error: ERROR: Error performing intersection: TopologyException: side location conflict at 553524.92178241001 147945.03792368001 If anyone has any idea, tip or whatever, it is very welcome! Greetings, Denis ___ 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 ___ 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 ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] raster efficiency
Thanks a lot. I'll have a look and tell you if things are going faster ;) Greetings Denis On 04/02/2012 04:35 PM, Pierre Racine wrote: Do you suggest to cut them before with gdal and have something like 1000 small tiles rather than my 14 big ones? Yes. I wrote a ST_Tile function prototype to retile your raster if you don't want to reload them: http://trac.osgeo.org/postgis/browser/trunk/raster/scripts/plpgsql/st_tile.sql Pierre ___ 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] raster efficiency
Hi Pierre, Thanks for your answer. To compute profile, here is what I do: Input is a linestring Initializes raster ID to NULL I segmentize to the desired length Force 3D For all points do: Get point in 2d If point does not intersect with current raster ID: get new raster ID Get altitude with ST_Value Set current point with 3rd coordinates ST_3Dlength Here is the full SQL if you want https://github.com/3nids/qWat/blob/0b1ced3781e135d5eb03f5172610fd8889c7ae36/sql/3d.sql I noticed that searching for the correct raster took time, so that's why I keep current raster ID. And having bit tiles, the probability to stay on the same raster is quite high. Also my 14 tiles are 6x9km at 2m, so this is about 3000x4500. Do you suggest to cut them before with gdal and have something like 1000 small tiles rather than my 14 big ones? Thanks Denis On 03/30/2012 03:47 PM, Pierre Racine wrote: I found quite to calculate a profile: it takes approx 1-2 secondes to calculate a profile of 4-6 points. Is there any thing that I can do to fasten the process? How do you compute your profile? What is the best strategy: having more small rasters or a single big one? For raster/vector operations, smaller raster tiles (10x10) is generally preferable/faster. Pierre ___ 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
[postgis-users] raster efficiency
Hi all, I am loading in a table a somehow large set of DTM: 14 DTM of 6x9km with a 2m pixel. I found quite to calculate a profile: it takes approx 1-2 secondes to calculate a profile of 4-6 points. Is there any thing that I can do to fasten the process? What is the best strategy: having more small rasters or a single big one? Thanks a lot Denis ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] raster: several DTM in same table, how to select?
Hi all, I have a table in which I put ~10 dtm as rasters. How do I select in the where close the DTM in which my point is? Indeed, if I use ST_Value on the whole table, I have: NOTICE: Attempting to get pixel value with out of range raster coordinates: (9512, 9899) CONTEXT: PL/pgSQL function st_value line 13 at RETURN SQL statement SELECT ST_Value(rast, ST_SetSRID( point , 21781 )) FROM distribution.dtm BTW, isn'it strange? I think that it used to return a NULL value if outside of the boundaries, no? Thanks Denis ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] raster: several DTM in same table, how to select?
Hi again. I found the solution, sorry for asking. SELECT ST_Value(rast,point) FROM distribution.dtm WHERE ST_Intersects(rast,1,point); or WHERE ST_Within(point,ST_Envelope(rast)); ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] More details for errors
Hi again! Well, this is always the same problem, if I do linemerge(union()), I have to force multi to prevent errors. Then, simplifying to linestring seems to consume resources. On way, would to do a view which determine if the union would lead to a multi or a linestring. But I don't know how to achieve this. I have no idea either if this would also be greedy on resources. Denis On 03/27/2012 05:43 PM, Nicolas Ribot wrote: Yes, it is 2.0 http://postgis.refractions.net/documentation/manual-svn/ST_CollectionHomogenize.html Well, I am turning around the problem... I have to do a cast, as I used ST_Multi(ST_LineMerge(ST_Union(wkb_geometry)))::geometry(MultiLineString,xxx) in the first view to prevent errors of unconnected lines. Right now the best solution I have is to let the view being unusable, and another view to report errors. This is not very satisfying as if a problem occurs, I cannot use my view until I fix the geometric errors. Basically, I need to compute a view with a LineMerge returning LineString (i.e. leaving away features leading to MultiLineString) and another view returning IDs of features leading to MULTI. I thought about using ST_Touches but it only uses two geometries and I can have more in the LineMerge. No idea what to look for... Thanks for your help. I could go deeper in the problem! Greetings I would then create 3 views: One doing the actual computation (linemerge(Union)), then one view where st_numgeometries(the_geom) = 1, and one view where st_numgeometries(the_geom) 1. nicolas ___ 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] More details for errors
Hi Nicolas, hi all, Thanks for your reply. The problem is: - I cannot filter my view using where geometryType(wkb_geometry) = 'LINESTRING' as it will still return the same error - I cannot check the result of ST_LineMerge in the where clause since aggragates are not allowed in wheres - If I cast to a MULTI, I don't how to check that it is castable to a LineString. So, I'll try to reformulate: - Can I check if a MultiLineString is in fact a LineString ? - Is there a way to test the result of LineMerge to see if it is a LineString or MultiLineString? Thanks Denis On 03/26/2012 02:00 PM, Nicolas Ribot wrote: Hi all, I have a view which does this ST_LineMerge(ST_Union(wkb_geometry))::geometry(LineString,21781) In case of the lines are not juxtaposed, I have this error ERROR: Geometry type (MultiLineString) does not match column type (LineString) Is there a way of getting the line ID which leads to the error??? Hi, you could execute the SQL query defining the view and filter features where geometryType(wkb_geometry) = 'LINESTRING' to identify only problematic features. Nicolas ___ 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] More details for errors
Hi Nicolas, Thanks again. Well, this working, but this not performant... Based on your suggestion, I tried this: in view1: ST_Multi(ST_LineMerge(ST_Union(wkb_geometry)))::geometry(MultiLineString,21781) AS wkb_geometry Then in view2: ST_CollectionHomogenize(wkb_geometry)::geometry(LineString,21781) AS wkb_geometry FROM view1 WHERE ST_NumGeometries(wkb_geometry) = 1; And I can detect problems by doing: SELECT id FROM view1 WHERE ST_NumGeometries(wkb_geometry) != 1; But this is slowing down a lot. I think that the ST_CollectionHomogenize is not the right way. Is there a better function to transform multiline to line if I am sure I only have lines? Greetings, Denis On 03/27/2012 02:29 PM, Nicolas Ribot wrote: On 27 March 2012 08:02, Denis Rouzauddenis.rouz...@gmail.com wrote: Hi Nicolas, hi all, Thanks for your reply. The problem is: - I cannot filter my view using where geometryType(wkb_geometry) = 'LINESTRING' as it will still return the same error - I cannot check the result of ST_LineMerge in the where clause since aggragates are not allowed in wheres - If I cast to a MULTI, I don't how to check that it is castable to a LineString. So, I'll try to reformulate: - Can I check if a MultiLineString is in fact a LineString ? - Is there a way to test the result of LineMerge to see if it is a LineString or MultiLineString? Hi, The number of elements in the collection will tell you if it is a linestring (1 element): st_numGeometries(), or the geometry type (geometryType() ) will start by 'MULTI' in case of collection. You could add a rule on your view to disallow st_lineMerge results producing MULTI elements. Nicolas ___ 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] More details for errors
Yes, it is 2.0 http://postgis.refractions.net/documentation/manual-svn/ST_CollectionHomogenize.html Well, I am turning around the problem... I have to do a cast, as I used ST_Multi(ST_LineMerge(ST_Union(wkb_geometry)))::geometry(MultiLineString,xxx) in the first view to prevent errors of unconnected lines. Right now the best solution I have is to let the view being unusable, and another view to report errors. This is not very satisfying as if a problem occurs, I cannot use my view until I fix the geometric errors. Basically, I need to compute a view with a LineMerge returning LineString (i.e. leaving away features leading to MultiLineString) and another view returning IDs of features leading to MULTI. I thought about using ST_Touches but it only uses two geometries and I can have more in the LineMerge. No idea what to look for... Thanks for your help. I could go deeper in the problem! Greetings Denis On 03/27/2012 04:39 PM, Nicolas Ribot wrote: On 27 March 2012 16:09, Denis Rouzauddenis.rouz...@gmail.com wrote: Hi Nicolas, Thanks again. Well, this working, but this not performant... Based on your suggestion, I tried this: in view1: ST_Multi(ST_LineMerge(ST_Union(wkb_geometry)))::geometry(MultiLineString,21781) AS wkb_geometry Then in view2: ST_CollectionHomogenize(wkb_geometry)::geometry(LineString,21781) AS wkb_geometry FROM view1 WHERE ST_NumGeometries(wkb_geometry) = 1; And I can detect problems by doing: SELECT id FROM view1 WHERE ST_NumGeometries(wkb_geometry) != 1; But this is slowing down a lot. I think that the ST_CollectionHomogenize is not the right way. Is there a better function to transform multiline to line if I am sure I only have lines? I did not know this function. 2.0 ? You can simply do: st_setsrid(ST_geometryN(wkb_geometry), 21781) AS wkb_geometry FROM view1 WHERE ST_NumGeometries(wkb_geometry) = 1; If geoms come from linemerge, no need to cast to a linestring. It is already one. Nicolas ___ 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
[postgis-users] More details for errors
Hi all, I have a view which does this ST_LineMerge(ST_Union(wkb_geometry))::geometry(LineString,21781) In case of the lines are not juxtaposed, I have this error ERROR: Geometry type (MultiLineString) does not match column type (LineString) Is there a way of getting the line ID which leads to the error??? Thanks! Denis ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] st_length problem
What you wrote did also a cast to geography. You should take Nicklas' advise as it is much more easy to read, and probably more efficient. Denis On 03/22/2012 11:42 AM, Ed Linde wrote: I think I fixed it using the following: Maybe someone can confirm its ok? select o.osm_id, ST_AsText(ST_Transform(o.way,4326)), ST_Length( ST_GeographyFromText( ST_AsText(ST_Transform(o.way,4326 from planet_osm_line o where o.highway is not null; On Thu, Mar 22, 2012 at 11:35 AM, Ed Linde edoli...@gmail.com mailto:edoli...@gmail.com wrote: I have a feeling that these could be lat/long degrees differences... but is there a way to get the length of the road segments in meters please? On Thu, Mar 22, 2012 at 11:32 AM, Ed Linde edoli...@gmail.com mailto:edoli...@gmail.com wrote: Hi All, Am trying to measure the length of road segments from OSM (open street map) and getting some weird values. Is this in meters? If so its too small. Is my query right? select o.osm_id,ST_AsText(ST_Transform(o.way,4326)),ST_Length(ST_Transform(o.way,4326)) from planet_osm_line o where o.highway isnot null; 26781954;LINESTRING(12.4488377563054 55.7052298677097,12.4475093276633 55.7050849548856,12.4459445522699 55.7049392822841,12.444526741257 55.7048546522258,12.4432355926991 55.7048141593102,12.4415570905907 55.7047361597132,12.439932936557 55.7046743571964,12.4383072553874 55.7046393812816,12.4376592107414 55.704619792731);0.*011295550213* 26487076;LINESTRING(12.4376603785513 55.7323555892184,12.4377151757836 55.7341099847101,12.4377174215718 55.734184081729,12.4377245182625 55.7344121883925,12.4377250572517 55.7344266536481);0.*00207207442718709* 114383319;LINESTRING(12.4378901676009 55.7615479714339,12.4377832680821 55.7617575712814,12.4376867890206 55.7619467509818);*0.**000447647154409751* cheers, Ed ___ 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] Are there any Ubuntu PPAs that serve PostGIS 2.0 beta releases?
Good job Charlie!!! On 03/15/2012 06:40 PM, Charlie Sharpsteen wrote: On Wednesday, March 14, 2012 8:18:35 AM UTC-7, Charlie Sharpsteen wrote: On Wednesday, March 14, 2012 12:02:24 AM UTC-7, Sandro Santilli wrote: On Tue, Mar 13, 2012 at 07:50:32PM -0700, Charlie Sharpsteen wrote: I was wondering if anyone has a Personal Package Archive for Ubuntu that is tracking the 2.0 beta releases. I looked at the UbuntuGIS and Postgis project pages on Launchpad, but the only releases listed there were for 1.5.x. Even the unstable repostory of UbuntuGIS was still tracking 1.5.x. I'm not aware of any. It'd be very welcome if you want to setup one. --strk; Allright, I'll take a shot at it. Looks like there is a Launchpad repository that is synching with PostGIS SVN every 6 hours or so---perhaps I can get a nightly build set up. -Charlie Ok, I now have a nightly build set up that is tracking the PostGIS trunk. Binaries are being built for Oneric (11.11) and Precise (12.04-dev) and can be installed thusly: sudo apt-add-repository ppa:sharpie/postgis-nightly sudo apt-get update sudo apt-get install postgresql-9.1-postgis Caveats: * No build of `postgis` or `libpostgis-java`, the only package provided is `postgresql-9.1-postgis` which contains the PostGIS plugins, extensions and command line tools. * Builds against GEOS 3.2.2, supplied by the standard Ubuntu repositories, thus the topology extension is unavailable. * Builds against GDAL 1.7.0, supplied by the standard Ubuntu repositories, thus some raster functionalities are unavailable. The raw materials that went into creating this build were the PostGIS repository on Launchpad which synchs with the upstream SVN trunk ~every 6 hours: https://code.launchpad.net/~registry/postgis/trunk This repostory can be cloned using bazaar via `bzr branch lp:postgis`. The other component is the official Ubuntu PostGIS repository that contains the debian packaging materials: https://code.launchpad.net/~ubuntu-branches/ubuntu/precise/postgis/precise This repository can be cloned using `bzr branch lp:ubuntu/postgis`. My strategy was to fork `lp:ubuntu/postgis`, edit the contents of the debian subdirectory to make it compatible with 2.0-dev and then publish the edited fork to Launchpad under my `+junk` section. After this was done, I set up a `bzr-builder` recipe that fuses `lp:postigs`, which tracks the upstream PostGIS repo, with the debian subdirectory contained in `lp:~sharpie/+junk/postgis`, which contains my edited packaging info, to create a nightly build: # bzr-builder format 0.3 deb-version {debupstream}~r{revno}~ppa{revno:packaging} lp:postgis nest-part packaging lp:~sharpie/+junk/postgis debian debian Pretty slick. I will ponder upgrading GEOS and GDAL and setting up a stable build for the most recent beta releases. -Charlie ___ 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] Are there any Ubuntu PPAs that serve PostGIS 2.0 beta releases?
That would be amazing. But, there is no ppa for geos 3.3 either and I am not sure about gdal 1.9... It might be a little early to have a ppa repo and dependencies with unavailable packages My 2 cents. On 03/14/2012 04:18 PM, Charlie Sharpsteen wrote: On Wednesday, March 14, 2012 12:02:24 AM UTC-7, Sandro Santilli wrote: On Tue, Mar 13, 2012 at 07:50:32PM -0700, Charlie Sharpsteen wrote: I was wondering if anyone has a Personal Package Archive for Ubuntu that is tracking the 2.0 beta releases. I looked at the UbuntuGIS and Postgis project pages on Launchpad, but the only releases listed there were for 1.5.x. Even the unstable repostory of UbuntuGIS was still tracking 1.5.x. I'm not aware of any. It'd be very welcome if you want to setup one. --strk; Allright, I'll take a shot at it. Looks like there is a Launchpad repository that is synching with PostGIS SVN every 6 hours or so---perhaps I can get a nightly build set up. -Charlie ___ 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] Are there any Ubuntu PPAs that serve PostGIS 2.0 beta releases?
You are right, but there notices in http://postgis.refractions.net/documentation/manual-svn/postgis_installation.html#id2744974 GEOS geometry library, version 3.2.2 or greater, but GEOS 3.3.2+ is recommended. Without GEOS 3.3, you will be missing some major enhancements with handling of topological exceptions and improvements to geometry validation and making geometries valid such as ST_ValidDetail and ST_MakeValid. GEOS 3.3.2+ is also required for topology support. GEOS is available for download fromhttp://trac.osgeo.org/geos/and 3.3+ is backward-compatible with older versions so fairly safe to upgrade. GDAL, version 1.6 or higher (1.9 or higher is preferable since some things will not work well with lower versions). This is needed for raster support and will be required in final release of PostGIS 2.0.http://trac.osgeo.org/gdal/wiki/DownloadSource. I am no expert, but I am not sure it's good idea to deliver builds of postgis in a sub-optimal config. On 03/14/2012 04:29 PM, Charlie Sharpsteen wrote: On Wednesday, March 14, 2012 8:21:48 AM UTC-7, Denis Rouzaud wrote: That would be amazing. But, there is no ppa for geos 3.3 either and I am not sure about gdal 1.9... It might be a little early to have a ppa repo and dependencies with unavailable packages My 2 cents. Pretty sure I built PostGIS from source against GDAL 1.7 and GEOS 3.2.2 from the Oneiric standard repository. Are there any critical functions that are inactive without the latest and greatest versions of these libraries? -Charlie ___ 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
[postgis-users] cannot make comments
Hi, since yesterday, I cannot run make comments anymore. I have filled ticket 1642 http://trac.osgeo.org/postgis/ticket/1642 Here is the output: make -C doc comments make[1]: Entering directory `/opt/postgis-2.0.0beta2SVN/doc' cat postgis.xml | sed -e s/@@LAST_RELEASE_VERSION@@/2.0.0beta2SVN/g -e s;@@MATHML_PATH@@;http://www.w3.org/Math/DTD/mathml2/mathml2.dtd;g; postgis-out.xml /usr/bin/xsltproc ./xsl/postgis_aggs_mm.xml.xsl postgis-out.xml postgis_aggs_mm.xml /usr/bin/xsltproc ./xsl/postgis_comments.sql.xsl postgis-out.xml postgis_comments.sql /usr/bin/xsltproc ./xsl/raster_comments.sql.xsl postgis-out.xml raster_comments.sql /usr/bin/xsltproc ./xsl/topology_comments.sql.xsl postgis-out.xml topology_comments.sql http://www.oasis-open.org/docbook/xml/4.5/ent/isonum.ent:1: parser error : Content error in the external subset HTTP/1.1 200 OK ^ http://www.oasis-open.org/docbook/xml/4.5/ent/isonum.ent:1: validity error : All markup of the conditional section is not in the same entity HTTP/1.1 200 OK ^ http://www.oasis-open.org/docbook/xml/4.5/ent/isonum.ent:1: parser error : Content error in the external subset HTTP/1.1 200 OK ^ http://www.oasis-open.org/docbook/xml/4.5/ent/isonum.ent:1: validity error : All markup of the conditional section is not in the same entity HTTP/1.1 200 OK ^ http://www.oasis-open.org/docbook/xml/4.5/ent/isonum.ent:1: parser error : Content error in the external subset HTTP/1.1 200 OK ^ unable to parse postgis-out.xml make[1]: *** [topology_comments.sql] Error 6 make[1]: Leaving directory `/opt/postgis-2.0.0beta2SVN/doc' make: *** [comments] Error 2 ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] cannot make comments
I cannot find any isonum.ent on the server. I feel like I want to give a hand, but I have to say I don't know/understand what to do in README.postgis. I have time and motivation to give a hand, but I am using postgis for a very short time, and I am not mastering its structure, build or whatever. For the moment, I am better at bringing tickets than helping to solve them :( However, if the time you'll spend to explain me is worth the job to do, then we can try... On 03/01/2012 12:07 PM, Sandro Santilli wrote: We changed the default so you get a chance to contribute a patch for the REQUIREMENTS section of the README file:) Before the change you would be able to build the comments but very slowly fetching the DTD everytime. Now you have to install it in your system (or bruteforce - instructions in the ticket and in the doc/Makefile.in). --strk; ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] cannot make comments
I installed w3-dtd-mathml and could run make comments. So you want me to add the package w3-dtd-mathml in the list of the requirements in the doc, I got it? On 03/01/2012 02:02 PM, Sandro Santilli wrote: On Thu, Mar 01, 2012 at 01:50:13PM +0100, Denis Rouzaud wrote: I cannot find any isonum.ent on the server. Ask your package manager for mathml and dtd. If apt-based: $ apt-cache search mathml dtd I feel like I want to give a hand, but I have to say I don't know/understand what to do in README.postgis. It has a REQUIREMENTS section. Actually there's also a doc/README which may be more appropriate. --strk; ,--o-. | __/ |Delivering high quality PostGIS 2.0 ! | / 2.0 |http://strk.keybit.net - http://vizzuality.com `-o--' ___ 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] cannot make comments
I could not commit the diff in the doc/README On 03/01/2012 12:07 PM, Sandro Santilli wrote: We changed the default so you get a chance to contribute a patch for the REQUIREMENTS section of the README file:) ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] cannot make comments
okay, I saw your repo on github before, but I thought it was just a mirror, and that postgis was handled under svn. I send you a pull request. So much effort for three lines, but I am ready for next time then. On 03/01/2012 03:22 PM, Sandro Santilli wrote: On Thu, Mar 01, 2012 at 02:47:49PM +0100, Denis Rouzaud wrote: I could not commit the diff in the doc/README You need git ! :) $ git clone git://github.com/strk/postgis.git $ cd postgis $ edit edit edit $ git commit -m I did edit ! Then you can send the patch produced by: $ git format-patch origin/master Or if you're using SVN just send the output of: $ svn diff Or if you're _not_ using SVN get a copy of the original README file and send the output of: $ diff -U2 README.original README --strk; ,--o-. | __/ |Delivering high quality PostGIS 2.0 ! | / 2.0 |http://strk.keybit.net - http://vizzuality.com `-o--' ___ 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] ERROR:function totopogeom() does not exist
Hi, This in a discussion that is already going on. http://postgis.refractions.net/pipermail/postgis-users/2012-February/032748.html I am filling this ticket right now. Thanks Denis On 02/29/2012 10:48 AM, Salvatore Larosa-1 wrote: Hi Sandro i recompiled again version alpha7 and i get: *SELECT postgis_full_version():* POSTGIS=2.0.0alpha7SVN GEOS=3.3.2-CAPI-1.7.2 PROJ=Rel. 4.7.1, 23 September 2009 GDAL=GDAL 1.9.0, released 2011/12/29 LIBXML=2.7.8 USE_STATS (core procs from 2.0.0alpha7SVN need upgrade) (topology procs from 2.0.0alpha7SVN need upgrade) (raster procs from 2.0.0alpha7SVN need upgrade) *SHOW search_path:* $user, public, topology But now, when run script (strk.demo.sql) i get this: ERROR: SQL/MM Spatial exception - start node not geometry start point. CONTEXT: SQL statement SELECT ST_ChangeEdgeGeom(atopology, rec.edge_id, snapedge) Can i open a ticket for this? Regards -- View this message in context: http://postgis.17.n6.nabble.com/ERROR-function-totopogeom-does-not-exist-tp4529301p4530753.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 mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] topology example, new bug?
Here is what I got: Edge within 0 distance from node still does not contain the node after snapping to it with tolerance 2.00256322663555e-09 On 02/29/2012 09:47 AM, Sandro Santilli wrote: #define POSTGIS_TOPOLOGY_DEBUG 1 Should tell you the tolerance used in snapping. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ERROR:function totopogeom() does not exist
I have the same output when postgis_full_version() Running the minor upgrade files did not solve this. I have a more general question. What is the procedure when you pull the new source of postigs. Until now, I deleted the db and run again the SQL files in a fresh new db. Is there a shorter way after re-compiling? On 02/29/2012 11:13 AM, Sandro Santilli wrote: On Wed, Feb 29, 2012 at 12:50:43AM -0800, Salvatore Larosa-1 wrote: Hi Sandro, this is what I get: SELECT postgis_full_version(); POSTGIS=2.0.0alpha7SVN GEOS=3.3.2-CAPI-1.7.2 PROJ=Rel. 4.7.1, 23 September 2009 GDAL=GDAL 1.9.0, released 2011/12/29 LIBXML=2.7.8 USE_STATS (core procs from 2.0.0alpha7SVN need upgrade) (topology procs from 2.0.0alpha7SVN need upgrade) (raster procs from 2.0.0alpha7SVN need upgrade) Alright, as the messages say: topology procs from '2.0.0alpha7SVN' need upgrade It means you have to load topology/topology_upgrade_20_minor.sql Note that core procs... need upgrade also means you need to load postgis_upgrade_20_minor.sql. Similarly, raster procs... need upgrade means you need to load rtpostgis_upgrade_20_minor.sql. Please let me know if doing so removes the need upgrade messsages, as they seem to be confusing. --strk; ,--o-. | __/ |Delivering high quality PostGIS 2.0 ! | / 2.0 |http://strk.keybit.net - http://vizzuality.com `-o--' ___ 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
[postgis-users] ST_LineToCurve for less than 4 points
Hi, Can someone tells me why ST_LineToCurve needs at least a linestring of 4 points to be run? If I have three points, I should be able to create a circularstring, right? Here the error I have: SELECT ST_LineToCurve(ST_GeomFromText('LINESTRING(554803.177682475 145390.853708235,554796.469135702 145401.404724093,554769.634948609 145404.042478058)')); ERROR: pta_desegmentize needs implementation for npoints 4 Thanks a lot, Denis ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ST_LineToCurve for less than 4 points
I had a look to this, but it's far from my competence right now... On 02/28/2012 09:38 AM, Sandro Santilli wrote: It needs implementation. A patch is welcome. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ST_LineToCurve for less than 4 points
I partially agree. If you look in the doc http://postgis.refractions.net/documentation/manual-svn/ST_LineToCurve.html It is written that it should convert to circular strings or curved polygon. In case of circular strings, you need at least 3 (and not 4) points to determine the circle, as explained in Stephen's link http://paulbourke.net/geometry/circlefrom3/ On 02/28/2012 04:32 PM, Paul Ramsey wrote: No. This is a misunderstanding of purposes. ST_LineToCurve is the inverse of ST_CurveToLine. CurveToLine takes in a circular object and linearizes it, turning curves into regular small sections of linear arcs to approximate the input shape. LineToCurve analyzes an input linestring, looking for the tell-tale regularity of linearized arcs and converts them back to real arcs. The process can only work with linestrings that have for or more vertices to analyze. What Denis is looking for is probably something more like http://trac.osgeo.org/postgis/ticket/1291 P. On Tue, Feb 28, 2012 at 12:38 AM, Sandro Santillis...@keybit.net wrote: On Tue, Feb 28, 2012 at 09:36:34AM +0100, Denis Rouzaud wrote: Hi, Can someone tells me why ST_LineToCurve needs at least a linestring of 4 points to be run? If I have three points, I should be able to create a circularstring, right? Here the error I have: SELECT ST_LineToCurve(ST_GeomFromText('LINESTRING(554803.177682475 145390.853708235,554796.469135702 145401.404724093,554769.634948609 145404.042478058)')); ERROR: pta_desegmentize needs implementation for npoints 4 If I read the message correctly it answers exactly your questions. It needs implementation. A patch is welcome. --strk; ,--o-. | __/ |Delivering high quality PostGIS 2.0 ! | / 2.0 |http://strk.keybit.net - http://vizzuality.com `-o--' ___ 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 ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] topology example
Hi Sandro, Thanks a lot for your attention. I did not had so much time to look deeply into it these two days. So far, I could not perform make check correctly due to some passwords problems. Basically, I have a database in oracle (non spatial) in topobase (autocad) with pipes. I am migrating the whole thing to use Qgis to manage the network. So I collected all the given errors when using toTopoGeom to first correct the geometry in autocad, then re-importing and re-creating the topology again. I don't really understand how the topology is handled in postgis and what is for example written in the topogeom column. There is still one main point which I don't understand. Why is there any control on the topology if there is validateTopology function? On 02/28/2012 04:31 PM, Sandro Santilli wrote: On Fri, Feb 24, 2012 at 04:44:24PM +0100, Denis Rouzaud wrote: Thanks a lot for your time and work! Maybe, everything will autofix during the weekend ... Denis, this mail just to tell you that the ticket [1] has been worked a bit upon, but needs much more work. It's a robustness issue which may or may not be worked-around of by adding a tolerance parameter to your toTopoGeom calls. Let me know if it does. [1] http://trac.osgeo.org/postgis/ticket/1613 --strk; ,--o-. | __/ |Delivering high quality PostGIS 2.0 ! | / 2.0 |http://strk.keybit.net - http://vizzuality.com `-o--' ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ST_LineToCurve for less than 4 points
Thanks for the warning. I won't do it again, I promise ;) On 02/28/2012 04:57 PM, Leoze Oze wrote: Dear Denis, you need to be strong to be partially agree with Paul Ramsey. ;) Regards. On Tue, Feb 28, 2012 at 3:46 PM, Denis Rouzaud denis.rouz...@gmail.com mailto:denis.rouz...@gmail.com wrote: I partially agree. If you look in the doc http://postgis.refractions.net/documentation/manual-svn/ST_LineToCurve.html It is written that it should convert to circular strings or curved polygon. In case of circular strings, you need at least 3 (and not 4) points to determine the circle, as explained in Stephen's link http://paulbourke.net/geometry/circlefrom3/ On 02/28/2012 04:32 PM, Paul Ramsey wrote: No. This is a misunderstanding of purposes. ST_LineToCurve is the inverse of ST_CurveToLine. CurveToLine takes in a circular object and linearizes it, turning curves into regular small sections of linear arcs to approximate the input shape. LineToCurve analyzes an input linestring, looking for the tell-tale regularity of linearized arcs and converts them back to real arcs. The process can only work with linestrings that have for or more vertices to analyze. What Denis is looking for is probably something more like http://trac.osgeo.org/postgis/ticket/1291 P. On Tue, Feb 28, 2012 at 12:38 AM, Sandro Santillis...@keybit.net mailto:s...@keybit.net wrote: On Tue, Feb 28, 2012 at 09:36:34AM +0100, Denis Rouzaud wrote: Hi, Can someone tells me why ST_LineToCurve needs at least a linestring of 4 points to be run? If I have three points, I should be able to create a circularstring, right? Here the error I have: SELECT ST_LineToCurve(ST_GeomFromText('LINESTRING(554803.177682475 145390.853708235,554796.469135702 145401.404724093,554769.634948609 145404.042478058)')); ERROR: pta_desegmentize needs implementation for npoints 4 If I read the message correctly it answers exactly your questions. It needs implementation. A patch is welcome. --strk; ,--o-. | __/ |Delivering high quality PostGIS 2.0 ! | / 2.0 |http://strk.keybit.net -http://vizzuality.com `-o--' ___ postgis-users mailing list postgis-users@postgis.refractions.net mailto:postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net mailto:postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net mailto: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] topology example
Hi Sandro, Thanks a lot for these explanations, things are getting clearer. The difference between planar and network topology is that edges can cross without being connected, right? I will rebuild postgis and go further!!! Again, many thanks for your work! Denis ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ERROR:function totopogeom() does not exist
Hi, This file was not really a demo, but a set to reproduce an error in postgis (the ticket 1613) which has been fixed in r9330, a more recent version than a7. So you should download the svn repo and rebuild postgis. On 02/28/2012 10:38 PM, Salvatore Larosa wrote: Hi, I was playing with a simple example to build topology, using the file strk. demo.sql, but I get the following error: ERROR: function totopogeom(geometry, unknown, integer) does not exist RIGA 17: UPDATE test.pipes SET topogeom = toTopoGeom(wkb_geometry, 't... ^ I checked if the function exists and is so! in postgis a6 i get the same error of bug #1613, but now i am in a7!!! Any hint? SL ___ 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
[postgis-users] topology example, new bug?
Hi Sandro Me again :( I recompiled postgis, and re-run the file https://github.com/3nids/qWat/blob/38cde48d509d9b9a179eea1fd4db5bbd67121dcf/sql/strk.demo.sql here is there error I get: psql:strk.demo.sql:18: ERROR: SQL/MM Spatial exception - start node not geometry start point. CONTEXT: SQL statement SELECT ST_ChangeEdgeGeom(atopology, rec.edge_id, snapedge) PL/pgSQL function topogeo_addpoint line 83 at PERFORM PL/pgSQL function topogeo_addlinestring line 111 at assignment SQL statement INSERT INTO test_topo.relation(topogeo_id, layer_id, element_type, element_id) SELECT 2, 1, 2, topogeo_addLineString('test_topo', '01022015550B00BAF06A7E96F92041CD9B5862AAAF01417C5F9E5897F92041C5021D65AAAF0141713D0A57BDF920415C8FC2F5B4AF01411F85EB51D7F92041F6285C8FB8AF014148E17A142CFA2041C3F5285CC1AF0141F6285C8F3AFA2041B81E85EBC7AF0141AE47E1FA50FA2041C6AF01415CA1BCED53FA2041A41C48D6C8AF014148E17A1460FA204114AE47E1D2AF0141D1AC322684FA2041A3ECA94C02B001418FC2F5A895FA2041D7A3703D1AB00141'::geometry, 0); PL/pgSQL function totopogeom line 116 at EXECUTE statement ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] topology example
Thanks. As I have installed from scratch the upgrade files are useless for me, right? (I am getting lost...) Ticket #1611 has been filled I'll try to do the loop today and check. I'll let you know! On 02/24/2012 09:10 AM, Sandro Santilli wrote: On Fri, Feb 24, 2012 at 07:34:54AM +0100, Denis Rouzaud wrote: Hi Sandro, Thanks again. I have a fresh installed for 2 days now. Postgis 2.0 a6 (it is a 7 now) Geos 3.3.2 Is this ok? Should be, yes. I did not do anything with topology_upgrade.sql, there is nothing written in the installation doc. That's a bug in the documentation, could you file it on http://trac.osgeo.org please ? What should I do with it? The same you do with postgis_upgrade.sql everytime you do upgrade from one version to another... load it. Would you perform a loop to update the topogeom field, so one entry at once? A loop would indeed be preferrable. I saw a noticable speedup when looping from outside the database. Thanks a lot for your valuable help! Thank you for your feedback, keep me posted ! :) --strk; ,--o-. | __/ |Delivering high quality PostGIS 2.0 ! | / 2.0 |http://strk.keybit.net - http://vizzuality.com `-o--' ___ 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] topology example
Okay, So I am looping over my 25000 pipes and soon as there is a topology error, the UPDATE distribution.pipes SET topogeom = toTopoGeom(wkb_geometry, ''distrib_topo'', layer) WHERE id = pi.id; throws an error: ERROR: SQL/MM Spatial exception - point not on edge I would like to list all the errors by raising the ids, what is the exception to catch? Thanks.. On 02/24/2012 09:23 AM, Sandro Santilli wrote: On Fri, Feb 24, 2012 at 09:20:13AM +0100, Denis Rouzaud wrote: As I have installed from scratch the upgrade files are useless for me, right? Yes. Sorry I assumed you were upgrading. For a new install you just needed to load topology.sql, which you evidently did. --strk; ,--o-. | __/ |Delivering high quality PostGIS 2.0 ! | / 2.0 |http://strk.keybit.net - http://vizzuality.com `-o--' ___ 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] topology example
To be sure, we understand each others, here is the few lines of SQL I am using: https://github.com/3nids/qWat/blob/7bc65b5a43ffb9ae5947ede683ff1f2274807972/sql/topology.sql I know I have errors in topology in my pipes. So, is this correct than I can use toTopoGeom for geometries that have incorrect topology? Or should I check them first? Here is the result of validate topology when a part of my pipes is in the topology column: SELECT topology.ValidateTopology('distrib_topo'); validatetopology --- (face without edges,0,) (1 row) I can dump the db, this will be a few megas, but I would like to be sure I am not doing anything stupid, first On 02/24/2012 12:35 PM, Sandro Santilli wrote: On Fri, Feb 24, 2012 at 12:03:10PM +0100, Denis Rouzaud wrote: Okay, So I am looping over my 25000 pipes and soon as there is a topology error, the UPDATE distribution.pipes SET topogeom = toTopoGeom(wkb_geometry, ''distrib_topo'', layer) WHERE id = pi.id; throws an error: ERROR: SQL/MM Spatial exception - point not on edge Excellent. So a _single_ geometry is enough to reproduce the error. Save both the new geometry (WHERE id = pi.id) and the topology status (dump the schema). If you can, attach the dump and the new input into a ticket. May be worth checking the topology built so far for correctness with ValidateTopology. Any invalidity would be a bug in PostGIS. But not all invalidities are cought by ValidateTopology so there may be a need to do more eyebased checking (linking isn't checked). Usually the invalidity, if any, is within the bounding box of the geometry that fails being installed. I would like to list all the errors by raising the ids, what is the exception to catch? A loop _outside_ the database wouldn't need to catch. If you're looping inside, with pl/pgsql, catch OTHERS. --strk; ,--o-. | __/ |Delivering high quality PostGIS 2.0 ! | / 2.0 |http://strk.keybit.net - http://vizzuality.com `-o--' ___ 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] topology example
Ok, I added ORDER BY https://github.com/3nids/qWat/blob/3c0c6728b940dd4ab2921dee104cd054a711d60f/sql/topology.sql You effectively read correctly that the loop is ended as soon as an exception is raised, since I still didn't manage to do it properly. I filled ticket 1611, http://trac.osgeo.org/postgis/ticket/1612 Sorry, for the lack of info in, but I don't really understand the matter. Also, I noticed something strange. Nothing is filled into the topogeom column. When ordered, first error is raised at id 102, but the first 100 lines have empty topogeom. In the function, if an error is raised nothing is committed? I wrote a small SQL with two geometries where I have the error. https://github.com/3nids/qWat/blob/38cde48d509d9b9a179eea1fd4db5bbd67121dcf/sql/strk.demo.sql I putted a some !!! in front of drop schema to prevent any harm to some of your schemasjust in case! Greetings, Denis On 02/24/2012 02:08 PM, Sandro Santilli wrote: On Fri, Feb 24, 2012 at 01:52:44PM +0100, Denis Rouzaud wrote: To be sure, we understand each others, here is the few lines of SQL I am using: https://github.com/3nids/qWat/blob/7bc65b5a43ffb9ae5947ede683ff1f2274807972/sql/topology.sql It seems good to me. Do I read it correctly that it exits the loop on first error ? May I suggest you ORDER BY id in the loop ? Or the order would not be predictable. I know I have errors in topology in my pipes. So, is this correct than I can use toTopoGeom for geometries that have incorrect topology? Well, they should be fine for the population of primitives, may give problems in the mapping between original features and topology primitives. In any case the exception you got doesn't reveal such problem. Here is the result of validate topology when a part of my pipes is in the topology column: SELECT topology.ValidateTopology('distrib_topo'); validatetopology --- (face without edges,0,) (1 row) Uhm, that's a false positive, I tought I fixed it. Evidently I didn't. Want to file a ticket about it ? I can dump the db, this will be a few megas, but I would like to be sure I am not doing anything stupid, first It would help me as well if you reduce it. The important thing is that insertion of your offending geometry keeps hitting the exception. You could for example try dropping edges and then nodes which do not intersect the offending geometry's bounding box. And see if the problem still occurs. Best to backup the whole set first. --strk; ,--o-. | __/ |Delivering high quality PostGIS 2.0 ! | / 2.0 |http://strk.keybit.net - http://vizzuality.com `-o--' ___ 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
[postgis-users] topology example
Hi all, Is there somewhere on the web a basic tutorial on how to deal with topology? I am looking for a small step-by-step introduction. I looked for a while: chapter 11 of current doc, the wiki, some presentations, strk's blog... Basically I have a table of pipes, and I would like to enable the topology in it... Thanks a lot, Denis ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] topology example
Hi Sandro, Thanks a lot! Can you also give me hint on what to do when I have an error: psql:topology.sql:14: ERROR: SQL/MM Spatial exception - point not on edge Basically, I wanted to create the topology to check it... I think I cannot do anything with validatetopology until toTopoGeom is achieved right? Thanks again!!! On 02/23/2012 11:13 AM, Sandro Santilli wrote: On Thu, Feb 23, 2012 at 10:45:45AM +0100, Denis Rouzaud wrote: Hi all, Is there somewhere on the web a basic tutorial on how to deal with topology? I am looking for a small step-by-step introduction. I looked for a while: chapter 11 of current doc, the wiki, some presentations, strk's blog... Basically I have a table of pipes, and I would like to enable the topology in it... SELECT CreateTopology('pipes_topo', find_srid('public', 'pipes', 'geom)); SELECT AddTopoGeometryColumn('pipes_topo', 'pipes', 'topogeom', 'LINE'); UPDATE pipes SET topogeom = toTopoGeom(geom, 'pipes_topo', 1); Good luck! --strk; ,--o-. | __/ |Delivering high quality PostGIS 2.0 ! | / 2.0 |http://strk.keybit.net - http://vizzuality.com `-o--' ___ 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] topology example
Hi Sandro, Thanks again. I have a fresh installed for 2 days now. Postgis 2.0 a6 (it is a 7 now) Geos 3.3.2 Is this ok? I did not do anything with topology_upgrade.sql, there is nothing written in the installation doc. What should I do with it? Would you perform a loop to update the topogeom field, so one entry at once? Thanks a lot for your valuable help! Greetings Denis On 02/23/2012 11:56 AM, Sandro Santilli wrote: On Thu, Feb 23, 2012 at 11:31:13AM +0100, Denis Rouzaud wrote: Hi Sandro, Thanks a lot! Can you also give me hint on what to do when I have an error: psql:topology.sql:14: ERROR: SQL/MM Spatial exception - point not on edge Upgrade to latest GEOS and PostGIS (don't forget to load the topology_upgrade.sql file!) If the problem persists split your update calls in smaller ranges until you hit the exception. Further reduce the chunk until you get (if ever) to the offending geometry. Note that order in which geometries are added into the topology matters so you may even NOT seeing the problem anymore when changing such order. Basically, I wanted to create the topology to check it... I think I cannot do anything with validatetopology until toTopoGeom is achieved right? Well, ValidateTopology only checks the primitives, not the higher level features. If you know GRASS higher level features validation is the presence polygon-0 and polygon-2 objects. If all you want is primitives validation you could use ST_CreateTopoGeo passing it a collection of all your pipes. --strk; ,--o-. | __/ |Delivering high quality PostGIS 2.0 ! | / 2.0 |http://strk.keybit.net - http://vizzuality.com `-o--' ___ 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
[postgis-users] 2.0alpha6: cannot find xml2-config
Hi all, When I try to compile 2.0, I get this error: configure: error: could not find xml2-config from libxml2 within the current path. You may need to try re-running configure with a --with-xml2config parameter. But I have the libxml2 package installed. If I do: find / -iname *xml2*, I have: /var/lib/dpkg/info/libxml2.shlibs /var/lib/dpkg/info/libxml2.postinst /var/lib/dpkg/info/libxml2.list /var/lib/dpkg/info/libxml2.md5sums /var/lib/dpkg/info/libxml2.symbols /var/lib/dpkg/info/libxml2.postrm /var/cache/apt/archives/libxml2_2.7.8.dfsg-4ubuntu0.1_amd64.deb /usr/lib/libxml2.so.2.7.8 /usr/lib/libxml2.so.2 /usr/share/doc/postgresql-doc-9.1/html/xml2.html /usr/share/doc/libxml2 /usr/share/postgresql/9.1/extension/xml2--unpackaged--1.0.sql /usr/share/postgresql/9.1/extension/xml2--1.0.sql /usr/share/postgresql/9.1/extension/xml2.control any hint on this? Thanks a lot, Denis ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] 2.0alpha6: cannot find xml2-config
And if I do ./configure --with-raster --with-topology --with-gui --with-xml2config=/usr/lib/libxml2.so.2.7.8 , I have: ... Using user-specified xml2-config file: /usr/lib/libxml2.so.2.7.8 ./configure: line 21958: /usr/lib/libxml2.so.2.7.8: Permission denied ./configure: line 21959: /usr/lib/libxml2.so.2.7.8: Permission denied ./configure: line 21961: /usr/lib/libxml2.so.2.7.8: Permission denied checking libxml/tree.h usability... no checking libxml/tree.h presence... no checking for libxml/tree.h... no configure: error: could not find headers include related to libxml2 ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] 2.0alpha6: cannot find xml2-config
solved by installing libxml2-dev sorry! ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] column has pseudo type record
Hi all, I have a table of nodes and I am trying to add a column with the closest node id and distance info. I am trying this by using a function to calculate id and distance and by displaying them in a view: CREATE OR REPLACE FUNCTION closest_node(integer,geometry) RETURNS TABLE (id integer,distance double precision) AS $$ SELECT node_id AS id , MIN(ST_Distance($2,nodes.wkb_geometry)) AS distance FROM nodes WHERE node_id != $1 GROUP BY node_id ;$$ LANGUAGE SQL; CREATE OR REPLACE VIEW nodes_view AS SELECT *, closest_node(node_id,wkb_geometry) FROM pipe_nodes; I get the following error: ERROR: column closest_node has pseudo-type record Can someone explain me why? I had a look at this post http://stackoverflow.com/questions/7097126/including-a-set-of-rows-in-a-view-column and I tried using the type and cast, but I get the same error. Thanks! Denis PS: if someone has a better idea, I'll take it with no shame! ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Query to select features that are parallel and perpendicular
Hi, As Sandro suggested, you can use ST_Azimuth. I tried on myself and came up which a result, there might be a shorter way. First, I created a view with the azimuth: CREATE OR REPLACE VIEW azimuth_view AS SELECT id,ST_Azimuth(ST_PointN(wkb_geometry,1),ST_PointN(wkb_geometry,2))*180/pi() AS azimuth FROM mytable; This supposes you have only 1 segment on each line (of course!) Then, I test the difference between the azimuth and I give all parallels combinations with a given tolerance: CREATE OR REPLACE VIEW parallel_view AS SELECT A1.id, A2.id AS parallel FROM azimuth_view A1, azimuth_view A2 WHERE A1.id != A2.id AND (abs(A1.azimuth-A2.azimuth) = tolerance OR abs(A1.azimuth-A2.azimuth)-360 = tolerance OR abs(A1.azimuth-A2.azimuth)+360 = tolerance ); You can do similar for orthogonal lines then. PS: I tried with modulo but it does not accept double precision, only integer. Depending on wanted tolerance, this might not be enough! Cheers, Denis On 02/06/2012 12:45 PM, Sindile Bidla wrote: Anyone who can offer advice on on building a query to accomplish the following within the same line feature - roads: 1. create a new table or view of all line features that are parallel to a selected line feature within the same line feature 2. create a new table or view of all line features that are perpendicular to a selected line feature within the same line feature ___ 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
[postgis-users] MultiPoint to CircularString to LineString
Hi all, I spend some time to convert a MultiPoint geometry to a circularString then to a LineString (since qgis does not handle circularstring). I achieved this by extracting all coordinates from the MultiPoint, then concatenating them into a CircularString and finally convert it to a Linestring. Here is the sql: SELECT ST_CurveToLine(ST_GeomFromText('CIRCULARSTRING('||left(tsum(ST_X(ST_GeometryN(wkb_geometry,n))||' '||ST_Y(ST_GeometryN(wkb_geometry,n))||','),-1)||')'),12) AS wkb_geometry FROM mytable CROSS JOIN generate_series(1,100) n WHERE n = ST_NumGeometries(wkb_geometry) GROUP BY id; where tsum is an aggregate: CREATE AGGREGATE distribution.tsum ( BASETYPE = text, SFUNC = textcat, STYPE = text, INITCOND = '' ); I use this sql in a view(ie I have my multipoint table, and my linestring view). This apparently works but when I load the layers in qgis I have a postgis error for the view: ERROR: current transaction is aborted, connands ignored until end of transaction block. So, here are my two questions: 1. Does someone know why I have an error in qgis? 2. Does someone have a smarter/better idea to create a curved linestring from a multipoint? The whole SQL code to create table and view is here https://github.com/3nids/qWat/blob/a281ccaccfb0e246d9753f075b1a85f46c4a4eea/sql/dimension.sql Thanks a lot!!! Denis ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] MultiPoint to CircularString to LineString
I could fixed this by using -1 for SRID in the view. It also works by using GeomFromEWKT and setting the correct SRID. Here is the fix https://github.com/3nids/qWat/commit/772bc48b6a98ab7b1228ad18e9537015634cd384 But still, is there a smarter way of interpolating a curve over multipoint and returning a linestring? ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users