Still stuck... [postgis-users] copying ascii to a postgis

Jaime Carrera jaicarrerahdez at yahoo.com
Fri May 20 21:28:26 PDT 2005


Hi Brent,

Thanks for your prompt reply. I did what you said
(which in fact is in the documentation), without
success. Now I'm having the following problem:

1) First I tried with the instructions as displayed in
the PostGIS manual:

MVB=# INSERT INTO municipalities (mun_id, mun_name,
muni_geom) values
(9002,'Azcapotzalco',GeomFromText('POLYGON((477627.7,
2155699.5), (477685.3, 2156036.9), (477793.3,
2156365.3), (477627.7, 2155699.5))', 26714));
ERROR:  parse error - invalid geometry
CONTEXT:  SQL function "geomfromtext" statement 1
----------
It didn't work out... Let's keep on trying:

The PostgreSQL manual shows that a polygon is
specified as:

POLYGON'((x1,y1),(x2,y2),...(xn,yn), (x1,y1))'

So I changed the command to the following: 

MVB=# INSERT INTO municipalities (mun_id, mun_name,
muni_geom) values
(9002,'Azcapotzalco',GeomFromText(POLYGON'((477627.7,
2155699.5), (477685.3, 2156036.9), (477793.3,
2156365.3), (477627.7, 2155699.5))',26714));
ERROR:  function geomfromtext(polygon, integer) does
not exist
HINT:  No function matches the given name and argument
types. You may need to add explicit type casts.
--------------
Ok, the third try should work; the previous attempt
showed that the first argument to the function is
being read as a polygon, however the function is
(text,integer) so I try to delimit the text:

MVB=# INSERT INTO municipalities (mun_id, mun_name,
muni_geom) values
(9002,'Azcapotzalco',GeomFromText('POLYGON'((477627.7,
2155699.5), (477685.3, 2156036.9),
(477793.3, 2156365.3), (477627.7, 2155699.5))'',
26714));
ERROR:  syntax error at or near "(" at character 108
LINE 1: ...values
(9002,'Azcapotzalco',GeomFromText('POLYGON'((477627.7..
                                                      
     

Still stucked... Probably something simple, but I
can't figure it out,

Jaime






--- Brent Wood <pcreso at pcreso.com> escribió:
> 
> HI...
> 
> > I created a table in Postgres and executed
> > the AddGeometryColumn function, using an SRID of
> > 26714. I'm trying to import the ASCII table
> > (geom.postis) with the following command: 
> > MVB=# \copy municipalities from 'geom.postgis'
> with
> > delimiter as ':'
> > And I get: ERROR:  parse error - invalid geometry
> > CONTEXT:  COPY municipalities, line 1, column
> > muni_geom: "'POLYGON(477627.70516
> > 2155699.597396, 477685.323332 2156036.954703,
> > 477793.399583 2156365.341184, 47..."
> 
> Looks like you just did what I did a while back.... 
> 
> the WKT POLYGON coordinate data is in double
> brackets, not single, as the total
> polygon definition comprises an outer ring & also
> zero or more inner rings. The
> inner parentheses separate each ring of the whole
> polygon, the outer
> parentheses contain all the rings. 
> 
> It is in the doc's, pretty obvious in hindsight, but
> I missed it :-)
> 
> Cheers,
>   
>   Brent Wood
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
>
http://postgis.refractions.net/mailman/listinfo/postgis-users
> 

_________________________________________________________
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com



More information about the postgis-users mailing list