Re: [OSGeo-Discuss] Command line tool for dissolving polygon boundaries

2011-03-01 Thread Paolo Cavallini
Il giorno mar, 01/03/2011 alle 23.31 -0800, Dan Putler ha scritto: 
> Thanks for your advise.

Glad you liked it. I must add, another advantage is that writing your
script is most easily done through QGIS, where you can test each
individual command, playing with options and parameters, and simply
copying the readymade command line to a text file.

All the best, and let us know how it is going.
-- 
http://www.faunalia.it/pc

___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss


Re: [OSGeo-Discuss] Command line tool for dissolving polygon boundaries

2011-03-01 Thread Dan Putler

Hi Paolo,

Your point is well taken. What seem to be the best solutions involve 
reading in a shapefile and then writing out a new one. I was starting to 
lean toward either PostGIS or Spatialite by using a SQL script sourced 
within the relevant cli shell since my guess was that they would scale 
much better than any Python code I was likely to write. I think I could 
automate things more with GRASS shell scripts than with SQL scripts 
(there are over 3000 counties in the US). The geometry cleaning GRASS 
does is a two edged sword, having all the benefits you indicate, but at 
the cost of increased processing time. However, my guess is that the 
benefits of the cleaning are worth the cost.


Thanks for your advise.

Dan

On 03/01/2011 10:57 PM, Paolo Cavallini wrote:

Il giorno mar, 01/03/2011 alle 23.25 +0100, Paolo Corti ha scritto:

Your only option here could be to use GRASS, but as far as I know you
need to import your shapefile to the GRASS database, use a GRASS
command (v.reclass [0]) and export back to shapefile the result, so it
is not very direct.

Not very direct, but it's only one more command (v.in.ogr), with the
additional bonus that importing into GRASS you can clean up invalid
topologies, close empty gaps, remove unwanted overlaps, etc.
All the best.


___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss


Re: [OSGeo-Discuss] Command line tool for dissolving polygon boundaries

2011-03-01 Thread Paolo Cavallini
Il giorno mar, 01/03/2011 alle 23.25 +0100, Paolo Corti ha scritto: 
> Your only option here could be to use GRASS, but as far as I know you
> need to import your shapefile to the GRASS database, use a GRASS
> command (v.reclass [0]) and export back to shapefile the result, so it
> is not very direct.

Not very direct, but it's only one more command (v.in.ogr), with the
additional bonus that importing into GRASS you can clean up invalid
topologies, close empty gaps, remove unwanted overlaps, etc.
All the best.
-- 
http://www.faunalia.it/pc

___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss


Re: [OSGeo-Discuss] Command line tool for dissolving polygon boundaries

2011-03-01 Thread Dan Putler

Hi Paolo, Simon, and Noli,

Thanks for this. It both answered my question as to whether there was an 
existing command line tool I had just overlooked (the answer is "no"), 
and what were my choices for something that could fairly easily be 
implemented if there wasn't an existing tool (the answer is "several"). 
At this point I'm going to look more deeply into several of these 
recommendations.


Thanks again,

Dan

On 03/01/2011 06:55 PM, Noli Sicad wrote:

Hi Simon,


That sounds great.

I thought I remembered having read somewhere that Spatialite could
accept commands in this way but could not find a link to the webpage
when putting together my reply.

Can you provide a step by step outline of the code necessary to do this?

It is in Spatialite Google Groups, here are the links.

http://groups.google.com/group/spatialite-users/browse_thread/thread/7ecd6ccae76d3495/8683876813398de5?lnk=gst&q=Shapefile+#8683876813398de5

ST_Union
http://groups.google.com/group/spatialite-users/browse_thread/thread/2c8cc54d4b253979/78bc0b7eae6b1c38?lnk=gst&q=GUnion#78bc0b7eae6b1c38


Why is it necessary to create a CSV? Can't Spatialite manipulate
shapefiles directly in a virtual table?

It is needed for matching e.g.

~~
CREATE TABLE workplan AS SELECT * FROM property_mp JOIN planning
ON (property_mp.PR_PROPNUM = planning.PR_PROP_No);
~~
where planning.PR_PROP_No is from CSV table.

You can manipulate Shapefile as Virtual Shapefile. However,  you need
a table for the criteria to be join and dissolve.

