Re: [postgis-users] meters to degrees

2011-03-07 Thread Paragon Corporation
Use ST_DWithin instead.
http://www.postgis.org/documentation/manual-1.5SVN/ST_DWithin.html
 
We cover this topic in detail in the first chapter of our book which is a
free download.
 
http://www.postgis.us/chapter_01
 
Leo and Regina

  _  

From: postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of michal
nagy
Sent: Monday, March 07, 2011 2:29 AM
To: postgis-users@postgis.refractions.net
Subject: [postgis-users] meters to degrees





Hello everyone,

I am new to Postgres and PostGIS. I have encountered one problem, that I
can not deal with.I have table with various points that have SRID=3044,
which should be UTM zone including Jutland. I have created function to
loop through all points in table and check if they are within given
radius(using geometry and function st_point_inside_circle). Now to the
problem, for some reason st_point_inside_circle takes radius in degrees,
which is very inconvenient for me. I would really need to  change to
metres. If anyone has a suggestion, pls let me know.

Thank you for help

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


Re: [postgis-users] meters to degrees

2011-03-07 Thread michal nagy
Well, it sitll does not solve my problem. As I said I am using
geometry(planar) with SRID 3044, where units are degrees, therefore when
using st_dwithin will still take input in degrees.

2011/3/7 Paragon Corporation l...@pcorp.us

  Use ST_DWithin instead.
 http://www.postgis.org/documentation/manual-1.5SVN/ST_DWithin.html

 We cover this topic in detail in the first chapter of our book which is a
 free download.

 http://www.postgis.us/chapter_01

 Leo and Regina

  --
 *From:* postgis-users-boun...@postgis.refractions.net [mailto:
 postgis-users-boun...@postgis.refractions.net] *On Behalf Of *michal nagy
 *Sent:* Monday, March 07, 2011 2:29 AM
 *To:* postgis-users@postgis.refractions.net
 *Subject:* [postgis-users] meters to degrees


   Hello everyone,

 I am new to Postgres and PostGIS. I have encountered one problem, that I
 can not deal with.I have table with various points that have SRID=3044,
 which should be UTM zone including Jutland. I have created function to
 loop through all points in table and check if they are within given
 radius(using geometry and function st_point_inside_circle). Now to the
 problem, for some reason st_point_inside_circle takes radius in degrees,
 which is very inconvenient for me. I would really need to  change to
 metres. If anyone has a suggestion, pls let me know.

 Thank you for help

 Michal

 ___
 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] meters to degrees

2011-03-07 Thread Mike Toews
You are using EPSG:3044, correct? http://spatialreference.org/ref/epsg/3044/

http://spatialreference.org/ref/epsg/3044/This projection has units of
metres. ST_DWithin and related functions use the same units of length as
defined in the projection, which in this case is metres, not degrees. You
may need to elaborate with an example.

-Mike

On 7 March 2011 23:41, michal nagy lachim1...@gmail.com wrote:

 Well, it sitll does not solve my problem. As I said I am using
 geometry(planar) with SRID 3044, where units are degrees, therefore when
 using st_dwithin will still take input in degrees.

 2011/3/7 Paragon Corporation l...@pcorp.us

  Use ST_DWithin instead.
 http://www.postgis.org/documentation/manual-1.5SVN/ST_DWithin.html

 We cover this topic in detail in the first chapter of our book which is a
 free download.

 http://www.postgis.us/chapter_01

 Leo and Regina

  --
 *From:* postgis-users-boun...@postgis.refractions.net [mailto:
 postgis-users-boun...@postgis.refractions.net] *On Behalf Of *michal nagy
 *Sent:* Monday, March 07, 2011 2:29 AM
 *To:* postgis-users@postgis.refractions.net
 *Subject:* [postgis-users] meters to degrees


   Hello everyone,

 I am new to Postgres and PostGIS. I have encountered one problem, that I
 can not deal with.I have table with various points that have SRID=3044,
 which should be UTM zone including Jutland. I have created function to
 loop through all points in table and check if they are within given
 radius(using geometry and function st_point_inside_circle). Now to the
 problem, for some reason st_point_inside_circle takes radius in degrees,
 which is very inconvenient for me. I would really need to  change to
 metres. If anyone has a suggestion, pls let me know.

 Thank you for help

 Michal

 ___
 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] meters to degrees

