11 Replies Latest reply on Dec 14, 2012 7:19 AM by ottomuller

    How can I export a Preview as text with a .kml extension?

    ottomuller

      Other IOS apps can import kml files. I have a database with thousands of Placemarks which I can now search with Go. I would like to be able to select a few and output their location, name and description as a kml file. Google Fusion Tables allows me to do this if I have web access, but these placemarks are geology field trip stops, and many are not within cell phone service areas. MaPublisher will import the kml files and display them on maps stored within the iPod.

       

      On my desktop FM I wrote up an XLST to output all the data as a nice, tidy, kml file. But Go has no XML option for output.

       

      So I used the following in a calculation field:

       

      kml ="<Placemark>¶<name>"&name&"</name>¶<description>"&description&"</description>¶"&geometry&"¶</Placemark>"

       

      Adding an appropriate Title Header and Trailing Grand Summary, I can save the Preview as a pdf, open it in Acrobat, extract the text, and save that as a text file. Then if I change the extension to .kml, Google Earth opens it.

       

      Using Go, I can print to a pdf and that file is the same as the one on the desktop. But I can't figure out how to get the text out of it and into a kml file while on the iPod.

       

      My hunch is that Apple is very touchy about letting users change extensions, etc., for security reasons. But if FileMaker were able to output the Preview as text with a .kml extension, this wouldn't be different from some GPS program outputting kml files.

       

      I submitted this as a Feature Request, but thought I'd toss it out in this Forum to see if there are workarounds...

        • 1. Re: How can I export a Preview as text with a .kml extension?
          ottomuller

          I developed a workaround and posted it over on the Avenza forums, but thought folks here might find it of interest, also:

           

          Field scientists often work out of cell phone range.  PDF Maps is an excellent platform for them to use to enter data, letting them export the data later when back in the world of WiFi or cell phones.  (I can post more on this if anyone is interested...)  Filemaker has a free mobile app called FileMaker Go, which permits users to download a database and then access it in the field.   I have developed the following workflow to get the two apps to play well together.  Others may have better ways to do this...


          1. Start with a Filemaker Pro 12 database, and set up a calculation field which will combine all of the data you wish from one record.  In my case, I have about 3,000 locations (stops) which NYSGA trips have visited over the years.  There are lots of fields permitting users to search effectively: the number of words in the Description field, the latitude and longitude, etc.  But on PDF Maps placemarks I need only the name, the ID of the stop (which includes the year, trip and stop number), the leader of the trip, and the stop description.


          PDF Maps uses the Schema method for Extended Data, so we need to stick some extra text around these fields.  The Calculation field I came up with is:


          "      <Placemark>

                 <styleUrl>#pdfmaps_style_red</styleUrl>

                 <ExtendedData>

                  <SchemaData schemaUrl=\"#schema0\">

                  <SimpleData name=\"ID\"><![CDATA[" & ID &" ]]></SimpleData>

                  <SimpleData name=\"Description\"><![CDATA[" & description & "]]></SimpleData>

                  <SimpleData name=\"Leaders\"><![CDATA[" & leader & "]]></SimpleData>

                  </SchemaData>

                 </ExtendedData>

                 <name><![CDATA[" &  name & "]]></name>

                 <Point><coordinates>"  & coords & "</coordinates></Point>

                </Placemark>

          "


          Of course, you should modify this to fit your needs, substituting your names for ID, Description and Leaders, etc.


          2. Set up a layout for export which contains only this field.


          3.  Import your database into FileMaker Go.


          4.  Out in the boondocks, search for whatever placemarks you wish, limiting your search by lat and long to the area of the geo pdf map you wish to use.  Refine your search, if necessary, so that you have fewer than 500 placemarks.  Export your results as a .tab file, using the export layout you made earlier.


          5. Use a text editor on your mobile device to modify this .tab file.  I have found Textastic (~$10) to work well. 


            5a.  You need to add the kml header stuff at the beginning.  I have found the following to work with PDF Maps:


          <?xml version="1.0" encoding="UTF-8"?>

          <kml xmlns="http://www.opengis.net/kml/2.2">

          <Document>

            <Style id="pdfmaps_style_red">

             <IconStyle>

              <Icon>

               <href>http://download.avenza.com/images/pdfmaps_icons/v2/pin-red-inground.png</href>

              </Icon>

              <hotSpot x="9"  y="0" xunits="pixels" yunits="pixels" />

             </IconStyle>

            </Style>

            <Schema name="" id="schema0">

             <SimpleField name="Year" type="string"></SimpleField>

             <SimpleField name="Trip" type="string"></SimpleField>

             <SimpleField name="Leaders" type="string"></SimpleField>

                <SimpleField name="PDFMaps_photos" type="string"><displayName>Photos</displayName></SimpleField>

            </Schema> 


          Once again, however, this needs to be adjusted for your values...


            5b.  You need to add the </Document> and </kml> tags at the end.


            5c.  You need to change the file extension from .tab to .kml.  


            5d.  If you have exported fields which contained carriage returns in FileMaker Pro (in my case the Description field often contains these), you will need to find and replace the vertical tabs (\x0b) with returns (\r) with regular expressions enabled.


          6.  From your text editor choose "Open in..." and PDF Maps should show up.  Click on it.


          7.  In PDF Maps, if the map you wish to use is open, the placemarks should appear.  If not, open it and and the placemarks which were sent from the text editor will be in the "Previously Imported" page.


          8.  After the placemarks load, it may be desirable to collect them into a folder and rename the folder with the search terms used in FileMaker Go.




          Bear in mind that this is an early effort, just trying to get something that will work in the boondocks.  My database is unique and what works for me may not work for others. 


          • 2. Re: How can I export a Preview as text with a .kml extension?
            beverly

            You can CHANGE the extension manually after export. Or you can name the file in a script with the correct extension. Or you can export as XML, perhaps using an XSLT to transform what you need, again naming the file as part of a script. 

             

            I export XML to .kml - sometimes using calculated and sometimes transforming.

             

            "preview" may not be what you meant.

             

            To get the correct XML the transform method can contain the necessary syntax without relying on the user knowing what to add in a text editor later.

             

            -- sent from my iPhone4 --

            Beverly Voth

            --

            • 3. Re: How can I export a Preview as text with a .kml extension?
              beverly

              Sorry, I got your first post this morning (after the second one and my reply)...

               

              I see that you did try XSLT and that it works from desktop. You are trying to get this from FMGo. You are correct, no export as xml on Go. But did you try a scripted export, NAMING the file? Does FMGo allow that? (I just haven't tried).

               

              Beverly

              • 4. Re: How can I export a Preview as text with a .kml extension?
                ottomuller

                I think what I did was make a pseudo xslt with the calculation field...

                 

                My initial efforts tried exporting with Summary fields, etc., putting the appropriate kml stuff into the file that way.  But the only way Go would output this was within a pdf file, and I didn't see a way to convert that into a txt or kml file while staying in an iPad unconnected to the web.  So now I export field data in tab format and tinker with it and add the kml stuff within another app.

                 

                At this point it works OK, but what I'd like to see is an option to export reports as txt files (or, better yet, as kml files).  Then I could go back to sticking all the kml stuff back into Headers and Grand Summaries and avoid using another app.

                 

                Thanks for your comments...

                 

                Otto --

                • 5. Re: How can I export a Preview as text with a .kml extension?
                  ottomuller

                  Knowing that my workaround is awkward, at best, I put together a presentation (Keynote, ppt, and pdf) explaining in a better, step by step way, how to do this: http://ottohmuller.com/Go2PDFMaps/

                   

                  Otto --

                  • 6. Re: How can I export a Preview as text with a .kml extension?
                    BruceRobertson

                    Seems very interesting. And - I have a daughter who does habitat survey data collection and analysis, which involves GIS data, in Colorado, but - somehow they are not using FMGO or iPads yet!,

                    • 7. Re: How can I export a Preview as text with a .kml extension?
                      beverly

                      Very interesting, Otto! It should be pointed out that Export Field Contents (as text) on iOS is supposed to give the correct UTF-8, so your workaround is probably not needed. Have you tried to export with all the headers/footer directly in a single field? Can a script change the extension for you?

                       

                      Thanks for posting!

                      Beverly

                      1 of 1 people found this helpful
                      • 8. Re: How can I export a Preview as text with a .kml extension?
                        ottomuller

                        Thank-you, Beverly!

                         

                        I had been under the mistaken impression that those vertical tabs would always be output.  But, following up on your suggestion, I've learned that this isn't true, and I can just save the export field, change the extension, and it opens in PDF Maps.  I haven't tried changing the extension with a script, or getting a script to output a found set of fields... but then, I was wondering what I might do this weekend.

                         

                        Thanks, again,

                        Otto --

                        • 9. Re: How can I export a Preview as text with a .kml extension?
                          ottomuller

                          Thanks, again, BEVERLY!!!

                           

                          So it is possible.  I can now go directly from Go to PDF Maps, Placemarks stay orgainized within a folder, Google Earth imports the same files.  Life is good.  I'll gussy it up a tad and stick a file up on the web with a few dozen Placemarks, so anyone can modify it for their own needs.  Give me a few days...

                           

                          Otto --

                          • 10. Re: How can I export a Preview as text with a .kml extension?
                            beverly

                            I'm looking forward to it, Otto!

                            Beverly

                            • 11. Re: How can I export a Preview as text with a .kml extension?
                              ottomuller

                              Hi all,

                               

                              OK, you can find it here:  http://ottohmuller.com/Go2PDFMaps/

                               

                              There's a reasonable description on the page where you land, so no need to repeat it here.  I ended up putting in the whole database, 7.6 MB, zipped.  Any feedback would be appreciated.

                               

                              Thanks,

                              Otto --