تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
كود استخراج الاحداثيات من ملف نصي
#1
السلام عليكم
لدي ملف نصي نوع kml اريد كود استخراج الاحداثيات منه 
والمحصور بين عبارة <coordinates> و <coordinates>/
كود :
<?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" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
    <name>KmlFile</name>
    <StyleMap id="m_ylw-pushpin">
        <Pair>
            <key>normal</key>
            <styleUrl>#s_ylw-pushpin</styleUrl>
        </Pair>
        <Pair>
            <key>highlight</key>
            <styleUrl>#s_ylw-pushpin_hl</styleUrl>
        </Pair>
    </StyleMap>
    <Style id="s_ylw-pushpin_hl">
        <IconStyle>
            <scale>1.3</scale>
            <Icon>
                <href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
            </Icon>
            <hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
        </IconStyle>
        <LineStyle>
            <color>ff7f0000</color>
        </LineStyle>
        <PolyStyle>
            <color>ff7faa55</color>
        </PolyStyle>
    </Style>
    <Style id="s_ylw-pushpin">
        <IconStyle>
            <scale>1.1</scale>
            <Icon>
                <href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
            </Icon>
            <hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
        </IconStyle>
        <LineStyle>
            <color>ff7f0000</color>
        </LineStyle>
        <PolyStyle>
            <color>ff7faa55</color>
        </PolyStyle>
    </Style>
    <Placemark>
        <name>مضلع بلا عنوان</name>
        <styleUrl>#m_ylw-pushpin</styleUrl>
        <Polygon>
            <tessellate>1</tessellate>
            <outerBoundaryIs>
                <LinearRing>
                    <coordinates>
                        42.35252111958764,26.01014510110572,0
                        42.35266445670693,26.01009331150689,0
                        42.35272916818335,26.01023364187699,0
                        42.35259338425555,26.01028743260356,0
                        42.35252111958764,26.01014510110572,0
                    </coordinates>
                </LinearRing>
            </outerBoundaryIs>
        </Polygon>
    </Placemark>
</Document>
</kml>
اللهم لا علم لنا إلا ما علمتنا
http://www.facebook.com/samira.abdalla.980
الرد }}}
تم الشكر بواسطة:
#2
كود :
       Dim kml As String = IO.File.ReadAllText("TextFile1.txt")
       Dim Regex As New System.Text.RegularExpressions.Regex("<\s*coordinates[^>]*>(.*?)<\s*/\s*coordinates>", System.Text.RegularExpressions.RegexOptions.Singleline)
       Dim results As New Text.StringBuilder
       For Each m As Text.RegularExpressions.Match In Regex.Matches(kml)
           Dim coordinates As String = m.Value
           coordinates = coordinates.Replace("<coordinates>", "").Replace("</coordinates>", "").Trim
           For Each Line In coordinates.Split(vbNewLine)
               results.Append(Line.Trim)
               results.Append(vbNewLine)
               results.Append("-----------------------------")
               results.Append(vbNewLine)
           Next
       Next
       MsgBox(results.ToString)
الرد }}}
تم الشكر بواسطة: samira20



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم