[postgis-users] query example??

AGT alejandrogalindo at tutopia.com
Fri Jul 23 13:00:12 PDT 2004




now I have another question, desire that poligonos of the geologic map
is to 100 meters of certain point, how I must construct the query,
thanks


El vie, 23-07-2004 a las 14:24, strk escribió:
> On Fri, Jul 23, 2004 at 10:51:20AM -0500, AGT wrote:
> > Hey man thanks
> > 
> > Only I need to do a query: how many points there are in a geological
> > unit (obviusly an irregular polygon, as in nature), what is the syntax;
> > Tried with your sentence and shows all the poinst, only need the points
> > INSIDE the irregular polygon how can I obtain that, give me patience
> > thanks
> 
> Your points table is named 'points'.
> Your geological units table is named 'polys'.
> Your geological identificator field is named 'id'.
> Geometry fields are named 'the_geom'.
> 
> Here is your query:
> 
> SELECT polys.id, count(points.*) FROM points,  polys 
> WHERE points.the_geom && polys.the_geom AND
> distance(points.the_geom, polys.the_geom) = 0
> GROUP BY polys.id;
> 
> --strk;
> 
> > 
> > 
> > El vie, 23-07
> > 
> > 
> > 
> > -2004 a las 10:03, Tyler Mitchell escribió:
> > > You probably want to also use a Distance() function in your where clause, 
> > > in addition to &&.
> > > 
> > > ...WHERE points.geom_column && units.geom_column 
> > > AND distance(points.geom_column, units.geom_column) = 0;
> > > 
> > > Of source, continue adding to the where clause to isolate the single unit 
> > > you are interested in.
> > > 
> > > Hope that helps.
> > > Tyler
> > > 
> > > postgis-users-bounces at postgis.refractions.net wrote on 07/23/2004 07:40:47 
> > > AM:
> > > 
> > > > Hi
> > > > 
> > > > I have a lot of points with coordinates in one shapefile and in another
> > > > shapefile have a geological map right?; how can I do a query for
> > > > instance: how many points are in a geological unit, I use && and ~= but
> > > > the result is a box, but I need only the points that are inside one
> > > > polygon(a geological unit) what I do??? what's the correct syntax???
> > > > help 
> > > > 
> > > > regards
> > > > 
> > > > _______________________________________________
> > > > 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
> > 
> > _______________________________________________
> > 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