Re: [postgis-users] AsKML() how to create kml from postgis data

2007-09-14 Thread Maciej Skorczewski


Hi Jose !

how sql should looks like?

I use PHP. so i want to use it whit PostgreSql...

is there any doc. about this function?


Question about Python class...i am not python programer can you 
describe my how i can use it?


thx :)


Hi,

On 9/14/07, Maciej Skorczewski [EMAIL PROTECTED] wrote:

How should i use AsKML() function to create KML files (w try show
postgis data in google maps nad google earth)


The AsKML() function gives you the geometry in XML format (reprojected
to WGS84, if that's needed). You need to add the other bits to make it
into a full-fledged XML document. For each placemark, you get a
MultiGeometry/Multigeometry bit. You need to add the rest of the
XML, either working through the DOM, or just by creating the XML on
the fly.

I have a python class that we use to produce these maps. It's based on
GDAL/OGR, Matplotlib and so on. It is commented in Spanish, but if
there is demand, I can put it up in the PostGIS wiki page.

Cheers,
Jose
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users




--


Maciej Skórczewski
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] PostGIS on PostgreSQL 8.0

2007-09-14 Thread Håvard Tveite

Paul Ramsey wrote:

How many folks are using the latest PostGIS on PgSQL  8.0?
 From a development point-of-view, the quantity of
backwards-compatibility code is growing and growing, and that makes the
code base a lot less pleasant.

Are there still lots of people using PgSQL  8.0 with the latest PostGIS?


While I can't point to specific people using pgSQL  8.0,
I still think it is too early to require PostgreSQL = 8.
Stability is very important, and there must still be many
organisations using PostgreSQL 7 (and many of them will
most probably not be on the postgis mailing lists...).

If new versions of PostGIS are not going to be pg  8
compatible, I think it is important that the latest
compatible version is maintained as a stable standards
(SQL/MM Spatial, ...) compliant version (bug fixes to ensure
correct operation of all geometry related operators).

PostGIS as a product is not as mature as PostgreSQL, so I
guess many will currently be interested in upgrading
PostGIS more frequently than PostgreSQL.

Håvard Tveite


--
Håvard Tveite
Department of Mathematical Sciences and Technology, UMB
Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY
Phone: +47 64965483 Fax: +47 64965401 http://www.umb.no/imt/
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] question on gist performance

2007-09-14 Thread Mark Cave-Ayland
On Thu, 2007-09-13 at 15:26 +0200, Stefan Zweig wrote:
 Mark,
 
 thank you very much for your response. As far as I understand, pre-computed 
 bounding boxes are stored (by default) to each Geometry object (wherever that 
 is) to make bounding box based queries faster, see
 
 http://main.merlin.com.ua/doc/postgis/docs/ch06.html#hasbbox
 http://main.merlin.com.ua/doc/postgis/docs/ch06.html#addbbox
 
 A full scan wouldn't be necessary if hasbbox(the_geom) returns true, which 
 would make *much* sense here. Obviously this cached information is not 
 evaluated when determining the bounding box while RECHECKing? Is this a bug?

Sure. But the bounding box is stored as part of the heap geometry, so
for every index match PostgreSQL must load the entire geometry into
memory first and decompress it before it can get to the bounding box
info. If you have a geometry with several thousand points, the idea of
the BBOX cache is to ensure that SELECT extent(my_big_geom) returns in a
fixed amount of time, rather than having to linearly scan the entire set
of points within the geometry.

I'm not saying there definitely isn't a bug - did you try removing the
RECHECK clause as per my previous email? If that doesn't solve the
problem then send a test case and I will look into it.

 Mark, I have another question. I want to find out the *fastest* way to 
 retrieve the binary content of Geometry objects to perform conversions later 
 on. I found that SELECT the_geom returns a Geometry object in the hexewkb 
 format and does not require any conversion operations by the database. Now, 
 some questions occurred:
 
 a) Each selected Geometry object seems always to be copied into memory before 
 one can access it, even static object data. Is there any clean way to 
 access the raw data stored in the associated table files?

