Quantcast

Polygon hole follow-up

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

Polygon hole follow-up

Doug Smith-3
Since you're so responsive -- I thought I'd ask another question.

Can you recommend a technique for creating a "slice" that cuts from any
interior polygons to the exterior boundary, essentially making a single
polygon? Something like this:

http://drop.io/mapster/asset/terr-openjump-union-jpg

I've heard that FME by Safe can do this, but wondered if there was a
programmatic technique I could use in JTS instead.

Thanks!

Doug
---
Doug Smith
ELP Web Developer
http://www.daveramsey.com

"Life is an occasion, rise to it" -- Mr. Magorium
_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Polygon hole follow-up

Martin Davis
There's nothing in JTS which will do this as a one-liner.

I can think of a fairly simple brute-force algorithm which would work on
most "simple" cases.  Basically iterate over all points in the hole, and
all points in the outer ring, and find the shortest line between a pair
of points which doesn't intersect any of the line segments of the
rings.  This shouldn't be too hard to code up.  If performance is an
issue, indexing the outer ring is the answer, for both locating nearest
points and detecting intersections.

Hope this helps...  if you need code, I'd be happy to subcontract on
this....  8^)

Doug Smith wrote:

> Since you're so responsive -- I thought I'd ask another question.
>
> Can you recommend a technique for creating a "slice" that cuts from any
> interior polygons to the exterior boundary, essentially making a single
> polygon? Something like this:
>
> http://drop.io/mapster/asset/terr-openjump-union-jpg
>
> I've heard that FME by Safe can do this, but wondered if there was a
> programmatic technique I could use in JTS instead.
>
> Thanks!
>
> Doug
> ---
> Doug Smith
> ELP Web Developer
> http://www.daveramsey.com
>
> "Life is an occasion, rise to it" -- Mr. Magorium
> _______________________________________________
> jts-devel mailing list
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
>  

--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Polygon hole follow-up

Martin Davis
It's worth pointing out that this kind of "split polygon" is invalid
according to the OGC SFS spec.

Martin Davis wrote:

> There's nothing in JTS which will do this as a one-liner.
>
> I can think of a fairly simple brute-force algorithm which would work
> on most "simple" cases.  Basically iterate over all points in the
> hole, and all points in the outer ring, and find the shortest line
> between a pair of points which doesn't intersect any of the line
> segments of the rings.  This shouldn't be too hard to code up.  If
> performance is an issue, indexing the outer ring is the answer, for
> both locating nearest points and detecting intersections.
>
> Hope this helps...  if you need code, I'd be happy to subcontract on
> this....  8^)
>
> Doug Smith wrote:
>> Since you're so responsive -- I thought I'd ask another question.
>>
>> Can you recommend a technique for creating a "slice" that cuts from any
>> interior polygons to the exterior boundary, essentially making a single
>> polygon? Something like this:
>>
>> http://drop.io/mapster/asset/terr-openjump-union-jpg
>>
>> I've heard that FME by Safe can do this, but wondered if there was a
>> programmatic technique I could use in JTS instead.
>>
>> Thanks!
>>
>> Doug
>> ---
>> Doug Smith
>> ELP Web Developer
>> http://www.daveramsey.com
>>
>> "Life is an occasion, rise to it" -- Mr. Magorium
>> _______________________________________________
>> jts-devel mailing list
>> [hidden email]
>> http://lists.refractions.net/mailman/listinfo/jts-devel
>>
>>  
>

--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Polygon hole follow-up

Doug Smith-3
Makes sense. Thanks for your help. Maybe it would be possible to make
multiple, valid polygons that serve the same purpose. I'll play with a
couple experiments -- maybe the MapQuest API will render an invalid
polygon anyway.

Thanks again,

Doug

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Martin
Davis
Sent: Friday, January 23, 2009 4:35 PM
To: JTS Topology Suite Development
Subject: Re: [jts-devel] Polygon hole follow-up

It's worth pointing out that this kind of "split polygon" is invalid
according to the OGC SFS spec.

