-1

I have a kml with a polygon of the work area of a company.

I would like to blur the whole outside to clearly highlight this area is not in scope. Note: on the screen shot, the red edge is a style of the polygon. I'll remove it. Any idea on how to do this ?

example of blurred outer polygon

Code in the kml (removed unrelevant parts)

<?xml version="1.0" encoding="utf-8" ?>
<kml xmlns="http://www.opengis.net/kml/2.2">
    <Document id="root_doc">
        <Folder>
            <name>Angervilliers_AL8</name>
            <Placemark>
                <name>Angervilliers</name>
                <Style>
                    <LineStyle>
                        <color>ff0000ff</color>
                    </LineStyle>
                    <PolyStyle>
                        <fill>0</fill>
                    </PolyStyle>
                </Style>
                <Polygon>
                    <outerBoundaryIs>
                        <LinearRing>
                            <coordinates>1.8823674,48.5142152 1.8837864,48.5138449 ...</coordinates>
                        </LinearRing>
                    </outerBoundaryIs>
                </Polygon>
            </Placemark>
        </Folder>
    </Document>
</kml>
Franck
  • 257
  • 2
  • 10
  • There is no "blur" in the image you posted. Only a white overlay with opacity. To achieve that, create a polygon covering the whole earth (or the visible viewport) with a hole in it being the highlighted area. This question has been asked (and answered) several times here already. – MrUpsidown Sep 30 '19 at 08:42

1 Answers1

1

To get this effect, you'll want to create a larger polygon outline to cover the "blurred" area, and then an inner line for the "hole" in the polygon (the area you want to keep clear in the middle). These go in <outerBoundaryIs> and <innerBoundaryIs> tags inside your <Polygon> tag.

Below is a working example... try copy/pasting it into Earth Pro. Note also the <LookAt> section that forces the view to be zoomed in on the inner polygon, so the user won't notice the outer boundary of the polygon unless they zoom way out.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2">
    <Document id="root_doc">
        <name>Inverted Polygon Demo</name>
        <Placemark>
            <name>Angervilliers</name>
            <LookAt>
                <longitude>2.06384</longitude>
                <latitude>48.59146</latitude>
                <heading>0</heading>
                <tilt>0</tilt>
                <range>3000</range>
            </LookAt>               
            <Style>
                <LineStyle>
                    <color>ff0000ff</color>
                </LineStyle>
                <PolyStyle>
                    <fill>1</fill>
                    <color>88ffffff</color>
                </PolyStyle>
            </Style>
            <Polygon>
                <outerBoundaryIs>
                    <LinearRing>
                        <coordinates>
                            0.3184451839056446,47.78618899775447,0 3.661259487435122,47.80641551814697,0 3.695580055346501,49.36244976492695,0 0.2356130804739087,49.36861085533987,0 0.3184451839056446,47.78618899775447,0 
                        </coordinates>
                    </LinearRing>
                </outerBoundaryIs>
                <innerBoundaryIs>
                    <LinearRing>
                        <coordinates>
                            2.058365295534554,48.59459332179971,0 2.055806623017014,48.59347610558855,0 2.051167395626068,48.59309196143701,0 2.053826722439367,48.59152032273916,0 2.059404688365358,48.5906235533257,0 2.058795280866135,48.58977412250532,0 2.053976866512941,48.58818157946221,0 2.055353500059218,48.58521810150005,0 2.060326614008405,48.58453057119874,0 2.06261321438489,48.59037827408845,0 2.065888887077823,48.59124861689973,0 2.071575394540492,48.59109027523166,0 2.075460981003194,48.59050363005721,0 2.077744729364595,48.59052448781961,0 2.078079473747407,48.59149049454836,0 2.072318523336512,48.59352956508539,0 2.072078869584328,48.59455791455283,0 2.068689814773501,48.59359361048438,0 2.068109548294674,48.59488295734163,0 2.064472047819985,48.5969248658065,0 2.060703393863961,48.59688230010441,0 2.058365295534554,48.59459332179971,0 
                        </coordinates>
                    </LinearRing>
                </innerBoundaryIs>                  
            </Polygon>
        </Placemark>
    </Document>
</kml>
Christiaan Adams
  • 1,257
  • 1
  • 7
  • 13
  • Yeah, excellent, works perfect. Aside, got an issue with negative numbers boundaries. Boundaries have to be couter clock wise ordered. if no neg number, it can be [1,1], [2,1], [2,2], [1,2], [1,1]. But with neg numbers, number have to be ordered counter clock wise considering neg number +360, eg example above has to be ordered [-1,1], [-1,2], [2,2], [2,1], [-1,1], as if -1 = 360-1 = 359 (according to pratical experience of the 3 hours I spent on this...). Thanks again for your answer, starting from a working example helped me a lot to digg into this. (sorry , cant vote as not enough reputa.) – Franck Nov 02 '19 at 13:28