[postgis] Arcview script

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[postgis] Arcview script

Ross.Searle
Hi,

We recently had some problematic shapefiles which shp2psql wouldn't
process due to some topology problems in the shapefile. We couldn't
track them down so I ended up writing an avenue script to produce a dump
text file from a shapefile. It is rough and ready but does the job.
shp2psql is much quicker but I thought I'd make it available in case
anyone had a use for it.

Ross

 <<postgis.ave>>


************************************************************************
The information in this e-mail together with any attachments is
intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material.

Any form of review, disclosure, modification, distribution
and/or publication of this e-mail message is prohibited.  

If you have received this message in error, you are asked to
inform the sender as quickly as possible and delete this message
and any copies of this message from your computer and/or your
computer system network.  
************************************************************************


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get your FREE VeriSign guide to security solutions for your web site: encrypting transactions, securing intranets, and more!
http://us.click.yahoo.com/UnN2wB/m5_CAA/yigFAA/PhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[hidden email]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


postgis.ave (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [postgis] Arcview script

Hisaji ONO-3
Hello.

 Thank you very much, Mr. Ross..

Your avenue script has helped me, because shp2pgsql sometimes couldn't
succeed to convert some large size polygon or line shapefiles.

 This scripts works fine, but it seemed not to support multipolygons even
these exist in the choice menu in your script.

 I 've changed the following part in your script to support multipolygons.


for each rec in theftab
  shp = thefTab.ReturnValue(thefTab.FindField("Shape"), rec).aspolygon
  partlist = shp.aspolygon.aslist

  'shpstr = x.setformat("dddddddd").asstring + 9.aschar + thefeat+"((("

  shpstr = x.setformat("dddddddd").asstring + 9.aschar + thefeat+"((" '<---
modified

  for each part in partlist
    ii = 0                      '<--- added
    shpstr = shpstr + "("'<--- added
    'for each p in part
    for each i in 0..(part.count - 2) '<--- modified

      p = part.get(i) '<--- modified
      shpstr = shpstr + p.getX.setformat("d.dddddd").asstring + " " +
p.getY.setformat("d.dddddd").asstring +", "

    end

     p = part.get(part.count - 1) '<--- added
     shpstr = shpstr + p.getX.setformat("d.dddddd").asstring + " " +
p.getY.setformat("d.dddddd").asstring + ")" '<--- added


    ii = ii + 1 '<--- added
    if (ii < partlist.count) then '<--- added
      shpstr = shpstr + "," '<--- added
    end '<--- added

  end

  'polystr = shpstr.left(shpstr.count - 2) + ")))" + 9.aschar
  polystr = shpstr.left(shpstr.count) + "))" + 9.aschar   '<--- modified


 Please tell me if you have any comment about this.

> Hi,
>
> We recently had some problematic shapefiles which shp2psql wouldn't
> process due to some topology problems in the shapefile. We couldn't
> track them down so I ended up writing an avenue script to produce a dump
> text file from a shapefile. It is rough and ready but does the job.
> shp2psql is much quicker but I thought I'd make it available in case
> anyone had a use for it.
>
> Ross
>



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get your FREE VeriSign guide to security solutions for your web site: encrypting transactions, securing intranets, and more!
http://us.click.yahoo.com/UnN2wB/m5_CAA/yigFAA/PhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[hidden email]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



Reply | Threaded
Open this post in threaded view
|

Re: [postgis] Arcview script

Per-Olof Norén
Hisaji,
Could you please run a diff (using "diff -u <from-file> <to-file>") on the
file you changed?

thx in advance
/Per-Olof Norén



----- Original Message -----
From: "Hisaji ONO" <[hidden email]>
To: <[hidden email]>
Cc: <[hidden email]>
Sent: Tuesday, October 02, 2001 2:34 PM
Subject: Re: [postgis] Arcview script


> Hello.
>
>  Thank you very much, Mr. Ross..
>
> Your avenue script has helped me, because shp2pgsql sometimes couldn't
> succeed to convert some large size polygon or line shapefiles.
>
>  This scripts works fine, but it seemed not to support multipolygons even
> these exist in the choice menu in your script.
>
>  I 've changed the following part in your script to support multipolygons.
>
>
> for each rec in theftab
>   shp = thefTab.ReturnValue(thefTab.FindField("Shape"), rec).aspolygon
>   partlist = shp.aspolygon.aslist
>
>   'shpstr = x.setformat("dddddddd").asstring + 9.aschar + thefeat+"((("
>
>   shpstr = x.setformat("dddddddd").asstring + 9.aschar + thefeat+"(("
'<---

> modified
>
>   for each part in partlist
>     ii = 0                      '<--- added
>     shpstr = shpstr + "("'<--- added
>     'for each p in part
>     for each i in 0..(part.count - 2) '<--- modified
>
>       p = part.get(i) '<--- modified
>       shpstr = shpstr + p.getX.setformat("d.dddddd").asstring + " " +
> p.getY.setformat("d.dddddd").asstring +", "
>
>     end
>
>      p = part.get(part.count - 1) '<--- added
>      shpstr = shpstr + p.getX.setformat("d.dddddd").asstring + " " +
> p.getY.setformat("d.dddddd").asstring + ")" '<--- added
>
>
>     ii = ii + 1 '<--- added
>     if (ii < partlist.count) then '<--- added
>       shpstr = shpstr + "," '<--- added
>     end '<--- added
>
>   end
>
>   'polystr = shpstr.left(shpstr.count - 2) + ")))" + 9.aschar
>   polystr = shpstr.left(shpstr.count) + "))" + 9.aschar   '<--- modified
>
>
>  Please tell me if you have any comment about this.
>
> > Hi,
> >
> > We recently had some problematic shapefiles which shp2psql wouldn't
> > process due to some topology problems in the shapefile. We couldn't
> > track them down so I ended up writing an avenue script to produce a dump
> > text file from a shapefile. It is rough and ready but does the job.
> > shp2psql is much quicker but I thought I'd make it available in case
> > anyone had a use for it.
> >
> > Ross
> >
>
>
>
>
> To unsubscribe from this group, send an email to:
> [hidden email]
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get your FREE VeriSign guide to security solutions for your web site: encrypting transactions, securing intranets, and more!
http://us.click.yahoo.com/UnN2wB/m5_CAA/yigFAA/PhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[hidden email]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



Reply | Threaded
Open this post in threaded view
|

Re: [postgis] Arcview script with modified script

Hisaji ONO-3
Hi.

 Sorry, I have no "diff" tool.

So I'll send modified avenue script.

Cheers.

> Hisaji,
> Could you please run a diff (using "diff -u <from-file> <to-file>") on the
> file you changed?
>
> thx in advance
> /Per-Olof Norén
>



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Pinpoint the right security solution for your company- Learn how to add 128- bit encryption and to authenticate your web site with VeriSign's FREE guide!
http://us.click.yahoo.com/yQix2C/33_CAA/yigFAA/PhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[hidden email]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



Reply | Threaded
Open this post in threaded view
|

Re: [postgis] Arcview script

Hisaji ONO-3
In reply to this post by Per-Olof Norén
 Very Sorry.

 I've forgot to attach avenue script.



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Pinpoint the right security solution for your company- Learn how to add 128- bit encryption and to authenticate your web site with VeriSign's FREE guide!
http://us.click.yahoo.com/yQix2C/33_CAA/yigFAA/PhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[hidden email]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


postgis2.ave (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: [postgis] Arcview script

Ross.Searle
In reply to this post by Ross.Searle
Hisaji,

Thanks very much for your help. It was a bit of a major oversite from
me.

Ross

-----Original Message-----
From: Hisaji ONO [mailto:[hidden email]]
Sent: Tuesday, 2 October 2001 11:15 PM
To: [hidden email]
Cc: [hidden email]
Subject: Re: [postgis] Arcview script


 Very Sorry.

 I've forgot to attach avenue script.




To unsubscribe from this group, send an email to:
[hidden email]

 

Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/ 



************************************************************************
The information in this e-mail together with any attachments is
intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material.

Any form of review, disclosure, modification, distribution
and/or publication of this e-mail message is prohibited.  

If you have received this message in error, you are asked to
inform the sender as quickly as possible and delete this message
and any copies of this message from your computer and/or your
computer system network.  
************************************************************************


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Pinpoint the right security solution for your company- Learn how to add 128- bit encryption and to authenticate your web site with VeriSign's FREE guide!
http://us.click.yahoo.com/yQix2C/33_CAA/yigFAA/PhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[hidden email]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/