[postgis-users] pgsql2shp - No GID variable

2010-10-26 Thread Andreas Forø Tollefsen
Hi all,

When using the pgsql2shp the gid column is not included.
I even tried typing a select gid AS g_id to include it as a different
column name, but this did not work.

My syntax: pgsql2shp -f pgfinal2008.shp -h localhost -u user -P pass postgis
public.pgfinal2008 SELECT *, gid as g_id FROM pgfinal2008

Any ideas how i manage to extract the gid column from my tables?

Andreas
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] pgsql2shp dbf file encoding

2010-10-26 Thread Mark Cave-Ayland

Denis Rykov wrote:

After editing dbf file in hex editor and set value at byte 29 to 00h 
shapefile opens in ArcGIS without

encoding troubles (get codepage value from *.cpg file).


That's strange. Does anyone know what the behaviour of the 
psDBF-iLanguageDriver field should be in terms of how it reacts with a 
.cpg file? Frank?



ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] pgsql2shp - No GID variable

2010-10-26 Thread Mark Cave-Ayland

Andreas Forø Tollefsen wrote:


Hi all,

When using the pgsql2shp the gid column is not included.
I even tried typing a select gid AS g_id to include it as a different 
column name, but this did not work.


My syntax: pgsql2shp -f pgfinal2008.shp -h localhost -u user -P pass 
postgis public.pgfinal2008 SELECT *, gid as g_id FROM pgfinal2008


Any ideas how i manage to extract the gid column from my tables?


Hi Andreas,

Have you tried looking at the -r option for pgsql2shp?


ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] pgsql2shp - No GID variable

2010-10-26 Thread Andreas Forø Tollefsen
Hi,

I tried that, but at first it did not seem to work when loading the
shapefile into ArcGIS.
However, it seems that i had to restart ArcGIS to make it update the
attribute table for the file.
Now -r works.

Thanks.
Andreas

2010/10/26 Mark Cave-Ayland mark.cave-ayl...@siriusit.co.uk

 Andreas Forø Tollefsen wrote:

  Hi all,

 When using the pgsql2shp the gid column is not included.
 I even tried typing a select gid AS g_id to include it as a different
 column name, but this did not work.

 My syntax: pgsql2shp -f pgfinal2008.shp -h localhost -u user -P pass
 postgis public.pgfinal2008 SELECT *, gid as g_id FROM pgfinal2008

 Any ideas how i manage to extract the gid column from my tables?


 Hi Andreas,

 Have you tried looking at the -r option for pgsql2shp?


 ATB,

 Mark.

 --
 Mark Cave-Ayland - Senior Technical Architect
 PostgreSQL - PostGIS
 Sirius Corporation plc - control through freedom
 http://www.siriusit.co.uk
 t: +44 870 608 0063

 Sirius Labs: http://www.siriusit.co.uk/labs
 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] WKT Raster Error

2010-10-26 Thread Pierre Racine
I already saw the two first lines:

c:\wktraster_pg84\bin\gdal2wktraster.py:645: DeprecationWarning: integer argumen
t expected, got float
  hexstr = binascii.hexlify(struct.pack(fmt_little, data)).upper()

But it didn't not prevent the script to create the sql file properly.

I guess this is related to the Numpy version. Maybe try to use an older version.

It should work with the pipe.

Pierre


From: postgis-users-boun...@postgis.refractions.net 
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Paragon 
Corporation
Sent: 26 octobre 2010 01:38
To: 'PostGIS Users Discussion'
Subject: Re: [postgis-users] WKT Raster Error

Andreas,
Nope haven't seen that error before.

I take it this used to work for you - gdal2wtraster.py.

Which version of gdal are you running under python?

FWIW -- we don't run it like that -- we run with the -o output file swithin. 
I'm not sure the way you are running it works or not

So try
c:\Python25\python c:\wktraster_pg84\bin\gdal2wktraster.py -r 
c:\prio_grid\source\forest\fcworld.img -t forest -s 4326 -I  -o  
C:\prio_grid\source\gpw\forest.sql

