[postgis-users] What's the Fastest way to find if Polygons cover an input point?

Darafei "Komяpa" Praliaskouski me at komzpa.net
Sat Jul 7 06:11:54 PDT 2018


ST_Subdivide can help you split up your polygons to have less points in
their edges. After that, ST_Intersects should be the fastest way to check a
point-in-polygon relation.

To check if you can service a customer, you don't need a count - WHERE
EXISTS() should be faster and enough.

On аў, 3 ліп 2018, 12:50 Devdatta Tengshe <devdatta at tengshe.in> wrote:

> Hi all,
> I'm developing an API which will help us figure out if we can server a
> potential customer. For this, I have a PostGIS Table with polygon
> representing the service area of each of our store. There could be up to
> 10,000 polygons in the table. These polygons are geometries in EPSG:4326
> and has a Gist Index.
> Currently I'm using the following query to figure out if we can
> potentially service the customer:
> Select count(id) from service_areas where
> ST_CoveredBy(ST_SetSRID(ST_MakePoint(78.46239,17.30360),4326), geom);
> Is there a faster way to get if any of the polygons cover my input Point?
> Regards,
> Devdatta
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20180707/2578c3a2/attachment.html>

More information about the postgis-users mailing list