It is easier to get the attribute table you need from the shapefile,
if you like. Using MMQGIS plugin in QGIS you can export the attribute
table into CSV file with ease.

Noli
___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss


___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss


Re: [OSGeo-Discuss] Command line tool for dissolving polygon boundaries

2011-03-01 Thread Noli Sicad
Hi Simon,

> That sounds great.
>
> I thought I remembered having read somewhere that Spatialite could
> accept commands in this way but could not find a link to the webpage
> when putting together my reply.
>
> Can you provide a step by step outline of the code necessary to do this?

It is in Spatialite Google Groups, here are the links.

http://groups.google.com/group/spatialite-users/browse_thread/thread/7ecd6ccae76d3495/8683876813398de5?lnk=gst&q=Shapefile+#8683876813398de5

ST_Union
http://groups.google.com/group/spatialite-users/browse_thread/thread/2c8cc54d4b253979/78bc0b7eae6b1c38?lnk=gst&q=GUnion#78bc0b7eae6b1c38

> Why is it necessary to create a CSV? Can't Spatialite manipulate
> shapefiles directly in a virtual table?

It is needed for matching e.g.

~~
CREATE TABLE workplan AS SELECT * FROM property_mp JOIN planning
   ON (property_mp.PR_PROPNUM = planning.PR_PROP_No);
~~
where planning.PR_PROP_No is from CSV table.

You can manipulate Shapefile as Virtual Shapefile. However,  you need
a table for the criteria to be join and dissolve.

It is easier to get the attribute table you need from the shapefile,
if you like. Using MMQGIS plugin in QGIS you can export the attribute
table into CSV file with ease.

Noli
___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss


Re: [OSGeo-Discuss] Command line tool for dissolving polygon boundaries

2011-03-01 Thread Simon Cropper

On 02/03/11 12:41, Noli Sicad wrote:

Dan,

I am using Spatialite CLI for to this job.

1. Import shapefile into Spatialite
2. Create CSV.file for the counties
3. Use Vitual table for counties.csv
4. Use ST_UNION to create a new table with dissolved boundaries
5. Dump the new spatialite table to Shapefile file

Noli


On 3/2/11, Simon Cropper  wrote:

On 02/03/11 08:37, Dan Putler wrote:

All,

Is there a FOSS command line tool that runs under Linux for dissolving
polygon boundaries based on a field in an attribute table that (ideally)
works directly with shapefiles? There are a number of non-cli tools out
there, but I'm working with all US counties on a county by county basis,
and wanted to avoid importing each individual county into another product.

Dan
___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss




Dan,

My understanding is that SAGA can be accessed using the command line.
Check out this page...
http://sourceforge.net/apps/trac/saga-gis/wiki/Executing%20Modules%20with%20SAGA%20CMD

If you intend to create a bash script to dissolve your shapefiles, it
would be just as easy I presume to write a script that opens the
shapefile, dissolves the polygons, then closes it; progressively working
through the list of counties. Remember most packages have the ability to
run script. gvSIG uses Jpython, QGIS python, etc. I fact from what I can
tell you can actually import QGIS modules into python.
http://desktopgisbook.com/Creating_a_Standalone_GIS_Application_1



--
Cheers Simon

 Simon Cropper
 Principal Consultant
 Botanicus Australia Pty Ltd
 PO Box 160, Sunshine, VIC
 W: www.botanicusaustralia.com.au
___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss


___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss



Noli,

That sounds great.

I thought I remembered having read somewhere that Spatialite could 
accept commands in this way but could not find a link to the webpage 
when putting together my reply.


Can you provide a step by step outline of the code necessary to do this?

Why is it necessary to create a CSV? Can't Spatialite manipulate 
shapefiles directly in a virtual table?


--
Cheers Simon

   Simon Cropper
   Principal Consultant
   Botanicus Australia Pty Ltd
   PO Box 160, Sunshine, VIC
   W: www.botanicusaustralia.com.au
___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss


Re: [OSGeo-Discuss] Command line tool for dissolving polygon boundaries

2011-03-01 Thread Noli Sicad
Dan,

I am using Spatialite CLI for to this job.

1. Import shapefile into Spatialite
2. Create CSV.file for the counties
3. Use Vitual table for counties.csv
4. Use ST_UNION to create a new table with dissolved boundaries
5. Dump the new spatialite table to Shapefile file

Noli


