1

I have the latitude and the longitude of view of map ( latitude and longitude of north west and the latitude and longitude of southeast ) and a geojson files with MultiPolygon. (43mo)

In PHP i want to detect if a polygon is in view.

test they 2 point (NW & SE) if is in polygons is not a good way because polygons is imprevisible https://upload.wikimedia.org/wikipedia/commons/thumb/8/81/Rectangle_definition.svg/2000px-Rectangle_definition.svg.png in this case the result found is the corner NW and SE but the center and ne and sw not found

I need to know what are in view

example with this view: enter image description here I test NW and SE (of view) if is in polygon on center -> return false but i see the polygon on center

how i can know all polygons in actual view ?

3
  • Your question is not totally clear. What does imprevisble mean? Commented Oct 18, 2015 at 15:14
  • like that zupimages.net/up/15/42/9jce.png Commented Oct 18, 2015 at 15:17
  • Imagine you are on webbrowser see that zupimages.net/up/15/42/yge8.png the bounds of view is NW & SE , so i test they points if is in polygons -> return false, However you see this polygon and i need to know that see this polygon Commented Oct 18, 2015 at 15:31

1 Answer 1

0

Use the overlaps method of https://geophp.net/ to check if the polygon overlaps the rectangle defined by your map bounds.

See also https://en.wikipedia.org/wiki/DE-9IM to learn the difference between "overlapping" and "intersecting".

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.