and see if you have any better luck.

Alternatively you can try the new postgis raster packaged with PostGIS 2.0 and 
use the gdal2raster.py.  It has some minor fixes in it.

Although its in 2.0, at the moment the rtpostgis*.dll is still a separate 
binary and doesn't YET have any direct dependency on postgis-2.0.dll (and has a 
few more functions that the old wktraster project is missing. So you can grab 
it from there and use with your PostGIS 1.5/1.4  or whatever install.

This MAY CHANGE when PostGIS 2.0 finally comes out.

We'll also be releasing a new windows binaries of PostGIS 2.0 in the next day 
or so.  The dll in that build will change from rtpostgis.dll to 
rtpostgis-2.0.dll, but will still be pretty much the same functionality.


Leo and Regina
http://www.postgis.us


From: postgis-users-boun...@postgis.refractions.net 
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Andreas 
Forø Tollefsen
Sent: Monday, October 25, 2010 8:04 AM
To: PostGIS Users Discussion
Subject: [postgis-users] WKT Raster Error
Anyone familiar with the below error?
I have never experienced it before when importing rasters:

C:\Python25c:\Python25\python c:\wktraster_pg84\bin\gdal2wktraster.py -r c:\pri
o_grid\source\forest\fcworld.img -t forest -s 4326 -I  C:\prio_grid\source\gpw\
forest.sql
c:\wktraster_pg84\bin\gdal2wktraster.py:645: DeprecationWarning: integer argumen
t expected, got float
  hexstr = binascii.hexlify(struct.pack(fmt_little, data)).upper()
Traceback (most recent call last):
  File c:\wktraster_pg84\bin\gdal2wktraster.py, line 1014, in module
main()
  File c:\wktraster_pg84\bin\gdal2wktraster.py, line 977, in main
wkblify_raster(opts, filename, i)
  File c:\wktraster_pg84\bin\gdal2wktraster.py, line 922, in wkblify_raster
summary = wkblify_raster_level(options, ds, options.overview_level, band_ran
ge, infile, i)
  File c:\wktraster_pg84\bin\gdal2wktraster.py, line 889, in wkblify_raster_le
vel
hexwkb += wkblify_band(options, band, level, xoff, yoff, read_block_size, bl
ock_size, infile, b)
  File c:\wktraster_pg84\bin\gdal2wktraster.py, line 778, in wkblify_band
target_block_size[0], target_block_size[1])
  File C:\Python25\Lib\site-packages\osgeo\gdal.py, line 835, in ReadAsArray
buf_xsize, buf_ysize, buf_obj )
  File C:\Python25\Lib\site-packages\osgeo\gdal_array.py, line 138, in BandRea
dAsArray
buf_xsize, buf_ysize, datatype )
  File C:\Python25\Lib\site-packages\osgeo\gdal.py, line 760, in ReadRaster
return _gdal.Band_ReadRaster(*args, **kwargs)
MemoryError
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] Postgres Polygon to Postgis Geometry

2010-10-26 Thread Wagner Santos
Hello,
I'm new with postgis and I have a legacy database with Postgres Polygon, I
want to convert this to a Postgis Geometry. Is there a way?
I try to do with replace string and linefromtext with sucess, but I think
doesn't better solution because I can't set a valid SRID.

Thanks!
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] it would be cool if ST_Force_3DM ST_Force_3DZ could accept a default Z or M value

2010-10-26 Thread Rhys A.D. Stewart
Hey all,

Just a thought, it would be cool if the aforementioned functions could
accept a default value, am having to write a pl/pgsql function to do
this now, but I'm sure a native/C function would be much faster.


Regards,


Rhys
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] it would be cool if ST_Force_3DM ST_Force_3DZ could accept a default Z or M value

2010-10-26 Thread David William Bitner
At least for the Z value you could use st_translate to adjust the value.

