[mapguide-users] PostGIS selection bug?

Traian Stanev traian.stanev at autodesk.com
Mon Feb 19 13:36:51 EST 2007


Hi, 

If the fid is called "ogc_fid", like in the first example, setting the PGSQL_OGR_FID environment variable will not make a difference for selection, since ogc_fid is the default value.

In the second example, your FID is called "gid" and so you will need to set the PGSQL_OGR_FID variable to gid to make selection work.

Personally I used shp2pgsql to do the import when testing with PostGIS. However, I had a plain ASCII file, while you have a Polish one. You may have better luck asking how to import such a file into PostGIS on a PostGIS mailing list. 


Traian




-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Maciej Skorczewski
Sent: Monday, February 19, 2007 1:19 PM
To: MapGuide Users Mail List
Subject: Re: [mapguide-users] PostGIS selection bug?

hi Mark!

Can you write your ogr2ogr command (or shp2pgsql if you use it) of import shp to postgis?

i use this command:


ogr2ogr -f postgres "PG:dbname=postgis user=postgres password=pass host=localhost port=5432"  osienazwy.shp

this command create a table:

CREATE TABLE osienazwy
(
   ogc_fid serial NOT NULL,
   wkb_geometry geometry,
   id double precision,
   idulicy double precision,
   ulica character(30),
   id1 double precision,
   id2 double precision,
   kier2 character(1),
   length numeric(31,15),
   idodcinka double precision,
   CONSTRAINT osienazwy_pk PRIMARY KEY (ogc_fid),
   CONSTRAINT enforce_dims_wkb_geometry CHECK (ndims(wkb_geometry) = 2),
   CONSTRAINT enforce_geotype_wkb_geometry CHECK
(geometrytype(wkb_geometry) = 'LINESTRING'::text OR wkb_geometry IS NULL),
   CONSTRAINT enforce_srid_wkb_geometry CHECK (srid(wkb_geometry) = -1)
)
WITHOUT OIDS;
ALTER TABLE osienazwy OWNER TO postgres;




!!!BUT!!!

i have problem whit encoding so can't load data form shp - have can i 
use another encoding? (i think that table create is ok.)

i have this error
http://img89.imageshack.us/img89/3579/errorae0.jpg





when i  use shp2pgsql i get another table (whit this same shp file)


CREATE TABLE osienazwy
(
   gid serial NOT NULL,
   id bigint,
   idulicy bigint,
   ulica character varying(30),
   "pełna" character varying(100),
   id1 bigint,
   id2 bigint,
   kier2 boolean,
   length numeric,
   idodcinka bigint,
   the_geom geometry,
   CONSTRAINT osienazwy_pkey PRIMARY KEY (gid),
   CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
   CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 
'MULTILINESTRING'::text OR the_geom IS NULL),
   CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = -1)
)
WITHOUT OIDS;
ALTER TABLE osienazwy OWNER TO postgres;








More information about the mapguide-users mailing list