Version:
Popular examples
Map
Geo objects
Balloon and hint
Controls
Hotspots
Regions
Clustering
GeoQuery
Behaviors and events
Search on a map
Traffic
User's location
Routing
YMapsML
GeoXML
ObjectManager
Modular system
Panoramas
External modules

The intersection of a route with a polygon using the example of the Moscow Ring Road

Save as filesEdit on JSFiddle

It is often necessary to draw a route between specified points, and then analyze in what areas or cities the segments of this route fall on. In this example, prepared data is used for creating a polygon defining the MKAD. After the route is received, a check is performed for whether its segments fall within this polygon using the method searchInside.

You can use the GeoQueryResult object to set options or data for an entire group of geo objects at once. Here you can see how route segments that are inside or outside of the ring road use different colors.