If you want to delve into PostgreSQL innards, you could open the files
directly and read the contents - but this really isn't recommended for
beginners. Perhaps using a cursor would be useful to you?

 b) hexewkb data must always be converted to bytes first in order to get 
 integers or doubles. Is there any way to store geometric data directly as 
 ewkb or wkb (btw, this would save 50% disc space)?

All geometries are stored internally as binary - they are just converted
to/from HEXEWKB when accepting input from the user or displaying it back
to the user.

 c) double precision is not necessary to store coordinates if you know the 
 SRID and the required accuracy. Is there any way to store geometric data in a 
 format other than double, for example, float or int?

No is the quick answer to this.

 d) How can I find out what disc files belong to a table, and how much disc 
 space a particular table needs?

You'll probably find this reference handy:
http://www.postgresql.org/docs/8.2/interactive/functions-admin.html.


ATB,

Mark.

-- 
ILande - Open Source Consultancy
http://www.ilande.co.uk


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] AsKML() how to create kml from postgis data

2007-09-14 Thread John Smith
as_kml()?! there's another askml() in line with asgml(). why this
alias/name change/confusion?

anyway how does it really work? getting a Must contain
'geometry_column from table_name' or 'geom from (subselect) as foo'
(couldnt find ' from '). what do i do after passing bbox=... and
type=kml to export script? the sql doesn't go inside .map, right? can
some share a detailed use/script? not much in
http://postgis.refractions.net/docs/postgis.pdf

btw super example at
http://casoilresource.lawr.ucdavis.edu/ka-map/htdocs/?map=casoilcps=-2012507.9410234897,-132997.150403761,50layers=__base__
although i didn't quite get this part:
1. select geometry overlapping the bounding box defined by the current
viewport in AEA coordinates, using the PostGIS spatial indexing system
2. compute the intersection between the boinding box and the
overlapping polygons
3. compute the centroids of the new geometry
4. convert the polygon geometry to KML
5. convert the centroid geometry to KML
6. return resulting text
cheers, jzs

On 9/14/07, Jose Gomez-Dans [EMAIL PROTECTED] wrote:
 Hi Maciej,
 I sent you an e-mail, but your spam protection system wouldn't allow
 the message to go through.  If you have another address, I'll resend
 it to you :)

 On 9/14/07, Maciej Skorczewski [EMAIL PROTECTED] wrote:
  how sql should looks like?

 Simply (and this is already quite advanced: you can use simplify() to
 reduce the number of points in your vector data. Ours are very
 detailed, and we don't want that on our KML files):

 SELECT AS_KML(SIMPLIFY(the_geom,100)) from MY_TABLE;

  Question about Python class...i am not python programer can you
  describe my how i can use it?

 You just write a small python program to use it. You should be able to
 do the same with PHP.

 Cheers,
 José
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] question on gist performance

2007-09-14 Thread Paul Ramsey
This isn't a bug per se, because it's doing exactly what we want, 
but I think it's very possible we don't want to do this.


We have so many other checks and balances with regard to SRID coherence 
(in index building, in the table constraints build by the default 
loader, in the geometry comparison functions) that we could drop this 
check for the sake of the extra performance benefit.


And if people use  on geometries of mixed SRID, tough on them.

P

Mark Cave-Ayland wrote:

On Thu, 2007-09-13 at 15:26 +0200, Stefan Zweig wrote:

Mark,

thank you very much for your response. As far as I understand, pre-computed bounding 
boxes are stored (by default) to each Geometry object (wherever that is) to make 
bounding box based queries faster, see

http://main.merlin.com.ua/doc/postgis/docs/ch06.html#hasbbox
http://main.merlin.com.ua/doc/postgis/docs/ch06.html#addbbox

A full scan wouldn't be necessary if hasbbox(the_geom) returns true, which would make 
*much* sense here. Obviously this cached information is not evaluated when determining 
the bounding box while RECHECKing? Is this a bug?


Sure. But the bounding box is stored as part of the heap geometry, so
for every index match PostgreSQL must load the entire geometry into
memory first and decompress it before it can get to the bounding box
info. If you have a geometry with several thousand points, the idea of
the BBOX cache is to ensure that SELECT extent(my_big_geom) returns in a
fixed amount of time, rather than having to linearly scan the entire set
of points within the geometry.

