Skip to content
GitLab
    • Explore Projects Groups Topics Snippets
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • T tsc-152-the-notorious-rhyme-mustard
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Marcelo Ignacio Jara Almeyda
  • tsc-152-the-notorious-rhyme-mustard
  • Merge requests
  • !5

Devel

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Marcelo Ignacio Jara Almeyda requested to merge devel into master 9 years ago
  • Overview 0
  • Commits 2
  • Changes -
Compare
  • master (base)

and
  • latest version
    2713af38
    2 commits, 9 years ago

+ 45
− 4

    Preferences

    File browser
    Compare changes
map/views.py
+ 41
− 0
  • View file @ 2713af38

  • Edit in single-file editor

  • Open in Web IDE


import json
import urllib2
import datetime
from django.contrib.gis.geos import GEOSGeometry
from django.shortcuts import render
import geo.models
import cache.models
import cache.views
def index(request):
month = datetime.date.today().month
# around chile.
latitude = -33.0337077952
longitude = -71.583480835
radius = 50
api_url = 'http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=2015-%s-01&endtime=2015-%s-31' \
'&latitude=%f&longitude=%f&maxradius=%f'
resource = urllib2.urlopen(api_url % (month, month, latitude, longitude, radius))
if resource:
cache_data = json.loads(resource.read())['features']
for data in cache_data:
properties = data['properties']
geometry = data['geometry']
e = cache.models.EarthQuake(
place=properties['place'],
date_time=long(properties['time']),
updated=long(properties['updated']),
magnitude=float(properties['mag']),
code=properties['code'],
location=GEOSGeometry('POINT(%s %s)' % (geometry['coordinates'][1],
geometry['coordinates'][0])),
)
# ignore if the object already exists. This may be faster that querying the db before,
try:
e.save()
except Exception as e:
print e
simple_locations = geo.models.SimpleLocation.objects.all()
earthquakes = cache.models.EarthQuake.objects.all()
tsc/settings.py
+ 3
− 3
  • View file @ 2713af38

  • Edit in single-file editor

  • Open in Web IDE


@@ -83,9 +83,9 @@ WSGI_APPLICATION = 'tsc.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'geodjango',
'USER': 'geodjango',
'PASSWORD': 'asdf1234',
'NAME': 'tnrmdb',
'USER': 'tnrm',
'PASSWORD': '',
'HOST': 'localhost',
}
}
README 0 → 100644
+ 1
− 0
  • View file @ 2713af38

  • Edit in single-file editor

  • Open in Web IDE

The Notorious Snootie Team was here
jiji.md deleted 100644 → 0
+ 0
− 1
  • View file @ f815dce0

Fucking Awesome
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 Participant
Marcelo Ignacio Jara Almeyda
Reference: mijara/tsc-152-the-notorious-rhyme-mustard!5
Source branch: devel

Menu

Explore Projects Groups Topics Snippets