[postgis-users] forced conversion of linestring to mulitlinestring when using shp2pgsql utility ?
autisi at yahoo.com
Tue Jan 27 23:20:18 PST 2009
The -S option worked very well. But I am still not clear about how to load a shape file that has many linestrings and a few mulitlinestrings. When using the -S option it failed. You mentioned something about exploding multilinestrings into linestrings by dropping the enforce_geom_type constraint on my table. I will like to have more clarification about how this can be done using the shp2pgsql utility.
Also how can I use the ST_Dump utility to do the samething ?
--- On Mon, 1/26/09, Nicolas Ribot <nicky666 at gmail.com> wrote:
> From: Nicolas Ribot <nicky666 at gmail.com>
> Subject: Re: [postgis-users] forced conversion of linestring to mulitlinestring when using shp2pgsql utility ?
> To: autisi at yahoo.com, "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
> Date: Monday, January 26, 2009, 2:09 PM
> > Hi,
> > I have a shape file of linestrings that I want to load
> into postgis as linestrings.
> > My problem is whenever i use the shp2pgsql utility,
> the utility converts all the linestrings
> > to multilinestrings. My purpose of loading the shape
> files is to do geometry operations on them
> > eg line interpolation. This operation can only be done
> on linestring not multilinestrings.
> > Is there a way shp2pgsql can load linestrings to
> postgis as linestrings ? or is there another tool that
> > can do that for me ?
> The -S switch is your friend. it forces simple geometries
> as stated if
> you run shp2pgsql w/o args:
> RCSID: $Id: shp2pgsql.c 2782 2008-05-27 02:59:06Z pramsey $
> RELEASE: 1.3.5
> USAGE: shp2pgsql [<options>] <shapefile>
> -s <srid> Set the SRID field. If not specified it
> defaults to -1.
> (-d|a|c|p) These are mutually exclusive options:
> -d Drops the table, then recreates it and populates
> it with current shape file data.
> -a Appends shape file into current table, must be
> exactly the same table schema.
> -c Creates a new table and populates it, this is the
> default if you do not specify any options.
> -p Prepare mode, only creates the table.
> -g <geometry_column> Specify the name of the
> geometry column
> (mostly useful in append mode).
> -D Use postgresql dump format (defaults to sql insert
> -k Keep postgresql identifiers case.
> -i Use int4 type for all integer dbf fields.
> -I Create a GiST index on the geometry column.
> -S Generate simple geometries instead of MULTI
> -w Use wkt format (for postgis-0.x support - drops M -
> drifts coordinates).
> -W <encoding> Specify the character encoding of
> attribute column. (default : "ASCII")
> -N <policy> Specify NULL geometries handling policy
> -n Only import DBF file.
> -? Display this help screen
> you can also explode multi into simple objects once the
> table is
> loaded, by dropping the enforce_geom_type constraint on
> your table.
More information about the postgis-users