I'm not saying there definitely isn't a bug - did you try removing the
RECHECK clause as per my previous email? If that doesn't solve the
problem then send a test case and I will look into it.


Mark, I have another question. I want to find out the *fastest* way to retrieve 
the binary content of Geometry objects to perform conversions later on. I found 
that SELECT the_geom returns a Geometry object in the hexewkb format and does 
not require any conversion operations by the database. Now, some questions 
occurred:

a) Each selected Geometry object seems always to be copied into memory before one can 
access it, even static object data. Is there any clean way to access the raw 
data stored in the associated table files?


If you want to delve into PostgreSQL innards, you could open the files
directly and read the contents - but this really isn't recommended for
beginners. Perhaps using a cursor would be useful to you?


b) hexewkb data must always be converted to bytes first in order to get 
integers or doubles. Is there any way to store geometric data directly as ewkb 
or wkb (btw, this would save 50% disc space)?


All geometries are stored internally as binary - they are just converted
to/from HEXEWKB when accepting input from the user or displaying it back
to the user.


c) double precision is not necessary to store coordinates if you know the SRID 
and the required accuracy. Is there any way to store geometric data in a format 
other than double, for example, float or int?


No is the quick answer to this.


d) How can I find out what disc files belong to a table, and how much disc 
space a particular table needs?


You'll probably find this reference handy:
http://www.postgresql.org/docs/8.2/interactive/functions-admin.html.


ATB,

Mark.




--

  Paul Ramsey
  Refractions Research
  http://www.refractions.net
  [EMAIL PROTECTED]
  Phone: 250-383-3022
  Cell: 250-885-0632
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Intersection errors out with null directed edge

2007-09-14 Thread Paul Ramsey

Chris,

select uniqid from thetable where not st_isvalid(the_geom);

And if you're feeling lucky (punk), try to fix them with:

update thetable set the_geom = st_buffer(the_geom,0.0) where not 
st_isvalid(the_geom);


Paul

Chris Hermansen wrote:

Hello again;

So with GEOS 3.0.0RC4 the problem now becomes:

TopologyException: EdgeRing::computePoints: found null Directed Edge

I believe there is in fact something wrong with the data.  However the
TopologyException does not identify the source of the problem.

In looking through the mailing list archives, I see questions around
this issue have come up in the past (eg September 2006).  I don't see
anyone suggesting ideas on how to find the offending data elements.

Also, trolling through google doesn't seem to turn up anything.

Does anyone have any ideas on how to explore the data to look for
problems such as this.

Thanks in advance!

On Thu, 2007-13-09 at 11:31 +0200, Andreas Laggner wrote:

Hi Chris,

as i had this errors i installed postgis with GEOS 3.0, and such an 
errors never occurs again! I am not sure, but postgis 1.3.1 can be built 
with GEOS 2.2 too..just run the query select postgis_full_version(); 
and check your version of GEOS.


cheers  Andreas


Chris Hermansen schrieb:

Hi folks;

I had this problem today:

AssertionFailedException: EdgeRing::computePoints: found null Directed
Edge

I see in the archives that there are others who have suffered this, back
in 2006 and then in 2005, but there don't seem to be any offerings of
techniques to either repair the code or the data - and based on the
error above, I'm not sure which is ultimately at fault.

Does anyone have some more up-to-date thought on this?

I'm running postgis-1.3.1 on Ubuntu with the packaged postgresql-8.2
installed.

Thanks in advance!
  





--

  Paul Ramsey
  Refractions Research
  http://www.refractions.net
  [EMAIL PROTECTED]
  Phone: 250-383-3022
  Cell: 250-885-0632
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Intersection errors out with null directed edge

2007-09-14 Thread Martin Davis
Currently your only option is to run isValid on your geometry table.  It 
will identify any geometries which are not valid. 

To see the actual nature and location of the errors you will have to 
export them to another tool (such as JUMP or JTS TestBuilder) to see the 
actual nature  location of the errors (Providing similar functionality 
is on the ToDo list for PostGIS)


