This file contains 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 re | |
import arcpy | |
for toolbox in arcpy.ListToolboxes(): | |
wildcard = re.search(r"\((\w+)\)", toolbox).group(1) | |
for tool in arcpy.ListTools("*_%s"%wildcard): | |
print toolbox, tool, arcpy.Usage(tool) |
This file contains 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
''' | |
1. Open ArcMap and add the desired feature dataset to it. | |
2. Zoom to the extent that you want to export. | |
3. Open the Python prompt. | |
4. Paste the code below into it and hit Enter. | |
5. Go to where out_fgdb points to, then copy the export_fgdb.gdb.zip file and send it out. | |
''' | |
import shutil | |
import os |
This file contains 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
dict((section, dict(cfg_parser.items(section))) for section in cfg_parser.sections()) |
This file contains 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 sys | |
import os | |
import copy | |
import arcpy | |
def get_field_values(fc, field, where=""): | |
''' | |
@return: A list of the values for the given field in the given feature class | |
with the given optional where clause applied. |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Microsoft.Win32; | |
namespace RegistryUpdateForIEScriptProblem | |
{ | |
class Program | |
{ |
This file contains 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
#requires http://www.pythonware.com/products/pil/ or https://github.com/python-pillow/Pillow | |
import Image, ImageFont, ImageDraw | |
def add_number(number): | |
'''Add the number to the center of an icon and save it to a new image | |
Useful for generating multiple icons''' | |
image = Image.open(r'C:\python\temp\bd.png') | |
font=ImageFont.truetype("arial.ttf", 55) #, encoding='utf-8') | |
draw=ImageDraw.Draw(image) | |
x=(image.size[0]-draw.textsize(number,font)[0])/2 |
This file contains 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 urllib | |
import urllib2 | |
import json | |
def get_portal_security_token(portal_url, portal_admin_user, portal_admin_password, expiration=60): | |
''' | |
Returns a security token for AGOL or an ArcGIS portal. | |
Expiration period is specified in minutes and defaults to an hour. | |
The portal URL needs to be something like this: | |
https://www.arcgis.com/sharing/generateToken |
This file contains 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
#!/usr/bin/env python3 | |
''' | |
Source name: parkrun_starwars.py | |
Author(s): Stoyan Shopov | |
Python Version: 2.7, 3.* 32-bit or 64-bit | |
License: LGPL | |
Description: | |
This program was run on the EV3D4 (R2D2 look-a-like) Lego Mindstorms at Mount Barker parkrun 175. |
This file contains 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 functools | |
import threading | |
# A decorator that will run its wrapped function in a new thread | |
def run_in_new_thread(function): | |
# functool.wraps will copy over the docstring and some other metadata | |
# from the original function | |
@functools.wraps(function) | |
def fn_(*args, **kwargs): | |
thread = threading.Thread(target=function, args=args, kwargs=kwargs) |
OlderNewer