On Tue, Oct 26, 2010 at 4:24 PM, Rhys A.D. Stewart
rhys.stew...@gmail.comwrote:

 Hey all,

 Just a thought, it would be cool if the aforementioned functions could
 accept a default value, am having to write a pl/pgsql function to do
 this now, but I'm sure a native/C function would be much faster.


 Regards,


 Rhys
 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users




-- 

David William Bitner
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Postgres Polygon to Postgis Geometry

2010-10-26 Thread Wagner Santos
I created a Postgis Geometry from Postgres Polygon converting them  from
string and using linefromtext to create a geometry but this information
isn't geo.
I have non geo points and I want to convert to my correct position and set
SRID, for example P(70 72) to P(-54 -25), how can I do this?

Thanks!

On Tue, Oct 26, 2010 at 1:18 PM, Wagner Santos wagner.des...@gmail.comwrote:

 Hello,
 I'm new with postgis and I have a legacy database with Postgres Polygon, I
 want to convert this to a Postgis Geometry. Is there a way?
 I try to do with replace string and linefromtext with sucess, but I think
 doesn't better solution because I can't set a valid SRID.

 Thanks!

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Postgres Polygon to Postgis Geometry

2010-10-26 Thread Mike Toews
Hi Wagner,

I'm not sure what you mean by geo and non-geo .. you mean
georeferenced, like longitude/latitude?

For points, you can keep thing binary and just use ST_MakePoint(x,y).
And to assign a coordinate system, use it with ST_SetSRID:

SELECT ST_SetSRID(ST_MakePoint(p[0], p[1]), 4326)
from (
  select point '(-123.112793, 49.246293)' as p
) as foo;

I'm not sure how to do similar binary conversions for path and
polygon, or other types. You might have to cast to text, and wrangle
it into some form of WKT, then pass it to ST_SetSRID(text, integer) to
make a geometry object for PostGIS.

-Mike


On 26 October 2010 18:17, Wagner Santos wagner.des...@gmail.com wrote:
 I created a Postgis Geometry from Postgres Polygon converting them  from
 string and using linefromtext to create a geometry but this information
 isn't geo.
 I have non geo points and I want to convert to my correct position and set
 SRID, for example P(70 72) to P(-54 -25), how can I do this?
 Thanks!

 On Tue, Oct 26, 2010 at 1:18 PM, Wagner Santos wagner.des...@gmail.com
 wrote:

 Hello,
 I'm new with postgis and I have a legacy database with Postgres Polygon, I
 want to convert this to a Postgis Geometry. Is there a way?
 I try to do with replace string and linefromtext with sucess, but I think
 doesn't better solution because I can't set a valid SRID.
 Thanks!

 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Postgres Polygon to Postgis Geometry

2010-10-26 Thread Wagner Santos
Mike,
Yes, I mean georeferenced (sorry for my English). I made a cast to text and
converted to postgis geometry, but I couldn't use ST_SetSRID.
I would like to tranfer a polygon to correct position. I have a
Polygon BOX(743295.3125 7182512.5,744414.75 7183817.5) and I like to
transfer it to BOX(-54.515022277832 -25.4530487060547,-54.5029907226562
-25.4447135925293).
I tried ST_Affine but I don't know the correct parameters, I tried ST_Scale
but I had the same problem. My idea was transform and set srid.


