Upgrade to Pro — share decks privately, control downloads, hide ads and more …

tuGIS 2010 Keynote - The More GIS Changes, the ...

Avatar for James Fee James Fee
October 06, 2011

tuGIS 2010 Keynote - The More GIS Changes, the More it Remains the Same

Avatar for James Fee

James Fee

October 06, 2011
Tweet

More Decks by James Fee

Other Decks in Technology

Transcript

  1. H

  2. CAD

  3. Problems with Wizards • Wizards cause us to conform •

    Options are either preset or confusing • Lack of documenting the process
  4. With the Command Line • Freedom to work with the

    data as you want • Better understanding of the commands • Combined with scripting you have a recipe for future work. AKA documentation!
  5. The “New” Way • Start up ArcCatalog (wait 2-4 min

    while it loads) • Browse for toolbox (clicking through the endless tree)
  6. The “New” Way • Start up ArcCatalog (wait 2-4 min

    while it loads) • Browse for toolbox (clicking through the endless tree) • Open tool dialog
  7. The “New” Way • Start up ArcCatalog (wait 2-4 min

    while it loads) • Browse for toolbox (clicking through the endless tree) • Open tool dialog • Browse for input dataset
  8. The “New” Way • Start up ArcCatalog (wait 2-4 min

    while it loads) • Browse for toolbox (clicking through the endless tree) • Open tool dialog • Browse for input dataset • Browse for any optional data for analysis
  9. The “New” Way • Start up ArcCatalog (wait 2-4 min

    while it loads) • Browse for toolbox (clicking through the endless tree) • Open tool dialog • Browse for input dataset • Browse for any optional data for analysis • Browse for an output location
  10. The “New” Way • Start up ArcCatalog (wait 2-4 min

    while it loads) • Browse for toolbox (clicking through the endless tree) • Open tool dialog • Browse for input dataset • Browse for any optional data for analysis • Browse for an output location • Fill out options
  11. The “New” Way • Start up ArcCatalog (wait 2-4 min

    while it loads) • Browse for toolbox (clicking through the endless tree) • Open tool dialog • Browse for input dataset • Browse for any optional data for analysis • Browse for an output location • Fill out options • Click OK and pray it doesn’t crash
  12. The “Classic” Way • Start up Command Prompt (about a

    second) • Type simple command (BUILD, CLIP, etc)
  13. The “Classic” Way • Start up Command Prompt (about a

    second) • Type simple command (BUILD, CLIP, etc) • Hit Enter
  14. The “Classic” Way • Start up Command Prompt (about a

    second) • Type simple command (BUILD, CLIP, etc) • Hit Enter • Tell everyone how hard it was
  15. Scripting With GIS • AML • SML • Avenue •

    Visual Basic for Applications *
  16. Scripting With GIS • AML • SML • Avenue •

    Visual Basic for Applications * • VBScript
  17. Scripting With GIS • AML • SML • Avenue •

    Visual Basic for Applications * • VBScript • JavaScript
  18. Scripting With GIS • AML • SML • Avenue •

    Visual Basic for Applications * • VBScript • JavaScript • Perl
  19. Scripting With GIS • AML • SML • Avenue •

    Visual Basic for Applications * • VBScript • JavaScript • Perl • Tcl
  20. Scripting With GIS • AML • SML • Avenue •

    Visual Basic for Applications * • VBScript • JavaScript • Perl • Tcl • Python
  21. Where is Python Used? • GIS Applications (ArcGIS, QGIS, Safe

    FME, Autodesk) • Web Frameworks (WeoGeo.com, Google) • Anywhere (Corel, Civilization, Gmail) • Become the de-facto scripting language
  22. ArcPy, the New Command Line • Much like the Arc

    prompt and AML, ArcPy and Python give us a powerful analysis and scripting method. • ArcPy builds on the commands we learned 15 years ago. • ArcPy is integrated in ArcMap • Python can be extended to other GIS platforms such as QGIS.
  23. Python Scripting With ArcPy import  arcpy   from  arcpy  import

     env   env.workspace  =  "c:/workspace"   #  variables
 in_features  =  "soils.shp"   clip_features  =  "study_boundary.shp"   out_feature_class  =  "c:/workspace/output/study_area_soils.shp"   xy_tolerance  =  ""   #  Execute  Clip   arcpy.Clip_analysis(in_features,  clip_features,
 out_feature_class,  xy_tolerance)
  24. Export to KML import  arcpy   arcpy.CheckOutExtension(“3D”)   env.workspace  =

     "c:/workspace"   #  variables
 in_feature  =  "c:/data/TIGER2009/04/ARIZONA/tl_2009_04_county.lyr"   out_feature  =  "c:/temp/output.kmz"   #  Execute  KML  Export   arcpy.LayerToKML_conversion(in_feature,  out_feature,1)
  25. Python Scripting With WeoGeo import  WeoGeoAPI   #Browse  my  WeoGeo

     Library   s  =  WeoGeoAPI.weoSession('http://jamesfee.weogeo.com',  'user',  'pass')   s.connectToMarket()   #Find  Data  Near  Tempe,  AZ   data  =  s.getDatasets('JSON',   '&data_type=VECTOR&per_page=2&page=1&north=33.5&south=33.2&west=-­‐111.99&eas t=-­‐111.91')   #print  the  JSON  response   print  data  
  26. Python Scripting With WeoGeo {          'per_page':

     2,          'total_entries':  34,          'current_page':  1,          'total_pages':  17,          'items':  [                  {                          'rating':  0.0,                          'projection':  'geo',                          'provider_margin':  1995.0,                          'uncompressed_misc_files_size':  7683891,                          'spatial_resolution':  0,                          'children_count':  0,                          'datum':  'WGS84',                          'library':  {                                  'name':  'Pitney  Bowes  -­‐  Business  Insight',                                  'id':  112                          },                          'kml_file_size':  0,                          'hosted':  True,                          'market':  'Complete',                          'center_lat':  38.8051135,                          'layers':  [                                  'all'                          ],                          'east':  -­‐74.986282,                          'votes':  0,                          'content_license':  {                                  'url':  'http:  //licenses.weogeo.com/licenses/8/original.PDF?1273263090',                                  'name':  'PBBI  Software  and  Data  End  User  License  v.  April  2008'                          },                          'data_type':  'VECTOR',                          'royalty_model':  'CREDITED',                          'west':  -­‐79.487651,                          'scales':  '6;7;8;9;10;11;12',                          'provider_discount_expires_at':  None,                          'boundaries':  {                                  'geo':  {                                          'proj4':  '+proj=latlong  +datum=wgs84',                                          'north':  '39.723622',                                          'west':  '-­‐79.487651',                                          'datum':  'WGS84',                                          'projection_datum':  'geo-­‐wgs84',                                          'east':  '-­‐74.986282',                                          'south':  '37.886605'                                  },                                  'tiles':  {                                          'number_of_lines':  '316',                                          'number_of_samples':  '316',                                          'datum':  'WGS84',                                          'line_pixel_size':  '-­‐830.510836842',                                          'sample_pixel_size':  '1585.72818023',                                          'proj4':  '+proj=merc  +a=6378137  +b=6378137  +lat_ts=0.0  +lon_0=0.0  +x_0=0.0  +y_0=0  +k=1.0  +units=m  +nadgrids=@null  +no_defs',                                          'projection_datum':  'spherical_mercator',                                          'west':  '-­‐8848524.83367',                                          'north':  '4825860.68838',                                          'east':  '-­‐8347434.72872',                                          'south':  '4563419.26394'                                  },                                  'native':  {                                          'number_of_lines':  '316',                                          'number_of_samples':  '316',                                          'datum':  'WGS84',                                          'line_pixel_size':  '-­‐830.510836842',                                          'sample_pixel_size':  '1585.72818023',                                          'proj4':  '+proj=merc  +a=6378137  +b=6378137  +lat_ts=0.0  +lon_0=0.0  +x_0=0.0  +y_0=0  +k=1.0  +units=m  +nadgrids=@null  +no_defs',                                          'projection_datum':  'spherical_mercator',                                          'west':  '-­‐8848524.83367',                                          'north':  '4825860.68838',                                          'east':  '-­‐8347434.72872',                                          'south':  '4563419.26394'                                  },                                  'data':  {                                          'proj4':  '',                                          'datum':  'WGS84',                                          'projection_datum':  'geo-­‐WGS84'                                  },                                  'baseimage':  {                                          'number_of_lines':  0,                                          'number_of_samples':  0,                                          'west':  '-­‐8848524.833673440000000',                                          'line_pixel_size':  0,                                          'sample_pixel_size':  0,                                          'proj4':  'spherical_mercator',                                          'projection_datum':  'spherical_mercator',                                          'north':  '4945185.028635530000000',                                          'east':  '-­‐8347434.728720820000000',                                          'south':  '4444094.923682910000000'                                  }                          },                          'tile_layer_type':  'xyz',                          'provider_discount_rate':  100,                          'provider_discount_expire_option':  True,                          'x_conv':  1,                          'parents_count':  0,                          'status':  'Approved',                          'north':  39.723622,                          'description':  '<b>StreetPro  USA</b><br>\nVersion  2009.12<br><br>  \nStreetPro  offers  users  a  premier  street-­‐level  data  product  featuring  accuracy  and  street  display  quality  unparalleled  in  the  industry.  It  reflects  real  world  geographic  conditions