Martin Davis wrote:

> There's nothing in JTS which will do this as a one-liner.
>
> I can think of a fairly simple brute-force algorithm which would work
> on most "simple" cases.  Basically iterate over all points in the
> hole, and all points in the outer ring, and find the shortest line
> between a pair of points which doesn't intersect any of the line
> segments of the rings.  This shouldn't be too hard to code up.  If
> performance is an issue, indexing the outer ring is the answer, for
> both locating nearest points and detecting intersections.
>
> Hope this helps...  if you need code, I'd be happy to subcontract on
> this....  8^)
>
> Doug Smith wrote:
>> Since you're so responsive -- I thought I'd ask another question.
>>
>> Can you recommend a technique for creating a "slice" that cuts from
any
>> interior polygons to the exterior boundary, essentially making a
single

>> polygon? Something like this:
>>
>> http://drop.io/mapster/asset/terr-openjump-union-jpg
>>
>> I've heard that FME by Safe can do this, but wondered if there was a
>> programmatic technique I could use in JTS instead.
>>
>> Thanks!
>>
>> Doug
>> ---
>> Doug Smith
>> ELP Web Developer
>> http://www.daveramsey.com
>>
>> "Life is an occasion, rise to it" -- Mr. Magorium
>> _______________________________________________
>> jts-devel mailing list
>> [hidden email]
>> http://lists.refractions.net/mailman/listinfo/jts-devel
>>
>>  
>

--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Polygon hole follow-up

Martin Davis
In my experience rendering engines are more tolerant of geometry
topology than OGC is.  My guess is that you'll find that split polygons
render correctly.  Splitting is a common approach to working around
systems which don't support holes.  (This need for this function in FME
goes way back to the  early 90's, when Microstation couldn't represent
holes in IGDS files)

Doug Smith wrote:

> Makes sense. Thanks for your help. Maybe it would be possible to make
> multiple, valid polygons that serve the same purpose. I'll play with a
> couple experiments -- maybe the MapQuest API will render an invalid
> polygon anyway.
>
> Thanks again,
>
> Doug
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Martin
> Davis
> Sent: Friday, January 23, 2009 4:35 PM
> To: JTS Topology Suite Development
> Subject: Re: [jts-devel] Polygon hole follow-up
>
> It's worth pointing out that this kind of "split polygon" is invalid
> according to the OGC SFS spec.
>
> Martin Davis wrote:
>  
>> There's nothing in JTS which will do this as a one-liner.
>>
>> I can think of a fairly simple brute-force algorithm which would work
>> on most "simple" cases.  Basically iterate over all points in the
>> hole, and all points in the outer ring, and find the shortest line
>> between a pair of points which doesn't intersect any of the line
>> segments of the rings.  This shouldn't be too hard to code up.  If
>> performance is an issue, indexing the outer ring is the answer, for
>> both locating nearest points and detecting intersections.
>>
>> Hope this helps...  if you need code, I'd be happy to subcontract on
>> this....  8^)
>>
>> Doug Smith wrote:
>>    
>>> Since you're so responsive -- I thought I'd ask another question.
>>>
>>> Can you recommend a technique for creating a "slice" that cuts from
>>>      
> any
>  
>>> interior polygons to the exterior boundary, essentially making a
>>>      
> single
>  
>>> polygon? Something like this:
>>>
>>> http://drop.io/mapster/asset/terr-openjump-union-jpg
>>>
>>> I've heard that FME by Safe can do this, but wondered if there was a
>>> programmatic technique I could use in JTS instead.
>>>
>>> Thanks!
>>>
>>> Doug
>>> ---
>>> Doug Smith
>>> ELP Web Developer
>>> http://www.daveramsey.com
>>>
>>> "Life is an occasion, rise to it" -- Mr. Magorium
>>> _______________________________________________
>>> jts-devel mailing list
>>> [hidden email]
>>> http://lists.refractions.net/mailman/listinfo/jts-devel
>>>
>>>  
>>>      
>
>  

--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Loading...