Martin


Chris Hermansen wrote:

Hello again;

So with GEOS 3.0.0RC4 the problem now becomes:

TopologyException: EdgeRing::computePoints: found null Directed Edge

I believe there is in fact something wrong with the data.  However the
TopologyException does not identify the source of the problem.

In looking through the mailing list archives, I see questions around
this issue have come up in the past (eg September 2006).  I don't see
anyone suggesting ideas on how to find the offending data elements.

Also, trolling through google doesn't seem to turn up anything.

Does anyone have any ideas on how to explore the data to look for
problems such as this.

Thanks in advance!

On Thu, 2007-13-09 at 11:31 +0200, Andreas Laggner wrote:
  

Hi Chris,

as i had this errors i installed postgis with GEOS 3.0, and such an 
errors never occurs again! I am not sure, but postgis 1.3.1 can be built 
with GEOS 2.2 too..just run the query select postgis_full_version(); 
and check your version of GEOS.


cheers  Andreas


Chris Hermansen schrieb:


Hi folks;

I had this problem today:

AssertionFailedException: EdgeRing::computePoints: found null Directed
Edge

I see in the archives that there are others who have suffered this, back
in 2006 and then in 2005, but there don't seem to be any offerings of
techniques to either repair the code or the data - and based on the
error above, I'm not sure which is ultimately at fault.

Does anyone have some more up-to-date thought on this?

I'm running postgis-1.3.1 on Ubuntu with the packaged postgresql-8.2
installed.

Thanks in advance!
  
  



--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Intersection errors out with null directed edge

2007-09-14 Thread Chris Hermansen
Thanks, Martin, I will give those a try and report back on what I find
out.

On Fri, 2007-14-09 at 10:01 -0700, Martin Davis wrote:
 Currently your only option is to run isValid on your geometry table.  It 
 will identify any geometries which are not valid. 
 
 To see the actual nature and location of the errors you will have to 
 export them to another tool (such as JUMP or JTS TestBuilder) to see the 
 actual nature  location of the errors (Providing similar functionality 
 is on the ToDo list for PostGIS)
 
 Martin
 
 
 Chris Hermansen wrote:
  Hello again;
 
  So with GEOS 3.0.0RC4 the problem now becomes:
 
  TopologyException: EdgeRing::computePoints: found null Directed Edge
 
  I believe there is in fact something wrong with the data.  However the
  TopologyException does not identify the source of the problem.
 
  In looking through the mailing list archives, I see questions around
  this issue have come up in the past (eg September 2006).  I don't see
  anyone suggesting ideas on how to find the offending data elements.
 
  Also, trolling through google doesn't seem to turn up anything.
 
  Does anyone have any ideas on how to explore the data to look for
  problems such as this.
 
  Thanks in advance!
 
  On Thu, 2007-13-09 at 11:31 +0200, Andreas Laggner wrote:

  Hi Chris,
 
  as i had this errors i installed postgis with GEOS 3.0, and such an 
  errors never occurs again! I am not sure, but postgis 1.3.1 can be built 
  with GEOS 2.2 too..just run the query select postgis_full_version(); 
  and check your version of GEOS.
 
  cheers  Andreas
 
 
  Chris Hermansen schrieb:
  
  Hi folks;
 
  I had this problem today:
 
  AssertionFailedException: EdgeRing::computePoints: found null Directed
  Edge
 
  I see in the archives that there are others who have suffered this, back
  in 2006 and then in 2005, but there don't seem to be any offerings of
  techniques to either repair the code or the data - and based on the
  error above, I'm not sure which is ultimately at fault.
 
  Does anyone have some more up-to-date thought on this?
 
  I'm running postgis-1.3.1 on Ubuntu with the packaged postgresql-8.2
  installed.
 
  Thanks in advance!


  
 
-- 
Regards,

Chris Hermansen · mailto:[EMAIL PROTECTED]
tel:+1.604.714.2878 · fax:+1.604.733.0631
Timberline Natural Resource Group · http://www.timberline.ca
401 · 958 West 8th Avenue · Vancouver BC · Canada · V5Z 1E5

