<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Thank you for your email.<div><br></div><div>I did the same. First, I got the error "the kml is not defined in the openlayer 2.13" then I received no error message, but I still cannot see the kml map. </div><div>Even I added a code to my taskpane.html. Enable user to select the file from their local machine and add kml but again no error and no map. below is my code leveraged the map difinition from your code:</div><div><br></div><div>I also added the below script to use openlayer version 3.5.0</div><div><br></div><div> <script src="<a href="https://code.jquery.com/jquery-1.11.2.min.js">https://code.jquery.com/jquery-1.11.2.min.js</a>"></script></div><div>    <link rel="stylesheet" href="<a href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css</a>"></div><div>    <script src="<a href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js">https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js</a>"></script></div><div>    <link rel="stylesheet" href="<a href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.5.0/ol.css">https://cdnjs.cloudflare.com/ajax/libs/ol3/3.5.0/ol.css</a>" type="text/css"></div><div>    <script src="<a href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.5.0/ol.js">https://cdnjs.cloudflare.com/ajax/libs/ol3/3.5.0/ol.js</a>"></script></div><div><br></div><div><div>function addKML() {</div><div> </div><div> </div><div>    var map = parent.Fusion.getMapById('Map');</div><div>    var projection = ol.proj.get('EPSG:3857');</div><div><br></div><div>    var file = window.document.getElementById("selectfile").files[0];</div><div>    if (file) {</div><div>     </div><div>      var reader = new FileReader();</div><div>      reader.onload = function () {</div><div><br></div><div>        var vector = new ol.layer.Vector({</div><div>          source: new ol.source.Vector({</div><div><span style="white-space:pre">            </span>    </div><div>            url: reader.result,</div><div><span style="white-space:pre">                   </span></div><div>            format: new ol.format.KML()</div><div><span style="white-space:pre">                  </span><!-- extractStyles: true, --></div><div>            <!-- extractAttributes: true, --></div><div><span style="white-space:pre">                   </span><!-- maxDepth: 2, --></div><div><span style="white-space:pre">                   </span>  <!-- internalProjection: "EPSG:3857", --></div><div>            <!-- externalProjection: "EPSG:4326" --></div><div><span style="white-space:pre">                 </span><!-- }), --></div><div><span style="white-space:pre">                    </span><!-- visible: true --></div><div>          })<span style="white-space:pre"> </span></div><div>      <span style="white-space:pre">     </span>  </div><div>        });</div><div><span style="white-space:pre">            </span>     <span style="white-space:pre">             </span></div><div>        </div><div>       //vector.transform(srcProj, dest);</div><div>        parent.Fusion.getMapById('Map').oMapOL.addLayers(vector);</div><div><br></div><div>      }</div><div>      reader.readAsDataURL(file);</div><div><br></div><div>    }</div><div><br></div><div>  }</div></div><div><br></div><div><div><body></div><div><br></div><div><input id="selectfile" type="file" accept=".kml" onchange="addKML()"></div><div><br></div><div><div id="info">&nbsp;</div></div><div> </body></div></div><div><br></div><div>Please let me know what I am doing wrong?</div><div><br></div><div>Thanks</div><div>HA</div><div><br></div><div><br></div><div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 30, 2022 at 2:39 PM Gordon Luckett <<a href="mailto:gordon.luckett@arrowgeomatics.com">gordon.luckett@arrowgeomatics.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">For KML, you might have to do a number of things:<br><div><br></div><div>1. Add KML to your IIS Mime Type (i.e. ."kml" / "application/vnd" )</div><div>2. Add the KML Type to OpenLayers (2.13.1) <a href="https://cdnjs.cloudflare.com/ajax/libs/openlayers/" target="_blank">https://cdnjs.cloudflare.com/ajax/libs/openlayers/</a><b>2.13.1</b>/lib/OpenLayers/Format/KML.js  because this format is not bundled with the MapGuide 3.1.2 or 4 versions</div><div><br></div><div><br></div><div><br></div><div>for example, I added this to my maroon index.templ </div><div><br></div><div><script type="text/javascript" src="%__LIB_BASE__%/%__FUSION_SCRIPT__%.js"></script><br>%__SCRIPTS__%<br><b><script src="<a href="https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/lib/OpenLayers/Format/KML.js" target="_blank">https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/lib/OpenLayers/Format/KML.js</a>"></script></b><br></div><div><br></div><div><br></div><div><br></div><div> then added the following code to the "initPanelHandler" function:</div><div><br></div><div>var layer = new OpenLayers.Layer.Vector("KML", {<br>            strategies: [new OpenLayers.Strategy.Fixed()],<br>            protocol: new OpenLayers.Protocol.HTTP({<br>                url: "kml/lines.kml",<br>                format: new OpenLayers.Format.KML({<br>                    extractStyles: true, <br>                    extractAttributes: true,<br>                    maxDepth: 2<br>                })<br>            })<br>        });<br> Fusion.getMapById('Map').oMapOL.addLayer(layer);<br></div><div><br></div><div>and I had success adding KML to my Maroon Template...</div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 30, 2022 at 9:33 AM Hadis Alinia <<a href="mailto:hadissaalinia@gmail.com" target="_blank">hadissaalinia@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Does anyone have any idea why I can't see my kml file? Do you have any sample code that works for you? <br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <strong class="gmail_sendername" dir="auto">Hadis Alinia</strong> <span dir="auto"><<a href="mailto:hadissaalinia@gmail.com" target="_blank">hadissaalinia@gmail.com</a>></span><br>Date: Thu, May 26, 2022 at 9:27 AM<br>Subject: Re: [mapguide-users] download kml and upload kml in fusion<br>To: MapGuide Users Mail List <<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a>><br></div><br><br><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Gordon, <div><br></div><div>I am trying to script to upload a kml from local folder to my map. (I want the user to select the file from their local folder and be able to overlay (temporary) on the other exiting maps)</div><div>I placed a kml sample into my template folder and added a script to task pane as follows : I don't receive any error, but I can't see my map. I am not sure what is the issue?</div><div><br></div><div> </div><div><div>var source = new Proj4js.Proj('EPSG:4326'); </div><div>Proj4js.defs["EPSG:3857"]="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"</div><div>var dest = new Proj4js.Proj('EPSG:3857');</div><div><br></div><div>var geocoder = new google.maps.Geocoder();</div><div><br></div><div>function display_kmlmap()</div><div>{</div><div><br></div><div>var map = parent.Fusion.getWidgetById('Map');</div><div>var olMap = map.oMapOL;</div><div><br></div><div>            </div><div>var kmlmap = new parent.OpenLayers.Layer.vector("KML", "KML/sample.kml", {</div><div>   format: parent.OpenLayers.Format.KML,</div><div>   projection:  new parent.OpenLayers.Projection('EPSG:3857'),</div><div>   formatOptions: {</div><div>       'extractStyles': true,</div><div><span style="white-space:pre-wrap">        </span>   'extractAttributes': true</div><div>   }, </div><div>   visible: true</div><div>});<span style="white-space:pre-wrap">       </span></div></div><div><br></div><div>olMap.addLayers(kmlmap);<br></div><div><br></div><div><div><body onload="display_kmlmap()"></div><div><br></div><div>  </div><div>    <div id="map" class="smallmap"></div></div><div><br></div><div></body></div></div><div><br></div><div><br></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 18, 2022 at 11:48 AM Gordon Luckett <<a href="mailto:gordon.luckett@arrowgeomatics.com" target="_blank">gordon.luckett@arrowgeomatics.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Ajax (Basic Web Layout) does not support KML - the Fusion (Flexible Web Layout/Web Application) uses OpenLayers 2.13 and this does support KML parsing etc.<div><br></div><div><br><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 17, 2022 at 7:07 PM Hadis Alinia <<a href="mailto:hadissaalinia@gmail.com" target="_blank">hadissaalinia@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi, <div><br></div><div>I need to enable the user of my webmap application built by Mapguide to overlay their kml layers in ajax view or convert CSVs with lat and lon to a point data and then can download their points data as kml. Or select a feature of the uploaded layer and download it as a kml. Is that even possible in mapguide? I can't find an example searching on google.</div><div>Please advise</div><div><br></div><div>Thank you</div><div>HA</div></div>
_______________________________________________<br>
mapguide-users mailing list<br>
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapguide-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
</blockquote></div>
_______________________________________________<br>
mapguide-users mailing list<br>
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapguide-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
</blockquote></div>
</div></div>
_______________________________________________<br>
mapguide-users mailing list<br>
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapguide-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
</blockquote></div>
_______________________________________________<br>
mapguide-users mailing list<br>
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapguide-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
</blockquote></div>