I solved it. As per Rossko suggestiong of creating  holes in the
polygon while generating KML files. This answer is for anyone who is
still searching:

Check if polygons are overlapping if so get the overlapping polygons
geography or polygon data and while generating KML add them under
<innerBoundaryIs> of the container one. say for e.g Zipcode A overlaps
zipcode B then you can add zipcode B's geographic data into
<innerBoundaryIs> of Zipcode A.

To find out if two polygons intersect what I did was, I get the list
of zipcodes and its corresponding geography instance, loop through
each one and check if it overlaps:

say sourceZipcode = collection[0].zipcode, souceGeography=
collection[0].geography

for(int i=0;i<collection.count;i++)
{
                if (!collection[j].Zipcode.Equals(sourceZipcode ) &&
collection[j].Geography.STDifference(souceGeography).STNumPoints() ==
0)
                {
                  GeoData newData = new GeoData{ Zipcode = zipcode,
OverlappingZipcode = geoCollection[j].Zipcode, OverlappingGeography =
geoCollection[j].Geography };
                  //check if entry exists
                  if (!_overlappingPolygons.Exists(s => s.OverlappingZipcode ==
newData.OverlappingZipcode &&
s.OverlappingGeography.STEquals(newData.OverlappingGeography).IsTrue))
                  {
                        //there is a overlapping polygon add it to list.
                        _overlappingPolygons.Add(newData);
                  }
                }
}

this way I have the overlappingpolygons for the zipcode under check
and add them to innerboundaryIs tag.

On May 27, 10:18 am, GAPINewbie <[email protected]> wrote:
> Yes I did see that in Google earth using Altitude we can make some
> differentiation.
>
> Am not sure I understand your suggestion about creating polygon's with
> holes. My understanding is that the geographic data(from the source
> census.gov) would take care of holes if any. But am guessing may be
> the data is messed up? Sorry am pretty new to this KML/Geo spatial
> stuffs. Can you give me some e.g. how to go about creating holes in
> the polygons while generating my KML.
>
> On May 17, 6:16 pm, Rossko <[email protected]> wrote:
>
>
>
>
>
>
>
> > > I was wondering if its possible to identify which polygon was clicked
> > > on the overlapping polygons.
>
> > If we can't tell which one the user intended to click, I'm not sure
> > how the code could.   In Google Earth you could give them some
> > altitude, but maps are flat so that won't work here.
>
> > > In my application I generate KML file ...
>
> > Generate unambiguous KML ; you can create polygons with holes in,
> > where your 'overlapping' poly can fit.  This should deal with 'island'
> > zipcodes inside other zipcodes.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to