C'est ma façon de parler.

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] AsKML() how to create kml from postgis data

2007-09-14 Thread Dylan Beaudette
On Friday 14 September 2007, John Smith wrote:
 as_kml()?! there's another askml() in line with asgml(). why this
 alias/name change/confusion?

 anyway how does it really work? getting a Must contain
 'geometry_column from table_name' or 'geom from (subselect) as foo'
 (couldnt find ' from '). what do i do after passing bbox=... and
 type=kml to export script? the sql doesn't go inside .map, right? can
 some share a detailed use/script? not much in
 http://postgis.refractions.net/docs/postgis.pdf

I'll add a bit to this discussion, as I have tackled it before.

 btw super example at
 http://casoilresource.lawr.ucdavis.edu/ka-map/htdocs/?map=casoilcps=-20125
07.9410234897,-132997.150403761,50layers=__base__ 

Thanks! Here is a shorter link to the corresponding page:
http://casoilresource.lawr.ucdavis.edu/drupal/node/429

although i didn't 
 quite get this part:
 1. select geometry overlapping the bounding box defined by the current
 viewport in AEA coordinates, using the PostGIS spatial indexing system
 2. compute the intersection between the boinding box and the
 overlapping polygons
 3. compute the centroids of the new geometry
 4. convert the polygon geometry to KML
 5. convert the centroid geometry to KML
 6. return resulting text

This is a list of how the PHP code is functioning; some background--

I have a massive table of polygons, stored in a custom AEA projection. Google 
Earth is not happy about massive KML files, so PostGIS is used to 'cut-out' 
(intersection) a chunk. This chunk is then converted into KML, with all of 
the extra XML styling etc. added by a PHP wrapper script. A second pass is 
done with PostGIS to get the centroids of the polygons, which are used as a 
labeling mechanism. All of the KML / XML chunks are stuck into a dynamically 
generated KML document and returned to the user. 

I was able to construct this by
1. looking over the KML specs
2. looking at some example KML files
3. experimentation

Further work should definitely use something other than string functions to 
build the XML.

Another hint: be sure to send the KML header by PHP first:

header(Pragma: public); // required
header(Expires: 0);   
header(Cache-Control: must-revalidate, post-check=0, 
pre-check=0);
header(Content-Type: application/kml; charset=utf8);
header('Content-Disposition: attachment; filename=file.kml') ;


check out the examples on the above link, and dissect the resulting KML file 
for hints.

Cheers,

Dylan





 cheers, jzs

 On 9/14/07, Jose Gomez-Dans [EMAIL PROTECTED] wrote:
  Hi Maciej,
  I sent you an e-mail, but your spam protection system wouldn't allow
  the message to go through.  If you have another address, I'll resend
  it to you :)
 
  On 9/14/07, Maciej Skorczewski [EMAIL PROTECTED] wrote:
   how sql should looks like?
 
  Simply (and this is already quite advanced: you can use simplify() to
  reduce the number of points in your vector data. Ours are very
  detailed, and we don't want that on our KML files):
 
  SELECT AS_KML(SIMPLIFY(the_geom,100)) from MY_TABLE;
 
   Question about Python class...i am not python programer can you
   describe my how i can use it?
 
  You just write a small python program to use it. You should be able to
  do the same with PHP.
 
  Cheers,
  José

 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users



-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] AsKML() how to create kml from postgis data

2007-09-14 Thread Shane Spencer
http://www.bostongis.com/PrinterFriendly.aspx?content_name=ogr_cheatsheet

I use ogr2ogr for doing that..  however sometimes its best to write the KML
using your own structure, descriptions, and element names.

http://www.gdal.org/ogr/drv_kml.html will describe the options that let you
name the KML elements based off of a database fields data.

