예제 #1
0
def make_annotations(mapid):
    for x in range(10):
        m = Map.objects.get(id=mapid)
        Annotation(map=m,
                   title='ann %s %s' % (mapid, x),
                   content='content',
                   the_geom=make_point(-100 + (10 * x), 40)).save()
예제 #2
0
파일: tests.py 프로젝트: Geocent/geonode
 def make_annotations(self, mapobj, cnt=100):
     point = make_point(5, 23)
     for a in xrange(cnt):
         # make sure some geometries are missing
         geom = point if cnt % 2 == 0 else None
         # make the names sort nicely by title/number
         Annotation.objects.create(title='ann%2d' % a, map=mapobj, the_geom=geom).save()
예제 #3
0
파일: tests.py 프로젝트: wpapper/geonode
 def make_annotations(self, mapobj, cnt=100):
     point = make_point(5, 23)
     for a in xrange(cnt):
         # make sure some geometries are missing
         geom = point if cnt % 2 == 0 else None
         # make the names sort nicely by title/number
         Annotation.objects.create(title='ann%2d' % a,
                                   map=mapobj,
                                   the_geom=geom).save()
예제 #4
0
파일: forms.py 프로젝트: Geocent/geonode
 def full_clean(self):
     self._my_errors = {}
     geom = self.data.get('geometry', None)
     if geom:
         if isinstance(geom, basestring):
             try:
                 json.loads(geom)
             except ValueError:
                 self._my_errors['geometry'] = 'Invalid JSON'
         elif isinstance(geom, dict):
             geom = json.dumps(geom)
         else:
             self._my_errors['geometry'] = 'geometry should be string or dict'
         self.data['the_geom'] = geom
     lat, lon = self.parse_float('lat'), self.parse_float('lon')
     if all([lat, lon]):
         self.data['the_geom'] = make_point(lon, lat)
     self._convert_time('start_time')
     self._convert_time('end_time')
     super(AnnotationForm, self).full_clean()
     self._errors.update(self._my_errors)
예제 #5
0
파일: forms.py 프로젝트: wpapper/geonode
 def full_clean(self):
     self._my_errors = {}
     geom = self.data.get('geometry', None)
     if geom:
         if isinstance(geom, basestring):
             try:
                 json.loads(geom)
             except ValueError:
                 self._my_errors['geometry'] = 'Invalid JSON'
         elif isinstance(geom, dict):
             geom = json.dumps(geom)
         else:
             self._my_errors[
                 'geometry'] = 'geometry should be string or dict'
         self.data['the_geom'] = geom
     lat, lon = self.parse_float('lat'), self.parse_float('lon')
     if all([lat, lon]):
         self.data['the_geom'] = make_point(lon, lat)
     self._convert_time('start_time')
     self._convert_time('end_time')
     super(AnnotationForm, self).full_clean()
     self._errors.update(self._my_errors)
예제 #6
0
파일: scratch.py 프로젝트: Geocent/geonode
def make_annotations(mapid):
    for x in range(10):
        m = Map.objects.get(id=mapid)
        Annotation(map=m, title='ann %s %s' % (mapid, x), content='content', the_geom=make_point(-100 + (10 *x), 40)).save()