0
지도에 점을 생성하는 Google지도 및 ashx 처리기를 사용하는 데 문제가 있습니다. 이전에 많이 사용했기 때문에 정말 이상한 일이지만 문제는 없습니다.ashx 처리기 및 Google지도가 표시되지 않음
핸들러는 정상적으로 작동하지만 점은 맵에 표시되지 않습니다.
그래서 생성 된 파일은 다음과 같습니다<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Placemark>
<name>Bla</name>
<description><div class="ExternalClassEA84F87DED7745D594D3D4236376E796">dfdfg</div></description>
<Point>
<coordinates>19.8106635766601,41.3390789318785</coordinates>
</Point>
</Placemark>
</Document>
</kml>
참고 : 나는 구글 사이트에서이 KML 파일을 업로드하고 잘 작동하는 KML URL을 사용하는 경우 :/
나는 일반을 만드는 데 사용할 코드를 처리기는 다음과 같습니다.
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
context.Response.ContentType = "application/vnd.google-earth.kml+xml";
context.Response.AddHeader("Content-Disposition", "attachment; filename=Pikat.kml");
context.Response.Expires = -1;
XmlTextWriter kml = new XmlTextWriter(context.Response.OutputStream, System.Text.Encoding.UTF8);
kml.Formatting = Formatting.Indented;
kml.Indentation = 3;
kml.WriteStartDocument();
kml.WriteStartElement("kml", "http://www.opengis.net/kml/2.2");
kml.WriteStartElement("Document");
String place = String.Empty;
place = context.Request.QueryString["place"];
if (!String.IsNullOrEmpty(place))
{
#region Places Of Interests
SPListItemCollection places = this.GetPlacesOfInterest(context);
kml = GeneratePlacemarkElementForPlaceOfInterests(kml, places, context);
#endregion
}
private XmlTextWriter GeneratePlacemarkElementForPlaceOfInterests(XmlTextWriter kml, SPListItemCollection places, HttpContext context)
{
int i = 0;
if (places != null)
{
foreach (SPListItem item in places)
{
kml.WriteStartElement("Placemark");
kml.WriteAttributeString("id", String.Format("{0}", i + 1));
// kml.WriteElementString("id", String.Format("{0}", Cases.IndexOf(item) + 1));
kml.WriteElementString("name", item["Title"].ToString());
string HtmlDesc = String.Format(@"<Table width='300px'>
<tr><td><b>Titulli: </b></td><td>{0}</td></tr>
<tr><td><b>Kategoria: </b></td><td>{1}</td></tr>
<tr><td><b>Adresa:</b> </td><td>{2}</td></tr>
<tr><td><b>Pershkrimi:</b> </td><td>{3}</td></tr>
<tr><td><b>Orari:</b> </td><td>{4}</td></tr>
<tr><td><b>Me shume:</b> </td><td>{5}</td></tr>
</table><br/>",
item["Title"] == null ? "--" : item["Title"].ToString(),
item["Category"] == null ? "--" : item["Category"].ToString(),
item["Address"] == null ? "--" : item["Address"].ToString(),
item["Description"] == null ? "--" : item["Description"].ToString(),
item["HoursOfOperation"] == null ? "--" : item["HoursOfOperation"].ToString(),
item["SiteUrl"] == null ? "--" : item["SiteUrl"].ToString());
kml.WriteElementString("description", HtmlDesc);
// show the Geometry
kml.WriteStartElement("Point");
string x = item["Longitude"].ToString(); string y = item["Latitude"].ToString();
kml.WriteElementString("coordinates", String.Format("{0},{1}", x, y));
kml.WriteEndElement(); // </Point>
kml.WriteEndElement(); // </Placemark>
i++;
}
}
return kml;
어떻게 화재 벽 문제를 해결 했습니까? – user3095420