On 9/14/07, Dylan Beaudette [EMAIL PROTECTED] wrote:

 On Friday 14 September 2007, John Smith wrote:
  as_kml()?! there's another askml() in line with asgml(). why this
  alias/name change/confusion?
 
  anyway how does it really work? getting a Must contain
  'geometry_column from table_name' or 'geom from (subselect) as foo'
  (couldnt find ' from '). what do i do after passing bbox=... and
  type=kml to export script? the sql doesn't go inside .map, right? can
  some share a detailed use/script? not much in
  http://postgis.refractions.net/docs/postgis.pdf

 I'll add a bit to this discussion, as I have tackled it before.

  btw super example at
 
 http://casoilresource.lawr.ucdavis.edu/ka-map/htdocs/?map=casoilcps=-20125
 07.9410234897,-132997.150403761,50layers=__base__

 Thanks! Here is a shorter link to the corresponding page:
 http://casoilresource.lawr.ucdavis.edu/drupal/node/429

 although i didn't
  quite get this part:
  1. select geometry overlapping the bounding box defined by the current
  viewport in AEA coordinates, using the PostGIS spatial indexing system
  2. compute the intersection between the boinding box and the
  overlapping polygons
  3. compute the centroids of the new geometry
  4. convert the polygon geometry to KML
  5. convert the centroid geometry to KML
  6. return resulting text

 This is a list of how the PHP code is functioning; some background--

 I have a massive table of polygons, stored in a custom AEA projection.
 Google
 Earth is not happy about massive KML files, so PostGIS is used to
 'cut-out'
 (intersection) a chunk. This chunk is then converted into KML, with all of
 the extra XML styling etc. added by a PHP wrapper script. A second pass is
 done with PostGIS to get the centroids of the polygons, which are used as
 a
 labeling mechanism. All of the KML / XML chunks are stuck into a
 dynamically
 generated KML document and returned to the user.

 I was able to construct this by
 1. looking over the KML specs
 2. looking at some example KML files
 3. experimentation

 Further work should definitely use something other than string functions
 to
 build the XML.

 Another hint: be sure to send the KML header by PHP first:

 header(Pragma: public); // required
 header(Expires: 0);
 header(Cache-Control: must-revalidate, post-check=0,
 pre-check=0);
 header(Content-Type: application/kml; charset=utf8);
 header('Content-Disposition: attachment; filename=
 file.kml') ;


 check out the examples on the above link, and dissect the resulting KML
 file
 for hints.

 Cheers,

 Dylan





  cheers, jzs
 
  On 9/14/07, Jose Gomez-Dans [EMAIL PROTECTED] wrote:
   Hi Maciej,
   I sent you an e-mail, but your spam protection system wouldn't allow
   the message to go through.  If you have another address, I'll resend
   it to you :)
  
   On 9/14/07, Maciej Skorczewski [EMAIL PROTECTED] wrote:
how sql should looks like?
  
   Simply (and this is already quite advanced: you can use simplify() to
   reduce the number of points in your vector data. Ours are very
   detailed, and we don't want that on our KML files):
  
   SELECT AS_KML(SIMPLIFY(the_geom,100)) from MY_TABLE;
  
Question about Python class...i am not python programer can you
describe my how i can use it?
  
   You just write a small python program to use it. You should be able to
   do the same with PHP.
  
   Cheers,
   José
 
  ___
  postgis-users mailing list
  postgis-users@postgis.refractions.net
  http://postgis.refractions.net/mailman/listinfo/postgis-users



 --
 Dylan Beaudette
 Soils and Biogeochemistry Graduate Group
 University of California at Davis
 530.754.7341
 ___
 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] Intersection errors out with null directed edge

2007-09-14 Thread Chris Hermansen
I used Paul's command and here's an excerpt of what I found:

clh=# select gid from v2007 where not st_isvalid(the_geom);
NOTICE:  Self-intersection at or near point 1.01727e+06 886743
NOTICE:  Self-intersection at or near point 1.06218e+06 960196
NOTICE:  Self-intersection at or near point 1.07742e+06 956155
NOTICE:  Self-intersection at or near point 1.08071e+06 960386
NOTICE:  Ring Self-intersection at or near point 1.08938e+06 959268
...
  gid   

190
  75287
  77089
...
(27 rows)

This is great, super-useful in fact!  Thanks a lot!!!

