Re: [postgis-users] Reference vrt datasets in postgis raster

2014-07-14 Thread David Haynes
Hello,

You might want to try this projection:
http://spatialreference.org/ref/sr-org/6842/postgis/
This the most accurate projections, despite the description on the spatial
reference site. I am doing related work and found this calculator at the
following url
http://landweb.nascom.nasa.gov/cgi-bin/developer/tilemap.cgi
There is no projection accuracy error when using SRID 6842.



On Fri, Jul 11, 2014 at 9:33 AM, Christian Yrrman yrr...@gmail.com wrote:

 Hi All,


 I'm a newbie to this group, so hello everyone and thanks in advance for
 letting me participate :-)

 After several tests and searching on the net I'm a little stuck with the
 following problem:

 I have downloaded a bunch of MODIS tiles (MOD13A1) from [0] that I want to
 (only) reference in a postgis raster database. These tiles come in hdf
 containers with several layers in it
 .
 - For a start,  I'm only interested in the EVI layer, so I created EVI vrt
 files with command [1]
 - This gives me several EVI*.vrt files referencing EVI with the original
 sinusoidal projection. According to spatialreference.org, the closest SRS
 match is sr-org6974 [2].
 - As this is not in postgis, I've imported this into spatial_ref_sys [3]
 - Next, I'm using the following command to insert the data into raster
 table modistest with the following command:

 for i in `find / -name EVI_origSRS*.vrt`; do
 raster2pgsql -s 96974 -R -F -f rast -a $i modistest;
 done

 where:
 -s 96974 - use the freshly imported MODIS SRS from [2]
   -R  Register the raster as an out-of-db (filesystem) raster.  Provided
   raster should have absolute path to the file
   -F  Add a column with the filename of the raster.
   -f column Specify the name of the raster column
  -a  Appends raster into current table, must be
  exactly the same table schema.

 I've built the index on rast in a separate step (not using switch -I)

 This populates table modistest (using | psql...), so it looks fine.
 However when I want to retrieve data from the raster, e.g. via

 SELECT ST_AsTiff(rast) from public.modistest where id=1158;

 I get an error message like this
 ERROR:  rt_raster_from_gdal_dataset: Unable to get data from transformed
 raster
 CONTEXT:  PL/pgSQL function st_astiff line 20 at RETURN

 and in the postgresql log I get

 ERROR 4:
 `HDF4_EOS:EOS_GRID:MOD13A1.A2012065.h35v10.005.2012082112322.hdf:MODIS_Grid_16DAY_500m_VI:500m
 16 days EVI' does not exist in the file system,
 and is not recognised as a supported dataset name.


 So it looks like the layers were not correctly referenced - however I
 cannot see a mistake. I'm actually using find / -name EVI_origSRS*.vrt
 to get the full path for the loop (not for i in *vrt)


 Any help/advice is highly appreciated! In a next step, I would even like
 to transform the sinusoidal tile afterwards with ST_transform to epsg:4326.
 That would be fantastic, I'd have all tiles in original format in the file
 system and let postgis do all the rest.. :-)



 Thanks in advance and greetings!



 Chris





 [0] MODIS download website
 http://e4ftl01.cr.usgs.gov/MOLT/MOD13A1.005/

 [1] command to create vrt files:
 #!/bin/bash

 for i in *hdf; do
 echo Processing $i
 j=`gdalinfo $i| grep SUBDATASET_2_NAME | cut -d '=' -f 2`
 echo Extracted $j
 gdal_translate -of VRT $j EVI_origSRS_$i.vrt

 done

 [2] SRS projeciton for MODIS
 http://spatialreference.org/ref/sr-org/6974/

 [3] SQL command to insert MODIS SRS

 INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext)
 values ( 96974, 'sr-org', 6974, '+proj=sinu +lon_0=0 +x_0=0 +y_0=0 
 +ellps=WGS84 +datum=WGS84 +units=m +no_defs ',

 'PROJCS[MODIS Sinusoidal,
 GEOGCS[WGS 84,DATUM[WGS_1984,SPHEROID[WGS 
 84,6378137,298.257223563,AUTHORITY[EPSG,7030]],
 AUTHORITY[EPSG,6326]],PRIMEM[Greenwich,0,AUTHORITY[EPSG,8901]],

 UNIT[degree,0.01745329251994328,AUTHORITY[EPSG,9122]],AUTHORITY[EPSG,4326]],
 PROJECTION[Sinusoidal],
 PARAMETER[false_easting,0.0],

 PARAMETER[false_northing,0.0],
 PARAMETER[central_meridian,0.0],
 PARAMETER[semi_major,6371007.181],
 PARAMETER[semi_minor,6371007.181],
 UNIT[m,1.0],AUTHORITY[SR-ORG,6974]]');




 ___
 postgis-users mailing list
 postgis-users@lists.osgeo.org
 http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

[postgis-users] Changing Column data type from WKB to LATLON

2014-07-14 Thread Evan Phillippi
Hello,

I am attempting to store some gps coordinates that i collected for a geospatial 
db in precision ag.  I created a table with a geometry column called 
Coordinates  using the command Coordinates geometry(Point,4326).  I then 
populated the column using the command 
ST_SetSRID(ST_MakePoint(-89.53580,44.12101), 4326));
This populates the coordinate table with a string in WKB.  Is there a way I can 
covert the output values of the entire column from WKB to the raw lat,lon 
values.  I have tried the alter table command    ALTER TABLE CustomersALTER 
COLUMN Coordinates TYPE geometry(St_AsLatLonText), 4326));  but with no luck. 

Im relatively new to sql and postgres,  I would certainly appreciate any help.

Thanks!
Evan___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

[postgis-users] Changing column data type from WKB to lat lon

2014-07-14 Thread evan
Hello,I am attempting to store some gps coordinates that i collected for a geospatial db in precision ag. I created a table with a geometry column called "Coordinates" using the command"Coordinates" geometry(Point,4326). I then populated the column using the commandST_SetSRID(ST_MakePoint(-89.53580,44.12101), 4326));This populates the coordinate table with a string in WKB. Is there a way I can covert the output values of the entire column from WKB to the raw lat,lon values. I have tried the alter table command  ALTER TABLE "Customers"ALTER COLUMN "Coordinates" TYPE geometry(St_AsLatLonText), 4326)); but with no luck.Im relatively new to sql and postgres, I would certainly appreciate any help.Thanks!Evan___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Re: [postgis-users] Changing Column output from WKB to Lat Lon Coordinates

2014-07-14 Thread James David Smith
Google the function st_astext . Should do what you want. Alternatively you
can use st_x and st_y.

Cheers

//JDS
On 14 Jul 2014 22:02, e...@pwwinc.net wrote:

 Hello,

 I am attempting to store some gps coordinates that i collected for a
 geospatial db in precision ag.  I created a table with a geometry column
 called Coordinates  using the command Coordinates
 geometry(Point,4326).  I then populated the column using the
 command ST_SetSRID(ST_MakePoint(-89.53580,44.12101), 4326));
 This populates the coordinate table with a string in WKB.  Is there a way
 I can covert the output values of the entire column from WKB to the raw
 lat,lon values.  I have tried the alter table commandALTER TABLE
 CustomersALTER COLUMN Coordinates TYPE geometry(St_AsLatLonText),
 4326));  but with no luck.

 Im relatively new to sql and postgres,  I would certainly appreciate any
 help.

 Thanks!
 Evan

 ___
 postgis-users mailing list
 postgis-users@lists.osgeo.org
 http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Re: [postgis-users] Changing Column output from WKB to Lat Lon Coordinates

2014-07-14 Thread Mike Toews
There are many geometry output functions [1], such as
ST_AsLatLonText() [2], e.g.:

44°7'15.636N 89°32'8.880W

-Mike

[1] http://postgis.net/docs/reference.html#Geometry_Outputs
[2] http://postgis.net/docs/ST_AsLatLonText.html

On 15 July 2014 07:50,  e...@pwwinc.net wrote:
 Hello,

 I am attempting to store some gps coordinates that i collected for a
 geospatial db in precision ag.  I created a table with a geometry column
 called Coordinates  using the command Coordinates geometry(Point,4326).
 I then populated the column using the command
 ST_SetSRID(ST_MakePoint(-89.53580,44.12101), 4326));
 This populates the coordinate table with a string in WKB.  Is there a way I
 can covert the output values of the entire column from WKB to the raw
 lat,lon values.  I have tried the alter table commandALTER TABLE
 CustomersALTER COLUMN Coordinates TYPE geometry(St_AsLatLonText),
 4326));  but with no luck.

 Im relatively new to sql and postgres,  I would certainly appreciate any
 help.

 Thanks!
 Evan

 ___
 postgis-users mailing list
 postgis-users@lists.osgeo.org
 http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users