On Tue, Oct 26, 2010 at 11:44 PM, Mike Toews mwto...@gmail.com wrote:

 Hi Wagner,

 I'm not sure what you mean by geo and non-geo .. you mean
 georeferenced, like longitude/latitude?

 For points, you can keep thing binary and just use ST_MakePoint(x,y).
 And to assign a coordinate system, use it with ST_SetSRID:

 SELECT ST_SetSRID(ST_MakePoint(p[0], p[1]), 4326)
 from (
  select point '(-123.112793, 49.246293)' as p
 ) as foo;

 I'm not sure how to do similar binary conversions for path and
 polygon, or other types. You might have to cast to text, and wrangle
 it into some form of WKT, then pass it to ST_SetSRID(text, integer) to
 make a geometry object for PostGIS.

 -Mike


 On 26 October 2010 18:17, Wagner Santos wagner.des...@gmail.com wrote:
  I created a Postgis Geometry from Postgres Polygon converting them  from
  string and using linefromtext to create a geometry but this information
  isn't geo.
  I have non geo points and I want to convert to my correct position and
 set
  SRID, for example P(70 72) to P(-54 -25), how can I do this?
  Thanks!
 
  On Tue, Oct 26, 2010 at 1:18 PM, Wagner Santos wagner.des...@gmail.com
  wrote:
 
  Hello,
  I'm new with postgis and I have a legacy database with Postgres Polygon,
 I
  want to convert this to a Postgis Geometry. Is there a way?
  I try to do with replace string and linefromtext with sucess, but I
 think
  doesn't better solution because I can't set a valid SRID.
  Thanks!
 
  ___
  postgis-users mailing list
  postgis-users@postgis.refractions.net
  http://postgis.refractions.net/mailman/listinfo/postgis-users
 
 
 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Postgres Polygon to Postgis Geometry

2010-10-26 Thread Mike Toews
Ah, you are looking for this:

http://postgis.refractions.net/docs/ST_Transform.html

So you need to cast your object as a polygon, set the SRID to your
projected coordinate system (I'm just guessing SRID=29181 for your
example http://spatialreference.org/ref/epsg/29181/ .. look up the
SRID for your original data). Then it can be transformed into long/lat
coords:

SELECT ST_Transform(ST_SetSRID('BOX(743295.3125 7182512.5,744414.75
7183817.5)'::box2d::geometry, 29181), 4326);

-Mike

On 26 October 2010 20:01, Wagner Santos wagner.des...@gmail.com wrote:
 Mike,
 Yes, I mean georeferenced (sorry for my English). I made a cast to text and
 converted to postgis geometry, but I couldn't use ST_SetSRID.
 I would like to tranfer a polygon to correct position. I have a
 Polygon BOX(743295.3125 7182512.5,744414.75 7183817.5) and I like to
 transfer it to BOX(-54.515022277832 -25.4530487060547,-54.5029907226562
 -25.4447135925293).
 I tried ST_Affine but I don't know the correct parameters, I tried ST_Scale
 but I had the same problem. My idea was transform and set srid.

 On Tue, Oct 26, 2010 at 11:44 PM, Mike Toews mwto...@gmail.com wrote:

 Hi Wagner,

 I'm not sure what you mean by geo and non-geo .. you mean
 georeferenced, like longitude/latitude?

 For points, you can keep thing binary and just use ST_MakePoint(x,y).
 And to assign a coordinate system, use it with ST_SetSRID:

 SELECT ST_SetSRID(ST_MakePoint(p[0], p[1]), 4326)
 from (
  select point '(-123.112793, 49.246293)' as p
 ) as foo;

 I'm not sure how to do similar binary conversions for path and
 polygon, or other types. You might have to cast to text, and wrangle
 it into some form of WKT, then pass it to ST_SetSRID(text, integer) to
 make a geometry object for PostGIS.

 -Mike


 On 26 October 2010 18:17, Wagner Santos wagner.des...@gmail.com wrote:
  I created a Postgis Geometry from Postgres Polygon converting them  from
  string and using linefromtext to create a geometry but this information
  isn't geo.
  I have non geo points and I want to convert to my correct position and
  set
  SRID, for example P(70 72) to P(-54 -25), how can I do this?
  Thanks!
 
  On Tue, Oct 26, 2010 at 1:18 PM, Wagner Santos wagner.des...@gmail.com
  wrote:
 
  Hello,
  I'm new with postgis and I have a legacy database with Postgres
  Polygon, I
  want to convert this to a Postgis Geometry. Is there a way?
  I try to do with replace string and linefromtext with sucess, but I
  think
  doesn't better solution because I can't set a valid SRID.
  Thanks!
 
  ___
  postgis-users mailing list
  postgis-users@postgis.refractions.net
  http://postgis.refractions.net/mailman/listinfo/postgis-users
 
 
 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users


 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users