On Fri, 2007-14-09 at 10:26 -0700, Chris Hermansen wrote:
 Thanks, Martin, I will give those a try and report back on what I find
 out.
 
 On Fri, 2007-14-09 at 10:01 -0700, Martin Davis wrote:
  Currently your only option is to run isValid on your geometry table.  It 
  will identify any geometries which are not valid. 
  
  To see the actual nature and location of the errors you will have to 
  export them to another tool (such as JUMP or JTS TestBuilder) to see the 
  actual nature  location of the errors (Providing similar functionality 
  is on the ToDo list for PostGIS)
  
  Martin
  
  
  Chris Hermansen wrote:
   Hello again;
  
   So with GEOS 3.0.0RC4 the problem now becomes:
  
   TopologyException: EdgeRing::computePoints: found null Directed Edge
  
   I believe there is in fact something wrong with the data.  However the
   TopologyException does not identify the source of the problem.
  
   In looking through the mailing list archives, I see questions around
   this issue have come up in the past (eg September 2006).  I don't see
   anyone suggesting ideas on how to find the offending data elements.
  
   Also, trolling through google doesn't seem to turn up anything.
  
   Does anyone have any ideas on how to explore the data to look for
   problems such as this.
  
   Thanks in advance!
  
   On Thu, 2007-13-09 at 11:31 +0200, Andreas Laggner wrote:
 
   Hi Chris,
  
   as i had this errors i installed postgis with GEOS 3.0, and such an 
   errors never occurs again! I am not sure, but postgis 1.3.1 can be built 
   with GEOS 2.2 too..just run the query select postgis_full_version(); 
   and check your version of GEOS.
  
   cheers  Andreas
  
  
   Chris Hermansen schrieb:
   
   Hi folks;
  
   I had this problem today:
  
   AssertionFailedException: EdgeRing::computePoints: found null Directed
   Edge
  
   I see in the archives that there are others who have suffered this, back
   in 2006 and then in 2005, but there don't seem to be any offerings of
   techniques to either repair the code or the data - and based on the
   error above, I'm not sure which is ultimately at fault.
  
   Does anyone have some more up-to-date thought on this?
  
   I'm running postgis-1.3.1 on Ubuntu with the packaged postgresql-8.2
   installed.
  
   Thanks in advance!
 
 
   
  
-- 
Regards,

Chris Hermansen · mailto:[EMAIL PROTECTED]
tel:+1.604.714.2878 · fax:+1.604.733.0631
Timberline Natural Resource Group · http://www.timberline.ca
401 · 958 West 8th Avenue · Vancouver BC · Canada · V5Z 1E5

C'est ma façon de parler.

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] AsKML() how to create kml from postgis data

2007-09-14 Thread Shane Spencer
Thats so cool it hurts.. I love offloading processing to the big bad server
while the little wimpy sql clients request the data.  Good find!

On 9/14/07, Kevin Neufeld [EMAIL PROTECTED] wrote:

 Absolutely.

 See attached, a simple plpgsql function that adds header info around the
 current askml function.

 I do this in psql:
 -- Set output to unaligned
 \a

 -- Show only tuples
 \t

 -- Dump query to a file
 \o my_kml_file.kml

 -- Run your query
 SELECT askml('my_line', 'description', 'SRID=3005;LINESTRING( 119
 39, 120 39, 120 38, 119 38, 119 39
 )'::geometry);

 -- Flush output your file and close the output stream
 \o

 Loading this file in Google Earth will draw a box around Victoria, BC.

 I often collect() geometries from a table and pass those into this
 function:
 SELECT askml('my_title', 'description', collect(the_geom)) FROM my_line
 table WHERE 

 Cheers,
 Kevin

 -
 Kevin Neufeld
 Software Developer
 Refractions Research Inc.
 300-1207 Douglas St.
 Victoria, B.C., V8W 2E7

 Phone: (250) 383-3022
 Email: [EMAIL PROTECTED]



 Maciej Skorczewski wrote:
  hi all!
 
 
  How should i use AsKML() function to create KML files (w try show
  postgis data in google maps nad google earth)
 
  It is posible?
 
 

 ___
 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