<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Loading .mxd file into workspace with arcgisscripting in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/loading-mxd-file-into-workspace-with/m-p/157208#M5270</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am fairly new to GIS and have what is probably a simple problem, but I cannot figure out how to solve it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to convert data from a .MXD file into KML. Doing this using ArcMap is a fairly simple task. I can even understand the steps to run in Python which are simple enough. However, I have no idea how to get all the data from the .MXD file into my workspace prior to running the conversion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have used the example script that is provided in the desktop help and included it below. What I seem to be missing is that in their example, they simply load the .mxd file as the "in_map_document" parameter. I tried this, replacing the "myMap.mxd" with our own file and, though it does return a small amount of data, it is completely useless.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I need to do is actually open the .mxd file into a workspace as there are a number of queries that need to run to retrieve information from the DB prior to doing the MapToKML conversion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have searched high and low for this and even searched these forums, but no luck. My apologies if this has been answered in a previous post.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The example script is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;----------------------------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Purpose: Converts a Map to KML.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import standard library modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys, string, os, arcgisscripting&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Create the Geoprocessor object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp = arcgisscripting.create()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.workspace = "/myHost/myDocuments/"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.toolbox = "3D"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;in_map_document = "myMap.mxd"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;data_frame = "Layer"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;out_kmz_file = /myHost/myDocuments/myKML_out&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map_output_scale = "24000"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is_composite = "COMPOSITE"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is_vector_to_raster = "VECTOR_TO_VECTOR"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;extent_to_export = "-117 33 -115 35"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;image_size = "1024"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dpi_of_client = "96"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Converting to KML'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.maptokml_3d (in_map_document, data_frame, out_kmz_file, map_output_scale, is_composite, is_vector_to_raster, extent_to_export, image_size, dpi_of_client)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Finished KML Generation'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;except:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddMessage(gp.GetMessages(2))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print gp.GetMessages(2)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 16 Jan 2011 08:33:04 GMT</pubDate>
    <dc:creator>RonaldIngraham</dc:creator>
    <dc:date>2011-01-16T08:33:04Z</dc:date>
    <item>
      <title>Loading .mxd file into workspace with arcgisscripting</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/loading-mxd-file-into-workspace-with/m-p/157208#M5270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am fairly new to GIS and have what is probably a simple problem, but I cannot figure out how to solve it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to convert data from a .MXD file into KML. Doing this using ArcMap is a fairly simple task. I can even understand the steps to run in Python which are simple enough. However, I have no idea how to get all the data from the .MXD file into my workspace prior to running the conversion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have used the example script that is provided in the desktop help and included it below. What I seem to be missing is that in their example, they simply load the .mxd file as the "in_map_document" parameter. I tried this, replacing the "myMap.mxd" with our own file and, though it does return a small amount of data, it is completely useless.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I need to do is actually open the .mxd file into a workspace as there are a number of queries that need to run to retrieve information from the DB prior to doing the MapToKML conversion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have searched high and low for this and even searched these forums, but no luck. My apologies if this has been answered in a previous post.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The example script is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;----------------------------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Purpose: Converts a Map to KML.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import standard library modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys, string, os, arcgisscripting&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Create the Geoprocessor object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp = arcgisscripting.create()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.workspace = "/myHost/myDocuments/"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.toolbox = "3D"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;in_map_document = "myMap.mxd"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;data_frame = "Layer"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;out_kmz_file = /myHost/myDocuments/myKML_out&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map_output_scale = "24000"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is_composite = "COMPOSITE"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is_vector_to_raster = "VECTOR_TO_VECTOR"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;extent_to_export = "-117 33 -115 35"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;image_size = "1024"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dpi_of_client = "96"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Converting to KML'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.maptokml_3d (in_map_document, data_frame, out_kmz_file, map_output_scale, is_composite, is_vector_to_raster, extent_to_export, image_size, dpi_of_client)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Finished KML Generation'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;except:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddMessage(gp.GetMessages(2))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print gp.GetMessages(2)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Jan 2011 08:33:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/loading-mxd-file-into-workspace-with/m-p/157208#M5270</guid>
      <dc:creator>RonaldIngraham</dc:creator>
      <dc:date>2011-01-16T08:33:04Z</dc:date>
    </item>
  </channel>
</rss>

