[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] export polygon to shapefile problem
From:       Kevin Neufeld <kneufeld () refractions ! net>
Date:       2010-11-17 16:31:34
Message-ID: 4CE40366.5020807 () refractions ! net
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I suspect your merge process worked because you added an attribute 
column (gid) to the exported geometries.

Try adding some attribute on the fly ... something like this:

pgsql2shp -f polys.shp postgis "SELECT null::char AS blank_attr, 
the_geom FROM my_poly_table"

-- Kevin


On 11/17/2010 5:32 AM, Thomas Kouk wrote:
> I left the -a_srs out and I no longer have the usage information, but 
> instead I have an error message:
> ESRI Shapefile driver failed to create file.shp.
> The same happens for other spatial tables as well (not necessarily 
> polygons).
> The table contains only a geometry column. The funny thing is that if 
> I use a script to merge a lot of such tables into one, adding a gid 
> column so that I can distinguish them, using the command I tried in 
> the beginning:
>  pgsql2shp -P [password] -f [shapefile path & name] postgis [tablename]
> works fine! However it would be stupid to create another script to 
> split the data and deal with this in this way.
>

[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    I suspect your merge process worked because you added an attribute
    column (gid) to the exported geometries.  <br>
    <br>
    Try adding some attribute on the fly ... something like this:<br>
    <br>
    pgsql2shp -f polys.shp postgis "SELECT null::char AS blank_attr,
    the_geom FROM my_poly_table"<br>
    <br>
    -- Kevin<br>
    <br>
    <br>
    On 11/17/2010 5:32 AM, Thomas Kouk wrote:
    <blockquote cite="mid:856960.12968.qm@web27805.mail.ukl.yahoo.com"
      type="cite">
      <style type="text/css"><!-- DIV {margin:0px;} --></style>
      <div style="font-family: arial,helvetica,sans-serif; font-size:
        12pt;">
        <div>I left the -a_srs out and I no longer have the usage
          information, but instead I have an error message: </div>
        <div>ESRI Shapefile driver failed to create file.shp. </div>
        <div>The same happens for other spatial tables as well (not
          necessarily polygons).</div>
        <div> </div>
        <div>The table contains only a geometry column. The funny thing
          is that if I use a script to merge a lot of such tables into
          one, adding a gid column so that I can distinguish them, using
          the command I tried in the beginning:</div>
        <div> </div>
        <div> pgsql2shp -P [password] -f [shapefile path &amp; name]
          postgis [tablename]</div>
        <div> </div>
        <div>works fine! However it would be stupid to create another
          script to split the data and deal with this in this way.<br>
        </div>
      </div>
      <br>
    </blockquote>
  </body>
</html>


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic