[postgis-users] multipolygom

Marcel Kroschel marcel.kroschel at kaufda.de
Tue Feb 8 04:33:38 PST 2011


Hi Nicklas,
your example works - thank you.
How can i store it in geograpgy type?
thx
Marcel

----- Ursprüngliche Mail -----
Von: "Nicklas Avén" <nicklas.aven at jordogskog.no>
An: "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
Gesendet: Dienstag, 8. Februar 2011 12:46:14
Betreff: Re: [postgis-users] multipolygom

To get the distance in meters you can use the geography type instead.

something like:

SELECT *
 FROM zip_polygon
 WHERE ST_DWithin(geom::geography, ST_GeogFromText('4326;POINT(13.171982
52.52646)'), 2);

But to get it working fast you should store in geograpgy type and build
your spatial index n that.

HTH

Nicklas



On Tue, 2011-02-08 at 12:29 +0100, Marcel Kroschel wrote:
> hi @all.
> Hope someone can help me ;)
> I uses postgis 1.5.2., create a table with with multipolygon and lng/lat coordinates called zip_polygon
> 
> SELECT AddGeometryColumn ( 'zip_polygon', 'geom', 4326, 'MULTIPOLYGON', 2 );
> 
> When ich want all polygons in distance i use this query:
> SELECT *
> FROM zip_polygon
> WHERE ST_DWithin(geom, ST_GeomFromText('POINT(13.171982 52.52646)', 4326), 0.02);
> 
> But the manual say, that the last entry is the distance in meter. When i replace the 0.02 to the value 1, then i get the whole list.
> 
> example of geom - entry (SELECT (ST_AsText(geom)) from zip_polygon zp):
> "MULTIPOLYGON(((13.69375 50.82966,13.69252 50.83034,13.68925 50.83206,13.68766 50.83374,13.68639 50.83576,13.68399 50.83782,13.68235 50.8386,13.72514 50.81991)))"
> 
> greeting
> Marcel
> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 


_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list