2011-03-07 Thread michal nagy

 Ok,

 basically I have table location(id int, point geometry(POINT)) and function
 getallpointsincircle(longitude, latitude, radius) which gives set of
 internal indexes from location table if point in table is in the radius of
 parameters of function. Inside function I am using st_dwithin

 declare
 t2_row location%rowtype;
 po geometry;begin
 po:=st_geomfromtext('POINT('||lon||' '||lat||')',3044);
 for t2_row in select * from location
 loop
 if st_dwithin(t2_row.point,po, radius) is truethen return next t2_row.id;end 
 if;end loop;return;end;


 idst_astext
 12
 POINT(7.4545 44)
 13
 POINT(7.49785 44)
 14
 POINT(7.6845 44)
 15
 POINT(7.96311 44)
 16
 POINT(55.859755 9.847419)

 these are test values in location table, as you can see point(16) has
 measured coords, others are bogus.
 Now, when I execute my function select
 getallpointsincircle(56.162882,10.203944,45000.0), all the indexes are
 returned. Approximately the distance between these places is 40 km. But when
 I exchange 45000.0 with 0.46 i will get proper index(16 in this case).



 2011/3/7 Mike Toews mwto...@gmail.com

 You are using EPSG:3044, correct?
 http://spatialreference.org/ref/epsg/3044/

 http://spatialreference.org/ref/epsg/3044/This projection has units of
 metres. ST_DWithin and related functions use the same units of length as
 defined in the projection, which in this case is metres, not degrees. You
 may need to elaborate with an example.

 -Mike


 On 7 March 2011 23:41, michal nagy lachim1...@gmail.com wrote:

 Well, it sitll does not solve my problem. As I said I am using
 geometry(planar) with SRID 3044, where units are degrees, therefore when
 using st_dwithin will still take input in degrees.

 2011/3/7 Paragon Corporation l...@pcorp.us

  Use ST_DWithin instead.
 http://www.postgis.org/documentation/manual-1.5SVN/ST_DWithin.html

 We cover this topic in detail in the first chapter of our book which is
 a free download.

 http://www.postgis.us/chapter_01

 Leo and Regina

  --
 *From:* postgis-users-boun...@postgis.refractions.net [mailto:
 postgis-users-boun...@postgis.refractions.net] *On Behalf Of *michal
 nagy
 *Sent:* Monday, March 07, 2011 2:29 AM
 *To:* postgis-users@postgis.refractions.net
 *Subject:* [postgis-users] meters to degrees


   Hello everyone,

 I am new to Postgres and PostGIS. I have encountered one problem, that I
 can not deal with.I have table with various points that have SRID=3044,
 which should be UTM zone including Jutland. I have created function to
 loop through all points in table and check if they are within given
 radius(using geometry and function st_point_inside_circle). Now to the
 problem, for some reason st_point_inside_circle takes radius in degrees,
 which is very inconvenient for me. I would really need to  change to
 metres. If anyone has a suggestion, pls let me know.

 Thank you for help

 Michal

 ___
 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] meters to degrees

2011-03-07 Thread Mike Toews
Hi Michal,

It looks like you declared your data in location.point using
longitude/latitude, rather than easting/northing. If you want to store
your data in projected EPSG:3044, you need to first transform it from
geographic units, e.g.:

SELECT ST_AsEWKT(ST_Transform(ST_SetSRID(ST_MakePoint(7.4545, 44.0),
4326), 3044));

looks like
SRID=3044;POINT(376090.362129178 4873033.87926193)

Now these units are in metres. You had previously declared your point
with Easting 7.4545 m and Northing 44.0 m, which is theoretically
somewhere near the equator. With geometry, you need to use all degrees
or all metres. You cannot mix units arbitrarily without transforming
them using ST_Transform.

If you are doing many things with mixed long/lat and measured metres,
you might want to take a look at the geography data type:
http://postgis.refractions.net/docs/ch04.html#PostGIS_Geography

