none
Points in Polygon SOAP Service API RRS feed

  • Question

  • Hi,

    I have about 20 polygons.  When a user types an address, I want to determine which polygon that point is in.

    I have done this with the javascript samples and they work great.  However, I want to now delegate that process in the server side, so I can save the client the load time and not have to send them all of the polygon points to their browser.

    Is it possible to determine if a point is in a polygon using the SOAP Web Service rather than the Ajax calls?

    Sunday, October 21, 2012 7:16 AM

Answers

  • The best way to do this is to make use of the SQL Server Spatial library which you can use without installing SQL. The spatial library has all the same spatial calculations that are available in SQL Server 2008, 2012 and Azure. You can easily create polygon objects and then test for intersections with your points. This will also enable you to support more complex polygons than you may have been limited to with a JavaScript approach. Take a look at this hands on Lab for more information: http://ecn.channel9.msdn.com/o9/learn/SQL2008R2TrainingKit/Labs/UsingSpatialDataInManagedCode/Lab.docx

    http://rbrundritt.wordpress.com

    Monday, October 22, 2012 8:41 AM

All replies

  • The best way to do this is to make use of the SQL Server Spatial library which you can use without installing SQL. The spatial library has all the same spatial calculations that are available in SQL Server 2008, 2012 and Azure. You can easily create polygon objects and then test for intersections with your points. This will also enable you to support more complex polygons than you may have been limited to with a JavaScript approach. Take a look at this hands on Lab for more information: http://ecn.channel9.msdn.com/o9/learn/SQL2008R2TrainingKit/Labs/UsingSpatialDataInManagedCode/Lab.docx

    http://rbrundritt.wordpress.com

    Monday, October 22, 2012 8:41 AM
  • Hi,

    I have actuallyed looked in SQL 2008 R2 Geography datatype and have done some tests with its polygon built-in functions.  However, I have found that the format and polygon points of intersection are so strict, that most of the existing polygons I have, even though reformatted, still fail to insert because of intersecting issues or what not.  Bu they work fine with javascript.  Since the polygons are coming from an external data source, this would be too cumbersome to implement as the polygon requirements are so strict.  But I think your suggestion is deal.  Thanks

    Monday, October 22, 2012 6:17 PM