On 3/2/11, Simon Cropper  wrote:
> On 02/03/11 08:37, Dan Putler wrote:
>> All,
>>
>> Is there a FOSS command line tool that runs under Linux for dissolving
>> polygon boundaries based on a field in an attribute table that (ideally)
>> works directly with shapefiles? There are a number of non-cli tools out
>> there, but I'm working with all US counties on a county by county basis,
>> and wanted to avoid importing each individual county into another product.
>>
>> Dan
>> ___
>> Discuss mailing list
>> Discuss@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/discuss
>>
>>
>
> Dan,
>
> My understanding is that SAGA can be accessed using the command line.
> Check out this page...
> http://sourceforge.net/apps/trac/saga-gis/wiki/Executing%20Modules%20with%20SAGA%20CMD
>
> If you intend to create a bash script to dissolve your shapefiles, it
> would be just as easy I presume to write a script that opens the
> shapefile, dissolves the polygons, then closes it; progressively working
> through the list of counties. Remember most packages have the ability to
> run script. gvSIG uses Jpython, QGIS python, etc. I fact from what I can
> tell you can actually import QGIS modules into python.
> http://desktopgisbook.com/Creating_a_Standalone_GIS_Application_1
>
>
>
> --
> Cheers Simon
>
> Simon Cropper
> Principal Consultant
> Botanicus Australia Pty Ltd
> PO Box 160, Sunshine, VIC
> W: www.botanicusaustralia.com.au
> ___
> Discuss mailing list
> Discuss@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/discuss
>
___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss


Re: [OSGeo-Discuss] Command line tool for dissolving polygon boundaries

2011-03-01 Thread Simon Cropper

On 02/03/11 08:37, Dan Putler wrote:

All,

Is there a FOSS command line tool that runs under Linux for dissolving
polygon boundaries based on a field in an attribute table that (ideally)
works directly with shapefiles? There are a number of non-cli tools out
there, but I'm working with all US counties on a county by county basis,
and wanted to avoid importing each individual county into another product.

Dan
___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss




Dan,

My understanding is that SAGA can be accessed using the command line. 
Check out this page...

http://sourceforge.net/apps/trac/saga-gis/wiki/Executing%20Modules%20with%20SAGA%20CMD

If you intend to create a bash script to dissolve your shapefiles, it 
would be just as easy I presume to write a script that opens the 
shapefile, dissolves the polygons, then closes it; progressively working 
through the list of counties. Remember most packages have the ability to 
run script. gvSIG uses Jpython, QGIS python, etc. I fact from what I can 
tell you can actually import QGIS modules into python.

http://desktopgisbook.com/Creating_a_Standalone_GIS_Application_1



--
Cheers Simon

   Simon Cropper
   Principal Consultant
   Botanicus Australia Pty Ltd
   PO Box 160, Sunshine, VIC
   W: www.botanicusaustralia.com.au
___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss


Re: [OSGeo-Discuss] Command line tool for dissolving polygon boundaries

2011-03-01 Thread Paolo Corti
> Is there a FOSS command line tool that runs under Linux for dissolving
> polygon boundaries based on a field in an attribute table that (ideally)
> works directly with shapefiles? There are a number of non-cli tools out
> there, but I'm working with all US counties on a county by county basis, and
> wanted to avoid importing each individual county into another product.

Hi Dan

What you need to do could easily be accomplished with GDAL and GEOS
(for example with Python) or GeoTools and JTS (with Java), but as far
as I know you should write yourself a script for performing this
action.
I don't know it there may already be production ready scripts
performing what you need with this technologies.
Your only option here could be to use GRASS, but as far as I know you
need to import your shapefile to the GRASS database, use a GRASS
command (v.reclass [0]) and export back to shapefile the result, so it
is not very direct.

best regards
P

[0] http://grass.fbk.eu/gdp/html_grass64/v.reclass.html


-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @paolo_corti
___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss


[OSGeo-Discuss] Command line tool for dissolving polygon boundaries

2011-03-01 Thread Dan Putler

All,

Is there a FOSS command line tool that runs under Linux for dissolving 
polygon boundaries based on a field in an attribute table that (ideally) 
works directly with shapefiles? There are a number of non-cli tools out 
there, but I'm working with all US counties on a county by county basis, 
and wanted to avoid importing each individual county into another product.


Dan
___
Discuss mailing list
Discuss@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/discuss