-Mike

On 8 March 2011 04:49, michal nagy lachim1...@gmail.com wrote:

 Ok,
 basically I have table location(id int, point geometry(POINT)) and function 
 getallpointsincircle(longitude, latitude, radius) which gives set of internal 
 indexes from location table if point in table is in the radius of parameters 
 of function. Inside function I am using st_dwithin

 declare
 t2_row location%rowtype;
 po geometry;
 begin
 po:=st_geomfromtext('POINT('||lon||' '||lat||')',3044);

 for t2_row in select * from location
 loop
 if st_dwithin(t2_row.point,po, radius) is true
 then return next t2_row.id;
 end if;
 end loop;
 return;
 end;

 idst_astext
 12
 POINT(7.4545 44)
 13
 POINT(7.49785 44)
 14
 POINT(7.6845 44)
 15
 POINT(7.96311 44)
 16
 POINT(55.859755 9.847419)
 these are test values in location table, as you can see point(16) has 
 measured coords, others are bogus.
 Now, when I execute my function select 
 getallpointsincircle(56.162882,10.203944,45000.0), all the indexes are 
 returned. Approximately the distance between these places is 40 km. But when 
 I exchange 45000.0 with 0.46 i will get proper index(16 in this case).


 2011/3/7 Mike Toews mwto...@gmail.com

 You are using EPSG:3044, correct? http://spatialreference.org/ref/epsg/3044/
 This projection has units of metres. ST_DWithin and related functions use 
 the same units of length as defined in the projection, which in this case is 
 metres, not degrees. You may need to elaborate with an example.
 -Mike

 On 7 March 2011 23:41, michal nagy lachim1...@gmail.com wrote:

 Well, it sitll does not solve my problem. As I said I am using 
 geometry(planar) with SRID 3044, where units are degrees, therefore when 
 using st_dwithin will still take input in degrees.

 2011/3/7 Paragon Corporation l...@pcorp.us

 Use ST_DWithin instead.  
 http://www.postgis.org/documentation/manual-1.5SVN/ST_DWithin.html

 We cover this topic in detail in the first chapter of our book which is a 
 free download.

 http://www.postgis.us/chapter_01

 Leo and Regina
 
 From: postgis-users-boun...@postgis.refractions.net 
 [mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of michal 
 nagy
 Sent: Monday, March 07, 2011 2:29 AM
 To: postgis-users@postgis.refractions.net
 Subject: [postgis-users] meters to degrees


 Hello everyone,

 I am new to Postgres and PostGIS. I have encountered one problem, that I
 can not deal with.I have table with various points that have SRID=3044,
 which should be UTM zone including Jutland. I have created function to
 loop through all points in table and check if they are within given
 radius(using geometry and function st_point_inside_circle). Now to the
 problem, for some reason st_point_inside_circle takes radius in degrees,
 which is very inconvenient for me. I would really need to  change to
 metres. If anyone has a suggestion, pls let me know.

 Thank you for help

 Michal
 ___
 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] meters to degrees

2011-03-06 Thread Michal
Hello everyone,

I am new to Postgres and PostGIS. I have encountered one problem, that I
can not deal with.I have table with various points that have SRID=3044,
which should be UTM zone including Jutland. I have created function to
loop through all points in table and check if they are within given
radius(using geometry and function st_point_inside_circle). Now to the
problem, for some reason st_point_inside_circle takes radius in degrees,
which is very inconvenient for me. I would really need to  change to
metres. If anyone has a suggestion, pls let me know.

Thank you for help

Michal

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


[postgis-users] meters to degrees

2011-03-06 Thread michal nagy
   Hello everyone,

I am new to Postgres and PostGIS. I have encountered one problem, that I
can not deal with.I have table with various points that have SRID=3044,
which should be UTM zone including Jutland. I have created function to
loop through all points in table and check if they are within given
radius(using geometry and function st_point_inside_circle). Now to the
problem, for some reason st_point_inside_circle takes radius in degrees,
which is very inconvenient for me. I would really need to  change to
metres. If anyone has a suggestion, pls let me know.

Thank you for help

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