Use "FindNext" in KML Text File

JonMulder

Registered User.
Local time
Today, 13:22
Joined
Apr 9, 2011
Messages
23
Greetings,

I'm trying to write a KML text file using snippets from another KML text file.

Previously, I would import a KML file into Access and use the FindFirst method to find a psrticular piece of code then use a Do Loop for getting the next few lines. However, I'm now working with files whose line size exceeds the ~65,000 Memo Field size property.

Essentially, I want to open a KML text file, find the tag that identifies the placemark, then use "FindNext" to locate the line that contains "<MultiGeometry>" and copy that line and the next few lines until I get to a line that says "/<MultiGeometry>".

For example, in the snippet below, I would use an Instr function to locate that unique line that identifies the placemark ("<td>010</td>"), then locate the next line below that line that contains "<MultiGeometry>" and loop through the lines until I reach "/MultiGeometry>".

Thanks for any help you can provide.

Jon Mulder, Geologist
California Department of Water Resources



<tr bgcolor="#D4E4F3">
<td>DAU_CODE</td>
<td>010</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
]]></description>
<styleUrl>#PolyStyle00</styleUrl>
<MultiGeometry>
<Polygon>
<extrude>0</extrude><altitudeMode>clampToGround</altitudeMode><tessellate>1</tessellate>
<outerBoundaryIs><LinearRing><coordinates> -120.6992896418547,41.99269134777702,0 -120.699890858858,41.99300910918333,0 -120.7002641588749,41.99332728144658,0 -120.7005970432247,41.99355462400887,0 -120.7010764712836,41.99379124480306,0 -120.7046170510484,41.99381116517582,0 -120.7079325500405,41.99385045732644,0 -120.7266659613325,41.99370513081517,0 -120.7312490233655,41.99374639801172,0 -120.7510762561678,41.99367288649727,0 -120.7510759380764,41.99374505475953,0 -120.763663526097,41.99359025316132,0 -120.8760824279535,41.99365011806081,0 -120.8760823204533,41.9937177755882,0 -120.8967605119085,41.99352675515867,0 -120.9161361875154,41.99338041076423,0 -120.9356161790394,41.99351195266497,0 -120.9580477432869,41.99315643327118,0 -120.974420021636,41.99291983723002,0 -120.9900804311719,41.99302385311687,0 -121.0010883302587,41.99305878535861,0 -121.0092304651458,41.9932137418014,0 -121.0290237913488,41.99322213498414,0 -121.0483121059039,41.99375483843428,0 -121.0694070729183,41.99466544091242,0 -121.087098979128,41.99514200554132,0 41.99269134777702,0</coordinates></LinearRing></outerBoundaryIs>
</Polygon>
</MultiGeometry>
</Placemark>
<Placemark id="ID_00001">
<name></name>
<Snippet></Snippet>
<description><![CDATA[<html
 
I'm not sure what "KML" is. You can read "XML" files directly. You don't have to process them as text.
 
KML stands for "Keyhole Markup Language". It's very similar to HTML. So, I assume whatever procedures are used in HTML for "finding next" occurence of a string would work. I'm fairly proficient at Access VBA, but haven't done a whole bunch or raw file manipulation.
 
As far as I know, this isn't a file type that Access recognizes. If it is plain text, you can open it as you would a text file and read it record by record. You will not be able to use any find method since it is not a "table" type file that you would open as a recordset. It is a sequential text file without keys and indexes and all the operations are different.

You could try telling Access that this is an XML file but no guarantees that will work.
 
Thanks Pat. I'll work on it tonight and post back if I'm successful.
 

Users who are viewing this thread

Back
Top Bottom