Jump to content

Google map, select records addresses from a delimited polygon bounds.


This topic is 2333 days old. Please don't post here. Open a new topic instead.

Recommended Posts

As you can see in the image i create from filemaker the google map and the points of address. Using the polygon function I delimited the area that include the addresses.

as i create the polygon i get into a div the coordinates of the polygon.

 I should pass them   to filemaker and it has to find the addresses included into the polygon.

To find them i should loop all the records to check if the address of each is in the polygon bound.

I didn't find the formula to get this result, there are custom function for circle or rectangle area but not for a polygon.

Does any can help me?

mbexsample.jpeg

Polydata_test1.html

Edited by Franco Pagano
Link to comment
Share on other sites

I made a solution once that works in the other direction: given a point, find which polygons in the database contain it. There are a couple ways to do this, but the way that executed fastest was to decompose each polygon into geohashes covering the same region in advance, then calculate the geohash for the point of interest and perform an exact match find on the geohash. (When it's important to keep the database small, you can decompose regions into different-precision geohashes depending on what's necessary to cover the shape of the region, then finding a region for a point consists of attempting finds at multiple resolutions until it gets a match.) This assumed that the regions of interest are already in the database.

But you're asking for a solution to a different problem: given a polygon, find which points in the database are contained by it. Start by looking at the "point in polygon" problem. I specifically recommend starting with the winding number algorithm. That's fine if you already have a small number of records to check. If you have more than a handful of points in your database, it will probably be unacceptably slow to check every single one. You could solve that by doing a find for points within the bounding box of the polygon, then checking each record in that constrained set with the winding number algorithm. This blog post I wrote a few years ago discusses how to find within a bounding box.

If it's worth it to you to experiment with more complication options to achieve better speed, look into the point location problem, and trapezoidal decomposition in particular. The idea is that you might decompose your polygons into strictly vertical slabs, perform finds for the bounding boxes of the slabs, and check if the found points are actually in those slabs (which is much faster than the general point in polygon solutions because we can take advantage of the known shape of the slabs). This gets gnarly very fast, especially when you start handling non-convex polygons. You also don't want to be performing a huge number of numerical range finds in a single find request. FileMaker starts to choke on the complexity of the request. Extending a found set for each slab would probably work better.

Edited by jbante
Link to comment
Share on other sites

I solved yesterday, mbs plug in has a function that gave me the solution, it is in the math group of functions.

Problably javascript could do what i need but i prefer to solve using fmp.

thanks for your attention

Link to comment
Share on other sites

This topic is 2333 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.