-1

1-What is the best and correct way to pass a Google Map Polygon to Azure Search.

2-If 2 Polygons are intersecting, how does this need to be handled. Thank you.

user2981411
  • 859
  • 12
  • 34
  • Some things that would help us answer this question: 1. What is the format of a Google Map Polygon? Can you give an example? 2. What is the scenario for intersecting polygons in Azure Search, given that Azure Search does not allow fields of type Edm.GeographyPolygon? – Bruce Johnston Jan 04 '17 at 18:03
  • @BruceJohnston A google map polygon is an object in the google map api. Are you sure you have never used google map api before ? One can get the vertices as an array of points but how does one feed azure search with this data. I understand that the points should also be in a particular order (clockwise, anticlockwise etc) – user2981411 Jan 04 '17 at 19:59
  • I haven't used the Google Map API before, but I know some APIs deal in both addresses and co-ordinates. Are the co-ordinates returned by the Google Map API in Geo-JSON format? Something else...? Also, do you need to know how to index points in Azure Search using the REST API? .NET SDK? Both? Please clarify both parts of your question above. – Bruce Johnston Jan 05 '17 at 00:12
  • @BruceJohnston We are using the .NET SDK. The coordinates are simply an array of lat/lng values. Something like this [ {lat: 37.772, lng: -122.214}, {lat: 21.291, lng: -157.821}, {lat: -18.142, lng: 178.431}, {lat: -27.467, lng: 153.027} ]; – user2981411 Jan 05 '17 at 01:11

1 Answers1

1

The only part of the Azure Search API where you can specify a polygon is in a filter expression. In the .NET SDK you can use the SearchParameters.Filter property to set the filter. The OData syntax reference for Azure Search has details and examples of how to format a polygon literal in the geo.intersects() function.

Azure Search only supports passing a single polygon literal to geo.intersects, so the second part of the question does not apply.

Bruce Johnston
  • 8,344
  • 3
  • 32
  • 42
  • As far as i can tell the document you pointed to shows an example of a rectangular shape only. It mentions for non-rectangular shapes consider the split approach. Are there any examples. We need to process a non-rectangular polygon. How do we do that please? The filter property approach - can that be used for irregular shapes. If so How? Thanks – user2981411 Jan 06 '17 at 12:57
  • 1
    The restriction to rectangular shapes only applies for polygons that intersect the 180th meridian (near the International date line in the Pacific Ocean). If your polygons never cross that line, then they don't need to be rectangular. Regarding splitting polygons, that is a separate question: http://stackoverflow.com/questions/3623703/how-can-i-split-a-polygon-by-a-line – Bruce Johnston Jan 06 '17 at 22:25
  • @user2981411 Please edit your question to make it clear you're asking about polygon splitting. As currently phrased it is very vague and not helpful to other StackOverflow users who may have similar questions. Thanks. – Bruce Johnston Jan 06 '17 at 22:41