Skip to content

Instantly share code, notes, and snippets.

View dersteppenwolf's full-sized avatar
🏠
Working from home

Juan Carlos Méndez dersteppenwolf

🏠
Working from home
View GitHub Profile
@dersteppenwolf
dersteppenwolf / gist:f1b5965387234e109061
Created November 12, 2015 14:53 — forked from cwalv/gist:9191377
gpServiceDeploy.py
#!/usr/bin/env python
'''
This script creates an .sd from a .pyt
.. It assumes that all tools can be called with no parameters (i.e.,
all parameters are "optional". Not ideal for all services, but
works fine for services that arn't called from ArcMap anyway.
If you are calling your service from ArcMap, publish the traditional
way ..
import arcpy
import os
#"unregistering as versioned" multiple datasets using arcpy
try:
conn_path = "c:/temp/RUTACONN.SDE"
datasets = ["DATASET_01", "DATASET_02", "DATASET_03", "DATASET_04", "DATASET_05"]
for dataset in datasets:
dataset_path = os.path.join(conn_path,dataset )
print dataset_path
datasetVersioned = arcpy.Describe(dataset_path).isVersioned
import os
import urllib
import urllib2
import base64
import json
import sys
import argparse
try:
import requests
except ImportError:
import requests
import json
import random
import urllib
class MapInstance(object):
def __init__(self, definition, url, headers=None):
self.url = url
self.definition = definition
#
# converts a shapefile to an elasticsearch geo_point type with this mapping:
#
# {
# "zipcode" : {
# "properties" : {
# "geometry": {
# "properties": {
# "coordinates": {
# "type": "geo_point"
@dersteppenwolf
dersteppenwolf / WordpressXMLRpcClient.java
Created November 23, 2012 16:15
Create New Posts in Wordpress using Java and XMLRpc
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
/**
* Create New Posts in Wordpress using Java
*
* //http://codex.wordpress.org/XML-RPC_WordPress_API/Posts#wp.newPost
@dersteppenwolf
dersteppenwolf / generate_twitter_list_rss_.rb
Created October 24, 2012 23:25
Generate a RSS of a Twitter feed using Ruby and Twitter API v1.1
require 'rubygems'
require 'twitter'
require 'builder'
client = Twitter::Client.new(
:consumer_key => "your consumer key",
:consumer_secret => "your consumer secret",
:oauth_token => "your oauth token",
:oauth_token_secret => "your oauth secret"
)
@dersteppenwolf
dersteppenwolf / arcpy_proper_case.py
Created September 17, 2012 16:33
a python script to convert arcmap labels to proper case
import re
def title(value):
value = value.decode('utf-8')
t = re.sub("([a-z])'([A-Z])", lambda m: m.group(0).lower(), value.title())
return re.sub("\d([A-Z])", lambda m: m.group(0).lower(), t)
title(!NOM_MUNICI!)
@dersteppenwolf
dersteppenwolf / arcpy_compress_analyze.py
Created August 23, 2012 04:43
Comprimir SDE y Analizar Schema (Arcgis 10, arcpy)
#-*- coding: UTF-8 -*-
#Script para ejecutar el compress y analyze de la base de datos
#Basado en el Script original para arcgis 9.3.1 por Mike Long - [email protected]
import string, os, arcpy, time
import traceback,sys
from arcpy import env
# Set the date.