Skip to content

Instantly share code, notes, and snippets.

View george-silva's full-sized avatar
🌊

George Silva george-silva

🌊
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>SIG SMTT</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">
var map;
function init(){
map = new OpenLayers.Map('map');
@george-silva
george-silva / gist:3228697
Created August 1, 2012 16:54 — forked from gmorada/gist:3228519
Helper para gerar relatório em pdf a partir de um html
from django.template.loader import get_template
from django.template import Context
import cStringIO as StringIO
import cgi
import ho.pisa as pisa
def render_to_pdf(template_src, context_dict):
template = get_template(template_src)
context = Context(context_dict)
html = template.render(context)
@george-silva
george-silva / gist:3801297
Created September 28, 2012 18:02
Conversão PTL
@staticmethod
def para_ptl(xo,yo,zo,lato,lono,x_geoc,y_geoc,z_geoc):
"""
xo,yo,zo = origem geocentrica;
lato,lono = origem em lat long;
x_geoc,y_geoc,z_geoc = ponto a ser convertido;
"""
rlat = radians(lato)
rlot = radians(lono)
@george-silva
george-silva / gist:4007317
Created November 3, 2012 12:57
Testes bobos
[TestFixture]
public class ConverterUnitTest
{
[SetUp]
public void Init()
{
var aoInit = new AoInitializeClass();
aoInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcInfo);
}
@george-silva
george-silva / finders.cs
Created November 3, 2012 13:05
Testes bobos #2
public class ParentFinders
{
private static ILog _log = LogManager.GetLogger(typeof(ParentFinders));
public static IObject FindParentAmbiguous(IObject obj, ITable parentTable)
{
_log.IfInfo("Utilizando método 'toca' para encontrar objeto pai.");
if (!(parentTable is IFeatureClass))
throw new ArgumentException("parentTable não é uma feature class.");
@george-silva
george-silva / teste interno.py
Created April 10, 2013 14:51
Teste de criação interno/externo
>>> p1 = Polygon(((0,0),(0,1),(1,1),(1,0),(0.5,-1),(0,0)))
>>> p2 = Polygon(((0.3,0),(0.6,0),(0.5,-1),(0.3,0)))
>>> p1
<Polygon object at 0x3363e68>
>>> p1.area
1.5
>>> p2.area
0.15000000000000002
>>> p3 = p1.difference(p2)
>>> p3
class FormFoda(forms.ModelForm):
def __init__(self, usuario, campo, *args, **kwargs):
self.usuario = usuario
self.campo = campo
super(FormFoda, self).__init__(*args,**kwargs )
def save(self, commit=True):
if hasattr(self.instance, self.campo):
@login_required
def dashboard(request):
usuario = request.user
perfil_analista = None
try:
perfil_analista = PerfilAnalistaFundiario.objects.get(user_id=usuario.id)
except:
raise PermissionDenied
class Requerimento(UserDateAdd, UserDateUpd):
"""
BaseRequerimento
"""
tipo = models.CharField(max_length=16,
verbose_name=u"Tipo",
help_text=u"Tipo de requerimento",
choices=TIPO_REQUERIMENTO_CHOICES)
@george-silva
george-silva / fuckthatshit.txt
Created June 3, 2013 18:53
coordenadas planilha capiroto convertida postgis
"F67-M-0639";19;0.001;0.001;0.001;5;"01010000A0421200003E711617393B46C027A4CC2EA69D34C0A4703D0AD7436A40";"POINT(-44.4626797542173 -20.6158169984448)"
"F67-M-0641";19;0.001;0.001;0.001;5;"01010000A0421200008992C220C43846C092CA5CCBA29D34C0A4703D0AD7436A40";"POINT(-44.4434853506146 -20.6157652951757)"
"F67-P-0643";19;0.001;0.001;0.001;7;"01010000A042120000B3A63406C23846C09049106F28A234C0A4703D0AD7436A40";"POINT(-44.4434211499296 -20.6334294714703)"
"F67-P-0644";19;0.001;0.001;0.001;7;"01010000A042120000760CC305C23846C07693206329A234C0A4703D0AD7436A40";"POINT(-44.4434210970293 -20.6334440187961)"
"F67-V-0645";28;0.001;0.001;0.001;6;"01010000A0421200007B184B05C23846C02D8DD5642AA234C0A4703D0AD7436A40";"POINT(-44.4434210411718 -20.6334593793264)"
"F67-V-0646";28;0.001;0.001;0.001;6;"01010000A04212000061C28904C23846C0EF7632042CA234C0A4703D0AD7436A40";"POINT(-44.4434209511426 -20.633484136887)"
"F67-M-0642";19;0.001;0.001;0.001;5;"01010000A04212000010162FE7C03846C00E3A28E690A434C0A4703D0AD7436A40";"POINT(-44.443386934