Quantcast

[Dev] Using S2Geometry in Geodesic Polygon

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Dev] Using S2Geometry in Geodesic Polygon

ralford
Hi All, 

Today I looked further into the polygon elements of the S2 Geometry library and I found that many of the methods included in this library could be particularly useful. For one, they handle holes in spherical polygons which was a complication I hadn't yet considered. They also provide algorithms that would be required for implementing spatial relation. 


Would it be a good move to start implementing some of these algorithms in Spatial4j? It looks like the license is ok. 

Thanks, 
Rebecca

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Dev] Using S2Geometry in Geodesic Polygon

dsmiley
Chris, look it over too to see if there's an equivalent way to get a buffered line.  I suspect there isn't directly but it may include some math pieces.

Rebecca (or Chris):
* did you notice any way to relate a polygon with a lat-lon rectangle?  Again, the lat-lon rectangle isn't just a polygon for spherical geometry since the longitudinal lines are *not* great-circle lines.
* was there a lat-lon bounding box of a polygon calculation?

I think a key decision to make is if we want to faithfully port it to Java and retain its API more or less, keeping it to some "s2" Java package, or if not and we just take some algorithms here & there as needed.  Even if its API is retained in a Java fashion, that doesn't stop us from having separate Spatial4j Shape subclasses that are implemented based on the s2 portion.

~ David


On Mon, Feb 24, 2014 at 7:48 PM, Rebecca Alford <[hidden email]> wrote:
Hi All, 

Today I looked further into the polygon elements of the S2 Geometry library and I found that many of the methods included in this library could be particularly useful. For one, they handle holes in spherical polygons which was a complication I hadn't yet considered. They also provide algorithms that would be required for implementing spatial relation. 


Would it be a good move to start implementing some of these algorithms in Spatial4j? It looks like the license is ok. 

Thanks, 
Rebecca

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com



_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Dev] Using S2Geometry in Geodesic Polygon

ralford
Hi again, 

To first answer your questions: 
 - There are intersect/contains/disjoint methods for relating 2 polygons. The lat/lon rectangle could just be a simple polygon for these inputs I might imagine. 
 - There is a method for computing the bounding lat/lon rectangle. 

In my opinion, a good approach to this is to keep the Spatial4j API and use the underlying algorithms. Most of their API roughly conforms to our API anyway. I am not sure a full port is appropriate as there is a wider range of functions we might not need - though I am also not aware of the full scope of Spatial4j's application so I might not be the best judge of this. 

Rebecca


On Tue, Feb 25, 2014 at 12:17 AM, [hidden email] <[hidden email]> wrote:
Chris, look it over too to see if there's an equivalent way to get a buffered line.  I suspect there isn't directly but it may include some math pieces.

Rebecca (or Chris):
* did you notice any way to relate a polygon with a lat-lon rectangle?  Again, the lat-lon rectangle isn't just a polygon for spherical geometry since the longitudinal lines are *not* great-circle lines.
* was there a lat-lon bounding box of a polygon calculation?

I think a key decision to make is if we want to faithfully port it to Java and retain its API more or less, keeping it to some "s2" Java package, or if not and we just take some algorithms here & there as needed.  Even if its API is retained in a Java fashion, that doesn't stop us from having separate Spatial4j Shape subclasses that are implemented based on the s2 portion.

~ David


On Mon, Feb 24, 2014 at 7:48 PM, Rebecca Alford <[hidden email]> wrote:
Hi All, 

Today I looked further into the polygon elements of the S2 Geometry library and I found that many of the methods included in this library could be particularly useful. For one, they handle holes in spherical polygons which was a complication I hadn't yet considered. They also provide algorithms that would be required for implementing spatial relation. 


Would it be a good move to start implementing some of these algorithms in Spatial4j? It looks like the license is ok. 

Thanks, 
Rebecca

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com



_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com




--
Rebecca

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Dev] Using S2Geometry in Geodesic Polygon

dsmiley

On Tue, Feb 25, 2014 at 9:53 AM, Rebecca Alford <[hidden email]> wrote:
 - There are intersect/contains/disjoint methods for relating 2 polygons. The lat/lon rectangle could just be a simple polygon for these inputs I might imagine. 

I was trying to be clear that a latitude-longitude rectangle is *not* the same as a 4-point geodesic polygon. Such a polygon in the northern hemisphere would have it's horizontal edges bow upwards when viewed on a 2-D map, and bow downwards if it were in the southern hemisphere.  Make sense?

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Dev] Using S2Geometry in Geodesic Polygon

