[postgis-users] shp2pgsql and shx

P Kishor punk.kish at gmail.com
Mon Jan 28 15:55:28 PST 2008


On 1/28/08, Andrea Maschio <andrea.maschio at gmail.com> wrote:
> So the result seems to be actually you can't import Shape files w/out
> their indexes.

Well, no. At least, I didn't say so, and I don't think enough has been
said in this thread to definitively arrive at that conclusion. Only
the creator(s) of shp2pgsql will be definitively able to establish the
above. What we can say definitively is that you *can* read both the
geometry and its corresponding attributes using whatever method as
long as you remember the order of the entries in the respective files.
You just can't do it with a program that uses the SHX as the
cross-reference.

In the meantime, there could be a multitude of reasons by shp2pgsql
can't read your file.

In other words, while we all have learned something new, you are still
at square 1.

:-(

>
> Thanks a lot
>
> Andrea Maschio
>
> Il giorno 29/gen/08, alle ore 00:27, P Kishor ha scritto:
>
> > On 1/28/08, Martin Davis <mbdavis at refractions.net> wrote:
> >> Actually the SHP and DBF files are "linked" simply by the order of
> >> the
> >> records in the files.  So the SHX file isn't needed to read the data.
> >> It is only required if you want to read the data through the index.
> >
> > You are absolutely correct on both counts. I realized my misleading
> > message after I had sent it as I have been happily reading DBF files
> > and modifying them using Perl directly and the parent Shapefile has
> > been ok. Thanks for pointing it out.
> >
> > To the OP -- one of them (between SHP and DBF) is indexed starting at
> > 0 and the other one starting at 1 (I always forget which one is
> > which).
> >
> > Perhaps shp2pgsql does exactly that... read the attributes for each
> > shape via the index.
> >
> >>
> >> P Kishor wrote:
> >>> On 1/28/08, Andrea Maschio <andrea.maschio at gmail.com> wrote:
> >>>
> >>>> Hello all, is it normal that trying to convert a shape into sql
> >>>> with
> >>>> shp2pgsql I have an error stating that i need the .shx index
> >>>> file? Is there
> >>>> an option for importing having only the .shp file?
> >>>>
> >>>> Thanks
> >>>>
> >>>> Andrea Maschio
> >>>>
> >>>>
> >>>
> >>> The .shx file is the link between the geometry (.shp) and the
> >>> attributes (.dbf). These three are the minimum necessary
> >>> components of
> >>> an ESRI Shapefile. If your .shx/.dbf are missing then you have any
> >>> incomplete Shapefile.
> >>> _______________________________________________
> >>> postgis-users mailing list
> >>> postgis-users at postgis.refractions.net
> >>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>>
> >>>
> >>
> >> --
> >> Martin Davis
> >> Senior Technical Architect
> >> Refractions Research, Inc.
> >> (250) 383-3022
> >>
> >>
> >
> >
> > --
> > Puneet Kishor http://punkish.eidesis.org/
> > Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
> > Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/



More information about the postgis-users mailing list