[postgis-users] Cut off 1-acre of a parcel

John Abraham jabraham at ucalgary.ca
Wed Apr 16 16:17:32 PDT 2008


Thanks Greg Troxel and Regina Obe for the input.

Based on Regina's ideas, I have something working.  Code is attached.  I 
have it working for 2 example parcels, one roughly square and convex, 
the other irregular and non-convex.  Map also attached.

I think I could modify this to take away some larger percentage of land 
on originally larger parcels, to apply a "net land use", to account for 
local roads and such, as Greg suggests.  I could also work from any 
corner or side (instead of the south-west corner), perhaps accounting 
for where the major roads are, as Greg suggests.   (We also have the 
option of telling model users that if there is not enough resolution in 
the model's output for a particular region, they could divide the 
polygon *before* our model runs, to allow other parts of our modelling 
system to take effect.)

I used a "view" for an interim table, instead of just an alias.  Is this 
going to slow things down?  The whole thing is quite slow on my two 
example parcels; I'm not sure how it's going to scale to 139000 parcels 
or 2.5 million parcels.  I'll add some more indices and then try it on 
the 139000 parcel set.

Finally, I don't know how to loop the last bit of code.  I could do it 
in java, python or a DOS Batch file, but if anyone can point me to how 
to do it in SQL, I would be much obliged.  Below are the commands that 
need to be executed in the first 2 runs through the final loop.  I can 
put the numbers "1" and "2" into a table easily enough, but for some 
reason I'm having a mental block about how to nest that into SQL.

UPDATE my_parcel_shards
    SET pseudoParcel = 1
    FROM bestPositionOption b
WHERE my_parcel_shards.parcel_no = b.parcel_no
    AND my_parcel_shards.shard_hpos <= b.shard_hpos
    AND my_parcel_shards.shard_vpos <= b.shard_vpos
    AND pseudoParcel IS NULL;

UPDATE my_parcel_shards
    SET pseudoParcel = 2
    FROM bestPositionOption b
WHERE my_parcel_shards.parcel_no = b.parcel_no
    AND my_parcel_shards.shard_hpos <= b.shard_hpos
    AND my_parcel_shards.shard_vpos <= b.shard_vpos
    AND pseudoParcel IS NULL;

Thanks so much,

--
John Abraham
jabraham at ucalgary.ca
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pseudoparceltest-shorter.sql
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080416/ff0e3b91/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PseudoParcellingExample1.png
Type: image/png
Size: 9784 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080416/ff0e3b91/attachment.png>


More information about the postgis-users mailing list