[postgis-users] calculating area
Hello, How do we calculate the area (polygon) in country ( Turkey) level ? Which one does give better result ? transforming to UTM or using geography ? regards -- Ahmet Temiz Jeoloji Müh. Afet ve Acil Durum Yönetimi Başkanlığı Planlama ve Zarar Azaltma Dairesi Başkanlığı Ahmet Temiz Geological Eng. Information Systems - GIS Group Disaster and Emergency Management of Presidency ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] calculating area
Hi, I think you always have to transforme to UTM to have area in square meters. Best Regards, 2015-02-25 9:10 GMT-03:00 Ahmet Temiz ahmettemi...@gmail.com: Hello, How do we calculate the area (polygon) in country ( Turkey) level ? Which one does give better result ? transforming to UTM or using geography ? regards -- Ahmet Temiz Jeoloji Müh. Afet ve Acil Durum Yönetimi Başkanlığı Planlama ve Zarar Azaltma Dairesi Başkanlığı Ahmet Temiz Geological Eng. Information Systems - GIS Group Disaster and Emergency Management of Presidency ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users -- Rogério De Pieri (Lelo) MBA em Gerenciamento de Projetos - FGV SCJP 5 Buscando melhorar a cada dia Áudio, Hardware Software www.twitter.com/lelopieri blogdolelo.wordpress.com ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
[postgis-users] TopologyException: geom is invalid
Hello,I have a perl script which uses a geoJSON as input, and queries a table to see if any polygons exist in the table with any points in common. If any matches are found, they are returned as geoJSON. It's been working great, but yesterday I got an error. Here's my query: select ST_Asgeojson( geom ) from dynamic.polys where ST_Intersects(ST_GeomFromGeoJSON('$jsonPoly'), geom)=TRUE and ST_Area(ST_Intersection(ST_GeomFromGeoJSON('$jsonPoly')::geography, geom::geography))500 With my current issue, the $jsonPoly is the state of Californina. The select from dynamic.polys should return any polys in my database which have any points in common with California. However, yesterday I had a query which resulted in the following error: DBD::Pg::st execute failed: ERROR: Error performing intersection: TopologyException: Input geom 1 is invalid: Self-intersection at or near point -381688.06935935974 -1206669.4272876547 at -381688.06935935974 -1206669.4272876547 at ./test.pl line 151. DBD::Pg::st execute failed: ERROR: Error performing intersection: TopologyException: Input geom 1 is invalid: Self-intersection at or near point -381688.06935935974 -1206669.4272876547 at -381688.06935935974 -1206669.4272876547 at ./test.pl line 151. ( line 151 is the perl code: $sth-execute(); ) I isolated which JSON poly was causing the issue, and saved it here: http://microflush.org/stuff/json/nwsZone.json I verified the geoJSON, and verified it plots entirely within California using http://geojsonlint.com/ The state of Californina, which I got from NWS, can be found here: http://microflush.org/stuff/json/CA.json Can anyone see why this one nwsZone.json polygon is returning the error? Any help would be great. Thanks! Regards,Joseph Spenner ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] POSTGIS_ENABLE_OUTDB_RASTERS=1: PostGIS won't start (RHEL 6.5)
The env variables need to be within the environment of the postgres process. How are you starting postgres? Shell script? Then you should be able to add the variables to that script. Direct invocation of posrgres on the command line? You need to have the variables before the command VAR=1 postgres ... -bborie On Feb 25, 2015 11:40 AM, Phil Hurvitz phurv...@uw.edu wrote: Thanks Bborie, I built from the tarball rather than using an rpm; does that still mean I should be adding the environment variables to /etc/sysconfig/pgsql/postgresql So for overkill I added the env vars to that file as well as to the init script, restarted PostgreSQL, and it seems I still cannot access the out-db raster. I added a slope raster using: raster2pgsql -I -C -e -Y -F -d -R -s 2926 ./slope/slope_ps.tif gis.slope | psql osm_test I can get metadata (sorry for the ugly text wrapping): select rid, (foo.md).* from (select rid, st_Metadata(rast) as md from slope) as foo; rid |upperleftx|upperlefty| width | height | scalex | scaley | skewx | skewy | srid | numbands -+--+--+---+ +--+---+---+---+--+-- 1 | 835161.301005914 | 758483.868026069 | 31935 | 34649 | 32.80833 | -32.80833 | 0 | 0 | 2926 |1 But cannot access values: select st_summarystats(rast) from slope; ERROR: rt_raster_load_offline_data: Access to offline bands disabled CONTEXT: SQL function st_summarystats statement 1 select st_value(rast, 1, 1, 1) from slope; ERROR: rt_raster_load_offline_data: Access to offline bands disabled -P. ** Philip M. Hurvitz, PhD | Research Assistant Professor | UW-CBE Urban Form Lab | 1107 NE 45th Street, Suite 535 | Box 354802 University of Washington, Seattle, Washington 98195-4802, USA phurv...@u.washington.edu | http://gis.washington.edu/phurvitz What is essential is invisible to the eye. -de Saint-Exupéry ** Bborie Park dustym...@gmail.com Wed Feb 25 10:46:59 PST 2015 Philip, POSTGIS_ENABLE_OUTDB_RASTERS=1 is an environment variable not to be in postgresql.conf. The same is true for POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL https://wiki.postgresql.org/wiki/PostgreSQL_on_RedHat_Linux Based upon the above, it looks like you should add POSTGIS_ENABLE_OUTDB_RASTERS=1 POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL to /etc/sysconfig/pgsql/postgresql The above assumes you're using the packages provided by PostgreSQL. http://www.postgresql.org/download/linux/redhat/ -bborie On 2/25/2015 10:10, Phil Hurvitz wrote: Hi all, I am having trouble starting PostGIS with out-db raster support In my /usr/local/pgsql/data/postgresql.conf file I include the line POSTGIS_ENABLE_OUTDB_RASTERS=1 after which PostGIS won't start (service postgresql start). Software is postgis_full_version --- POSTGIS=2.1.3 r12547 GEOS=3.4.2-CAPI-1.8.2 r3921 PROJ=Rel. 4.7.1, 23 September 2009 GDAL=GDAL 1.11.2, released 2015/02/10 LIBXML=2.7.6 TOPOLOGY RASTER Also PostGIS won't start when I specify POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL Any help would be appreciated! ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] POSTGIS_ENABLE_OUTDB_RASTERS=1: PostGIS won't start (RHEL 6.5)
Thanks Bborie, I am starting with a shell script, and have added the env vars to that script, but am still unable to access the out-db rasters. -P. ** Philip M. Hurvitz, PhD | Research Assistant Professor | UW-CBE Urban Form Lab | 1107 NE 45th Street, Suite 535 | Box 354802 University of Washington, Seattle, Washington 98195-4802, USA phurv...@u.washington.edu | http://gis.washington.edu/phurvitz What is essential is invisible to the eye. -de Saint-Exupéry ** On 2/25/2015 11:45, Bborie Park wrote: The env variables need to be within the environment of the postgres process. How are you starting postgres? Shell script? Then you should be able to add the variables to that script. Direct invocation of posrgres on the command line? You need to have the variables before the command VAR=1 postgres ... -bborie On Feb 25, 2015 11:40 AM, Phil Hurvitz phurv...@uw.edu mailto:phurv...@uw.edu wrote: Thanks Bborie, I built from the tarball rather than using an rpm; does that still mean I should be adding the environment variables to /etc/sysconfig/pgsql/__postgresql So for overkill I added the env vars to that file as well as to the init script, restarted PostgreSQL, and it seems I still cannot access the out-db raster. I added a slope raster using: raster2pgsql -I -C -e -Y -F -d -R -s 2926 ./slope/slope_ps.tif gis.slope | psql osm_test I can get metadata (sorry for the ugly text wrapping): select rid, (foo.md http://foo.md).* from (select rid, st_Metadata(rast) as md from slope) as foo; rid |upperleftx|upperlefty| width | height | scalex | scaley | skewx | skewy | srid | numbands -+--+-__-+---+__+--+--__-+---+---+__--+-- 1 | 835161.301005914 | 758483.868026069 | 31935 | 34649 | 32.80833 | -32.80833 | 0 | 0 | 2926 |1 But cannot access values: select st_summarystats(rast) from slope; ERROR: rt_raster_load_offline_data: Access to offline bands disabled CONTEXT: SQL function st_summarystats statement 1 select st_value(rast, 1, 1, 1) from slope; ERROR: rt_raster_load_offline_data: Access to offline bands disabled -P. **__**__** Philip M. Hurvitz, PhD | Research Assistant Professor | UW-CBE Urban Form Lab | 1107 NE 45th Street, Suite 535 | Box 354802 University of Washington, Seattle, Washington 98195-4802, USA phurv...@u.washington.edu mailto:phurv...@u.washington.edu | http://gis.washington.edu/__phurvitz http://gis.washington.edu/phurvitz What is essential is invisible to the eye. -de Saint-Exupéry **__**__** Bborie Park dustym...@gmail.com mailto:dustym...@gmail.com Wed Feb 25 10:46:59 PST 2015 Philip, POSTGIS_ENABLE_OUTDB_RASTERS=1 is an environment variable not to be in postgresql.conf. The same is true for POSTGIS_GDAL_ENABLED_DRIVERS=__ENABLE_ALL https://wiki.postgresql.org/__wiki/PostgreSQL_on_RedHat___Linux https://wiki.postgresql.org/wiki/PostgreSQL_on_RedHat_Linux Based upon the above, it looks like you should add POSTGIS_ENABLE_OUTDB_RASTERS=1 POSTGIS_GDAL_ENABLED_DRIVERS=__ENABLE_ALL to /etc/sysconfig/pgsql/__postgresql The above assumes you're using the packages provided by PostgreSQL. http://www.postgresql.org/__download/linux/redhat/ http://www.postgresql.org/download/linux/redhat/ -bborie On 2/25/2015 10:10, Phil Hurvitz wrote: Hi all, I am having trouble starting PostGIS with out-db raster support In my /usr/local/pgsql/data/__postgresql.conf file I include the line POSTGIS_ENABLE_OUTDB_RASTERS=1 after which PostGIS won't start (service postgresql start). Software is postgis_full_version --__--__--- POSTGIS=2.1.3 r12547 GEOS=3.4.2-CAPI-1.8.2 r3921 PROJ=Rel. 4.7.1, 23 September 2009 GDAL=GDAL 1.11.2, released 2015/02/10 LIBXML=2.7.6 TOPOLOGY RASTER Also PostGIS won't start when I specify POSTGIS_GDAL_ENABLED_DRIVERS=__ENABLE_ALL Any help would be appreciated! ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
[postgis-users] POSTGIS_ENABLE_OUTDB_RASTERS=1: PostGIS won't start (RHEL 6.5)
Thanks Bborie, I built from the tarball rather than using an rpm; does that still mean I should be adding the environment variables to /etc/sysconfig/pgsql/postgresql So for overkill I added the env vars to that file as well as to the init script, restarted PostgreSQL, and it seems I still cannot access the out-db raster. I added a slope raster using: raster2pgsql -I -C -e -Y -F -d -R -s 2926 ./slope/slope_ps.tif gis.slope | psql osm_test I can get metadata (sorry for the ugly text wrapping): select rid, (foo.md).* from (select rid, st_Metadata(rast) as md from slope) as foo; rid |upperleftx|upperlefty| width | height | scalex | scaley | skewx | skewy | srid | numbands -+--+--+---++--+---+---+---+--+-- 1 | 835161.301005914 | 758483.868026069 | 31935 | 34649 | 32.80833 | -32.80833 | 0 | 0 | 2926 |1 But cannot access values: select st_summarystats(rast) from slope; ERROR: rt_raster_load_offline_data: Access to offline bands disabled CONTEXT: SQL function st_summarystats statement 1 select st_value(rast, 1, 1, 1) from slope; ERROR: rt_raster_load_offline_data: Access to offline bands disabled -P. ** Philip M. Hurvitz, PhD | Research Assistant Professor | UW-CBE Urban Form Lab | 1107 NE 45th Street, Suite 535 | Box 354802 University of Washington, Seattle, Washington 98195-4802, USA phurv...@u.washington.edu | http://gis.washington.edu/phurvitz What is essential is invisible to the eye. -de Saint-Exupéry ** Bborie Park dustym...@gmail.com Wed Feb 25 10:46:59 PST 2015 Philip, POSTGIS_ENABLE_OUTDB_RASTERS=1 is an environment variable not to be in postgresql.conf. The same is true for POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL https://wiki.postgresql.org/wiki/PostgreSQL_on_RedHat_Linux Based upon the above, it looks like you should add POSTGIS_ENABLE_OUTDB_RASTERS=1 POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL to /etc/sysconfig/pgsql/postgresql The above assumes you're using the packages provided by PostgreSQL. http://www.postgresql.org/download/linux/redhat/ -bborie On 2/25/2015 10:10, Phil Hurvitz wrote: Hi all, I am having trouble starting PostGIS with out-db raster support In my /usr/local/pgsql/data/postgresql.conf file I include the line POSTGIS_ENABLE_OUTDB_RASTERS=1 after which PostGIS won't start (service postgresql start). Software is postgis_full_version --- POSTGIS=2.1.3 r12547 GEOS=3.4.2-CAPI-1.8.2 r3921 PROJ=Rel. 4.7.1, 23 September 2009 GDAL=GDAL 1.11.2, released 2015/02/10 LIBXML=2.7.6 TOPOLOGY RASTER Also PostGIS won't start when I specify POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL Any help would be appreciated! ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] POSTGIS_ENABLE_OUTDB_RASTERS=1: PostGIS won't start (RHEL 6.5)
Philip, POSTGIS_ENABLE_OUTDB_RASTERS=1 is an environment variable not to be in postgresql.conf. The same is true for POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL https://wiki.postgresql.org/wiki/PostgreSQL_on_RedHat_Linux Based upon the above, it looks like you should add POSTGIS_ENABLE_OUTDB_RASTERS=1 POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL to /etc/sysconfig/pgsql/postgresql The above assumes you're using the packages provided by PostgreSQL. http://www.postgresql.org/download/linux/redhat/ -bborie On Wed, Feb 25, 2015 at 10:10 AM, Phil Hurvitz phurv...@uw.edu wrote: Hi all, I am having trouble starting PostGIS with out-db raster support In my /usr/local/pgsql/data/postgresql.conf file I include the line POSTGIS_ENABLE_OUTDB_RASTERS=1 after which PostGIS won't start (service postgresql start). Software is postgis_full_version --- POSTGIS=2.1.3 r12547 GEOS=3.4.2-CAPI-1.8.2 r3921 PROJ=Rel. 4.7.1, 23 September 2009 GDAL=GDAL 1.11.2, released 2015/02/10 LIBXML=2.7.6 TOPOLOGY RASTER Also PostGIS won't start when I specify POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL Any help would be appreciated! -- -P. ** Philip M. Hurvitz, PhD | Research Assistant Professor | UW-CBE Urban Form Lab | 1107 NE 45th Street, Suite 535 | Box 354802 University of Washington, Seattle, Washington 98195-4802, USA phurv...@u.washington.edu | http://gis.washington.edu/phurvitz What is essential is invisible to the eye. -de Saint-Exupéry ** ___ 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] calculating area
There are many ways to determine area in PostGIS, but I will simplify this to 3 groups. 1 consider the earth as an ellipsoid, where the radius changes, 2 consider the world to a perfect sphere, 3 your area is small enough to fit in a defined equal area projection. For work, I have generated a number of area datasets for country boundries using the functions in PostGIS. You will notice that the 3rd function uses a global equal area projection. They are all different and in someways they are all accurate. The first function uses a mathematical model that tries to model the earth and takes a bit longer. The second uses a sphere and is the fastest, while the third flattens the earth and its accuracy is based on the projection. 1) Spherical Area ST_Area(p.geog, false) as ellipsoid / spheroid The current World Geodetic System http://en.wikipedia.org/wiki/World_Geodetic_System model uses a spheroid whose radius is 6,378.137 km at the equator http://en.wikipedia.org/wiki/Equator and 6,356.752 km at the poles http://en.wikipedia.org/wiki/Geographical_pole. 2) Spheroid AREA ST_Area(p.geog) as sphere, 3) Projected Area ST_Area(ST_Transform(p.geog::geometry,3410)) proj_area In general, I would recommend the function 1 as an accurate calculation. I have document of country areas I can share with you if you like. It shows a collection of country polygons that have the area determined using all three different methods. In this document, I am assuming that spheroid will be the truth. The interesting thing is that there are major differences based on the latitude. The area of a geography goes from over to under projection at the 35 degree. This is due to shrinking and expansion of the ellipsoid and equal area projection. On Wed, Feb 25, 2015 at 6:53 AM, Lelo - Luiz Rogério De Pieri lelo.pi...@gmail.com wrote: Hi, I think you always have to transforme to UTM to have area in square meters. Best Regards, 2015-02-25 9:10 GMT-03:00 Ahmet Temiz ahmettemi...@gmail.com: Hello, How do we calculate the area (polygon) in country ( Turkey) level ? Which one does give better result ? transforming to UTM or using geography ? regards -- Ahmet Temiz Jeoloji Müh. Afet ve Acil Durum Yönetimi Başkanlığı Planlama ve Zarar Azaltma Dairesi Başkanlığı Ahmet Temiz Geological Eng. Information Systems - GIS Group Disaster and Emergency Management of Presidency ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users -- Rogério De Pieri (Lelo) MBA em Gerenciamento de Projetos - FGV SCJP 5 Buscando melhorar a cada dia Áudio, Hardware Software www.twitter.com/lelopieri blogdolelo.wordpress.com ___ 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] POSTGIS_ENABLE_OUTDB_RASTERS=1: PostGIS won't start (RHEL 6.5)
Hi all, I am having trouble starting PostGIS with out-db raster support In my /usr/local/pgsql/data/postgresql.conf file I include the line POSTGIS_ENABLE_OUTDB_RASTERS=1 after which PostGIS won't start (service postgresql start). Software is postgis_full_version --- POSTGIS=2.1.3 r12547 GEOS=3.4.2-CAPI-1.8.2 r3921 PROJ=Rel. 4.7.1, 23 September 2009 GDAL=GDAL 1.11.2, released 2015/02/10 LIBXML=2.7.6 TOPOLOGY RASTER Also PostGIS won't start when I specify POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL Any help would be appreciated! -- -P. ** Philip M. Hurvitz, PhD | Research Assistant Professor | UW-CBE Urban Form Lab | 1107 NE 45th Street, Suite 535 | Box 354802 University of Washington, Seattle, Washington 98195-4802, USA phurv...@u.washington.edu | http://gis.washington.edu/phurvitz What is essential is invisible to the eye. -de Saint-Exupéry ** ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] POSTGIS_ENABLE_OUTDB_RASTERS=1: PostGIS won't start (RHEL 6.5)
Thank you, Bborie. This seems to be a partial solution (at least now PostGIS isn't complaining about the out-db raster). But now I get a different problem, which is that attempting to access the out-db raster makes the connection choke: select st_summarystats(rast) from slope; The connection to the server was lost. Attempting reset: Failed. ! -P. ** Philip M. Hurvitz, PhD | Research Assistant Professor | UW-CBE Urban Form Lab | 1107 NE 45th Street, Suite 535 | Box 354802 University of Washington, Seattle, Washington 98195-4802, USA phurv...@u.washington.edu | http://gis.washington.edu/phurvitz What is essential is invisible to the eye. -de Saint-Exupéry ** On 2/25/2015 12:41, Bborie Park wrote: Ah. I use a script similar to this. In the following block... start) ... su - $PGUSER -c $DAEMON -D '$PGDATA' $PGLOG 21 ... You'll want to modify the su line to be like: su - $PGUSER -c POSTGIS_ENABLE_OUTDB_RASTERS=1 POSTGIS_GDAL_ENABLED_DRIVERS=__ENABLE_ALL $DAEMON -D '$PGDATA' $PGLOG 21 See if that works... -bborie On Wed, Feb 25, 2015 at 12:29 PM, Phil Hurvitz phurv...@uw.edu mailto:phurv...@uw.edu wrote: Certainly! ! /bin/sh # chkconfig: 2345 98 02 # description: PostgreSQL RDBMS # This is an example of a start/stop script for SysV-style init, such # as is used on Linux systems. You should edit some of the variables # and maybe the 'echo' commands. # # Place this file at /etc/init.d/postgresql (or # /etc/rc.d/init.d/postgresql) and make symlinks to # /etc/rc.d/rc0.d/K02postgresql # /etc/rc.d/rc1.d/K02postgresql # /etc/rc.d/rc2.d/K02postgresql # /etc/rc.d/rc3.d/S98postgresql # /etc/rc.d/rc4.d/S98postgresql # /etc/rc.d/rc5.d/S98postgresql # Or, if you have chkconfig, simply: # chkconfig --add postgresql # # Proper init scripts on Linux systems normally require setting lock # and pid files under /var/run as well as reacting to network # settings, so you should treat this with care. # Original author: Ryan Kirkpatrick pg...@rkirkpat.net mailto:pg...@rkirkpat.net # contrib/start-scripts/linux ## EDIT FROM HERE # Installation prefix prefix=/usr/local/pgsql # Data directory PGDATA=/usr/local/pgsql/data POSTGIS_GDAL_ENABLED_DRIVERS=__ENABLE_ALL # Who to run the postmaster as, usually postgres. (NOT root) PGUSER=postgres # Where to keep a log file PGLOG=$PGDATA/serverlog # It's often a good idea to protect the postmaster from being killed by the # OOM killer (which will tend to preferentially kill the postmaster because # of the way it accounts for shared memory). Setting the OOM_SCORE_ADJ value # to -1000 will disable OOM kill altogether. If you enable this, you probably # want to compile PostgreSQL with -DLINUX_OOM_SCORE_ADJ=0, so that # individual backends can still be killed by the OOM killer. #OOM_SCORE_ADJ=-1000 # Older Linux kernels may not have /proc/self/oom_score_adj, but instead # /proc/self/oom_adj, which works similarly except the disable value is -17. # For such a system, enable this and compile with -DLINUX_OOM_ADJ=0. #OOM_ADJ=-17 POSTGIS_ENABLE_OUTDB_RASTERS=1 POSTGIS_GDAL_ENABLED_DRIVERS=__ENABLE_ALL ## STOP EDITING HERE # The path that is to be used for the script PATH=/usr/local/sbin:/usr/__local/bin:/sbin:/bin:/usr/__sbin:/usr/bin # What to use to start up the postmaster. (If you want the script to wait # until the server has started, you could use pg_ctl start -w here. # But without -w, pg_ctl adds no value.) DAEMON=$prefix/bin/__postmaster # What to use to shut down the postmaster PGCTL=$prefix/bin/pg_ctl set -e # Only start if we can find the postmaster. test -x $DAEMON || { echo $DAEMON not found if [ $1 = stop ] then exit 0 else exit 5 fi } # Parse command line parameters. case $1 in start) echo -n Starting PostgreSQL: test x$OOM_SCORE_ADJ != x echo $OOM_SCORE_ADJ /proc/self/oom_score_adj test x$OOM_ADJ != x echo $OOM_ADJ /proc/self/oom_adj su - $PGUSER -c $DAEMON -D '$PGDATA' $PGLOG 21 echo ok ;; stop) echo -n Stopping PostgreSQL: su - $PGUSER -c $PGCTL stop -D '$PGDATA' -s -m fast echo ok ;; restart) echo -n Restarting PostgreSQL: su - $PGUSER -c $PGCTL stop -D '$PGDATA' -s -m fast -w test x$OOM_SCORE_ADJ != x echo $OOM_SCORE_ADJ /proc/self/oom_score_adj test x$OOM_ADJ != x echo $OOM_ADJ /proc/self/oom_adj su - $PGUSER -c
Re: [postgis-users] POSTGIS_ENABLE_OUTDB_RASTERS=1: PostGIS won't start (RHEL 6.5)
Can you post the shell script? On Wed, Feb 25, 2015 at 11:50 AM, Phil Hurvitz phurv...@uw.edu wrote: Thanks Bborie, I am starting with a shell script, and have added the env vars to that script, but am still unable to access the out-db rasters. -P. ** Philip M. Hurvitz, PhD | Research Assistant Professor | UW-CBE Urban Form Lab | 1107 NE 45th Street, Suite 535 | Box 354802 University of Washington, Seattle, Washington 98195-4802, USA phurv...@u.washington.edu | http://gis.washington.edu/phurvitz What is essential is invisible to the eye. -de Saint-Exupéry ** On 2/25/2015 11:45, Bborie Park wrote: The env variables need to be within the environment of the postgres process. How are you starting postgres? Shell script? Then you should be able to add the variables to that script. Direct invocation of posrgres on the command line? You need to have the variables before the command VAR=1 postgres ... -bborie On Feb 25, 2015 11:40 AM, Phil Hurvitz phurv...@uw.edu mailto:phurv...@uw.edu wrote: Thanks Bborie, I built from the tarball rather than using an rpm; does that still mean I should be adding the environment variables to /etc/sysconfig/pgsql/__postgresql So for overkill I added the env vars to that file as well as to the init script, restarted PostgreSQL, and it seems I still cannot access the out-db raster. I added a slope raster using: raster2pgsql -I -C -e -Y -F -d -R -s 2926 ./slope/slope_ps.tif gis.slope | psql osm_test I can get metadata (sorry for the ugly text wrapping): select rid, (foo.md http://foo.md).* from (select rid, st_Metadata(rast) as md from slope) as foo; rid |upperleftx|upperlefty| width | height | scalex | scaley | skewx | skewy | srid | numbands -+--+-__-+---+-- --__+--+--__-+---+-- -+__--+-- 1 | 835161.301005914 | 758483.868026069 | 31935 | 34649 | 32.80833 | -32.80833 | 0 | 0 | 2926 |1 But cannot access values: select st_summarystats(rast) from slope; ERROR: rt_raster_load_offline_data: Access to offline bands disabled CONTEXT: SQL function st_summarystats statement 1 select st_value(rast, 1, 1, 1) from slope; ERROR: rt_raster_load_offline_data: Access to offline bands disabled -P. **__**__** Philip M. Hurvitz, PhD | Research Assistant Professor | UW-CBE Urban Form Lab | 1107 NE 45th Street, Suite 535 | Box 354802 University of Washington, Seattle, Washington 98195-4802, USA phurv...@u.washington.edu mailto:phurv...@u.washington.edu | http://gis.washington.edu/__phurvitz http://gis.washington.edu/phurvitz What is essential is invisible to the eye. -de Saint-Exupéry **__**__** Bborie Park dustym...@gmail.com mailto:dustym...@gmail.com Wed Feb 25 10:46:59 PST 2015 Philip, POSTGIS_ENABLE_OUTDB_RASTERS=1 is an environment variable not to be in postgresql.conf. The same is true for POSTGIS_GDAL_ENABLED_DRIVERS=__ENABLE_ALL https://wiki.postgresql.org/__wiki/PostgreSQL_on_RedHat___Linux https://wiki.postgresql.org/wiki/PostgreSQL_on_RedHat_Linux Based upon the above, it looks like you should add POSTGIS_ENABLE_OUTDB_RASTERS=1 POSTGIS_GDAL_ENABLED_DRIVERS=__ENABLE_ALL to /etc/sysconfig/pgsql/__postgresql The above assumes you're using the packages provided by PostgreSQL. http://www.postgresql.org/__download/linux/redhat/ http://www.postgresql.org/download/linux/redhat/ -bborie On 2/25/2015 10:10, Phil Hurvitz wrote: Hi all, I am having trouble starting PostGIS with out-db raster support In my /usr/local/pgsql/data/__postgresql.conf file I include the line POSTGIS_ENABLE_OUTDB_RASTERS=1 after which PostGIS won't start (service postgresql start). Software is postgis_full_version --__ --__--- POSTGIS=2.1.3 r12547 GEOS=3.4.2-CAPI-1.8.2 r3921 PROJ=Rel. 4.7.1, 23 September 2009 GDAL=GDAL 1.11.2, released 2015/02/10 LIBXML=2.7.6 TOPOLOGY RASTER Also PostGIS won't start when I specify POSTGIS_GDAL_ENABLED_DRIVERS=__ENABLE_ALL Any help would be appreciated! ___ postgis-users mailing list postgis-users@lists.osgeo.org
Re: [postgis-users] TopologyException: geom is invalid
On Wed, Feb 25, 2015 at 12:14 PM, Joseph Spenner joseph85...@yahoo.com wrote: DBD::Pg::st execute failed: ERROR: Error performing intersection: TopologyException: Input geom 1 is invalid: Self-intersection at or near point -381688.06935935974 -1206669.4272876547 at -381688.06935935974 -1206669.4272876547 at ./test.pl line 151. Did you try ST_IsValid to verify the geometry is valid according to the OGC standard? (See http://postgis.net/docs/using_postgis_dbmanagement.html#OGC_Validity. ST_IsValidDetail and ST_IsValidReason are also helpful in this regard.) What happens if you run it through ST_MakeValid? Be aware that ST_MakeValid can sometimes result in GeometryCollections if the input shape is malformed (usually rings without enough points are that have different start and end points). ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] calculating area
Thank you, very detailed explanation On Wednesday, February 25, 2015, David Haynes hayne...@gmail.com wrote: There are many ways to determine area in PostGIS, but I will simplify this to 3 groups. 1 consider the earth as an ellipsoid, where the radius changes, 2 consider the world to a perfect sphere, 3 your area is small enough to fit in a defined equal area projection. For work, I have generated a number of area datasets for country boundries using the functions in PostGIS. You will notice that the 3rd function uses a global equal area projection. They are all different and in someways they are all accurate. The first function uses a mathematical model that tries to model the earth and takes a bit longer. The second uses a sphere and is the fastest, while the third flattens the earth and its accuracy is based on the projection. 1) Spherical Area ST_Area(p.geog, false) as ellipsoid / spheroid The current World Geodetic System model uses a spheroid whose radius is 6,378.137 km at the equator and 6,356.752 km at the poles. 2) Spheroid AREA ST_Area(p.geog) as sphere, 3) Projected Area ST_Area(ST_Transform(p.geog::geometry,3410)) proj_area In general, I would recommend the function 1 as an accurate calculation. I have document of country areas I can share with you if you like. It shows a collection of country polygons that have the area determined using all three different methods. In this document, I am assuming that spheroid will be the truth. The interesting thing is that there are major differences based on the latitude. The area of a geography goes from over to under projection at the 35 degree. This is due to shrinking and expansion of the ellipsoid and equal area projection. On Wed, Feb 25, 2015 at 6:53 AM, Lelo - Luiz Rogério De Pieri lelo.pi...@gmail.com wrote: Hi, I think you always have to transforme to UTM to have area in square meters. Best Regards, 2015-02-25 9:10 GMT-03:00 Ahmet Temiz ahmettemi...@gmail.com: Hello, How do we calculate the area (polygon) in country ( Turkey) level ? Which one does give better result ? transforming to UTM or using geography ? regards -- Ahmet Temiz Jeoloji Müh. Afet ve Acil Durum Yönetimi Başkanlığı Planlama ve Zarar Azaltma Dairesi Başkanlığı Ahmet Temiz Geological Eng. Information Systems - GIS Group Disaster and Emergency Management of Presidency ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users -- Rogério De Pieri (Lelo) MBA em Gerenciamento de Projetos - FGV SCJP 5 Buscando melhorar a cada dia Áudio, Hardware Software www.twitter.com/lelopieri blogdolelo.wordpress.com ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users -- Ahmet Temiz Jeoloji Müh. Afet ve Acil Durum Yönetimi Başkanlığı Planlama ve Zarar Azaltma Dairesi Başkanlığı Ahmet Temiz Geological Eng. Information Systems - GIS Group Disaster and Emergency Management of Presidency ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] ST_Intersection very slow
I’ll also try and take a look - I’ve just downloaded the dataset in question - I’m keen to see it. Will revert. On 25 Feb 2015, at 6:41 pm, Rémi Cura remi.c...@gmail.com wrote: Damn I'm publishing a QGIS plugin for POstGIS, I can't write you the fast intersection by casting polygon to points, intersection then casting back to polygon. I'll try to squeeze it somehow. Cheers, Rémi-C 2015-02-25 1:44 GMT+01:00 Mark Wynter m...@dimensionaledge.com: The land cover data you’re working with - does it come as a raster? We need a strategy for busting up that single, monolithic poly with lots of holes. If its a raster, then I think that tiling on import would be of huge benefit. I’m just under the pump the next few days. ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] ST_Intersection very slow
Where is the data set? Cheers, Rémi-C 2015-02-25 9:18 GMT+01:00 Mark Wynter m...@dimensionaledge.com: I’ll also try and take a look - I’ve just downloaded the dataset in question - I’m keen to see it. Will revert. On 25 Feb 2015, at 6:41 pm, Rémi Cura remi.c...@gmail.com wrote: Damn I'm publishing a QGIS plugin for POstGIS, I can't write you the fast intersection by casting polygon to points, intersection then casting back to polygon. I'll try to squeeze it somehow. Cheers, Rémi-C 2015-02-25 1:44 GMT+01:00 Mark Wynter m...@dimensionaledge.com: The land cover data you’re working with - does it come as a raster? We need a strategy for busting up that single, monolithic poly with lots of holes. If its a raster, then I think that tiling on import would be of huge benefit. I’m just under the pump the next few days. ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] ST_Intersection very slow
Damn I'm publishing a QGIS plugin for POstGIS, I can't write you the fast intersection by casting polygon to points, intersection then casting back to polygon. I'll try to squeeze it somehow. Cheers, Rémi-C 2015-02-25 1:44 GMT+01:00 Mark Wynter m...@dimensionaledge.com: The land cover data you’re working with - does it come as a raster? We need a strategy for busting up that single, monolithic poly with lots of holes. If its a raster, then I think that tiling on import would be of huge benefit. I’m just under the pump the next few days. ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users