ralford
Oh Sorry - I didn't realize that. I don't see anything explicit in that case. 


On Tue, Feb 25, 2014 at 10:03 AM, [hidden email] <[hidden email]> wrote:

On Tue, Feb 25, 2014 at 9:53 AM, Rebecca Alford <[hidden email]> wrote:
 - There are intersect/contains/disjoint methods for relating 2 polygons. The lat/lon rectangle could just be a simple polygon for these inputs I might imagine. 

I was trying to be clear that a latitude-longitude rectangle is *not* the same as a 4-point geodesic polygon. Such a polygon in the northern hemisphere would have it's horizontal edges bow upwards when viewed on a 2-D map, and bow downwards if it were in the southern hemisphere.  Make sense?



--
Rebecca

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Dev] Using S2Geometry in Geodesic Polygon

dsmiley
Rebecca,

Please dig into S2 and see what code it may have for determining if a segment of a "line of latitude" (aka circle of latitude) intersects a segment of a "great circle" (i.e. a geodesic polygon line segment / edge).  It's possible this might be generalized in S2 as a segment on a "small circle" which means it could be at an angle; lines of latitude are "small circles" in which the angle is 0.  *Maybe* there's a way to take a great circle segment and ask it at what longitude does it intersect latitude Y.  That would do it.  Any way, it's very important to be able to do that, so if S2 doesn't have anything at all then we'll need to devise something because it's a fundamental capability of Spatial4j used by Lucene-spatial to use a shape -- intersecting shapes with rectangles.


~ David


On Tue, Feb 25, 2014 at 11:31 AM, Rebecca Alford <[hidden email]> wrote:
Oh Sorry - I didn't realize that. I don't see anything explicit in that case. 


On Tue, Feb 25, 2014 at 10:03 AM, [hidden email] <[hidden email]> wrote:

On Tue, Feb 25, 2014 at 9:53 AM, Rebecca Alford <[hidden email]> wrote:
 - There are intersect/contains/disjoint methods for relating 2 polygons. The lat/lon rectangle could just be a simple polygon for these inputs I might imagine. 

I was trying to be clear that a latitude-longitude rectangle is *not* the same as a 4-point geodesic polygon. Such a polygon in the northern hemisphere would have it's horizontal edges bow upwards when viewed on a 2-D map, and bow downwards if it were in the southern hemisphere.  Make sense?



--
Rebecca


_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Dev] Using S2Geometry in Geodesic Polygon

ralford
Hmmm....so I 'dug' into this and this is what I found: 

In S2Polygon - you can compute the bounding lat/lon rectangle

In S2LatLngRect - There is an implementation of a lat/long rectangle. It will compute the intersection with other lat/long rectangle.

I do not see any explicit intersection methods with a great circle (nor do I see any representation of the great circle explicitly). Though, I might imagine if they can compute the bounding lat/long rectangle, finding its intersection is not so far off. 

Rebecca


On Wed, Feb 26, 2014 at 3:44 PM, [hidden email] <[hidden email]> wrote:
Rebecca,

Please dig into S2 and see what code it may have for determining if a segment of a "line of latitude" (aka circle of latitude) intersects a segment of a "great circle" (i.e. a geodesic polygon line segment / edge).  It's possible this might be generalized in S2 as a segment on a "small circle" which means it could be at an angle; lines of latitude are "small circles" in which the angle is 0.  *Maybe* there's a way to take a great circle segment and ask it at what longitude does it intersect latitude Y.  That would do it.  Any way, it's very important to be able to do that, so if S2 doesn't have anything at all then we'll need to devise something because it's a fundamental capability of Spatial4j used by Lucene-spatial to use a shape -- intersecting shapes with rectangles.


~ David


On Tue, Feb 25, 2014 at 11:31 AM, Rebecca Alford <[hidden email]> wrote:
Oh Sorry - I didn't realize that. I don't see anything explicit in that case. 


On Tue, Feb 25, 2014 at 10:03 AM, [hidden email] <[hidden email]> wrote:

On Tue, Feb 25, 2014 at 9:53 AM, Rebecca Alford <[hidden email]> wrote:
 - There are intersect/contains/disjoint methods for relating 2 polygons. The lat/lon rectangle could just be a simple polygon for these inputs I might imagine. 

I was trying to be clear that a latitude-longitude rectangle is *not* the same as a 4-point geodesic polygon. Such a polygon in the northern hemisphere would have it's horizontal edges bow upwards when viewed on a 2-D map, and bow downwards if it were in the southern hemisphere.  Make sense?



--
Rebecca




--
Rebecca

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Loading...