Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import clr | |
| import sys | |
| print sys.version | |
| sys.path.append(r"C:\GIS") | |
| lb = clr.AddReference('SampleClassLibrary') #add .dll file | |
| from SampleClassLibrary import Calculator | |
| c = Calculator() | |
| print "Result is", c.DoSum(1,2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import PyPDF2 | |
| pdf_in = open('doc.pdf', 'rb') | |
| pdf_reader = PyPDF2.PdfFileReader(pdf_in) | |
| pdf_writer = PyPDF2.PdfFileWriter() | |
| for pagenum in range(pdf_reader.numPages): | |
| page = pdf_reader.getPage(pagenum) | |
| print pagenum | |
| if pagenum in [1,4,5]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## -*- coding: UTF-8 -*- | |
| import os | |
| from collections import defaultdict | |
| from comtypes.client import GetModule, CreateObject | |
| from snippets102 import GetStandaloneModules, InitStandalone | |
| GetStandaloneModules() | |
| InitStandalone() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import arcpy | |
| def get_points_along_line(input_line_feature, interval, number_of_points): | |
| '''given a single polyline feature shape will return a list of point features | |
| positioned along the line at set intervals''' | |
| out_pnts = [] | |
| intervals_list = [] | |
| if number_of_points: | |
| interval = input_line_feature.length / number_of_points |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import PyPDF2 | |
| watermark_pdf_path = r"C:\GIS\Temp\pdfs\MapWatermark.pdf" | |
| pdf_path = r"C:\GIS\Temp\pdfs\MapImage.pdf" | |
| map_pdf = open(pdf_path, 'rb') | |
| watermark_pdf = open(watermark_pdf_path, 'rb') | |
| pdfReader = PyPDF2.PdfFileReader(map_pdf) | |
| pdfWatermarkReader = PyPDF2.PdfFileReader(watermark_pdf) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| This code shows how to hide/show map grids in a map document before exporting the map. | |
| This can be handy when you have multiple grids with different grid cell size and you | |
| want to be able to control at what map scales each of the map grids should be visible. | |
| As this is not exposed via arcpy, you have to use ArcObjects. | |
| This code assumes there are two grids for the data frame with the name `small` and `large` | |
| ''' | |
| import sys | |
| from comtypes.client import GetModule, CreateObject |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| This code provides access to a map document layout MapsurroundElement such as scale bar. | |
| In order to use this code, you would need to have a map document with a pre-created | |
| scale bar. | |
| ''' | |
| import sys | |
| from comtypes.client import GetModule, CreateObject | |
| from snippets102 import GetStandaloneModules, InitStandalone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import arcpy | |
| arcpy.env.overwriteOutput = True | |
| #---------------------------------------------------------------------- | |
| def create_convex_hull(in_fc, grouping_field=None): | |
| """ | |
| generate convex hull features optionally grouping input features; | |
| if no grouping_field specified, a single Convex Hull will be generated | |
| for all input features | |
| """ |