Package madrona :: Package staticmap :: Module models
[hide private]

Source Code for Module madrona.staticmap.models

 1  from django.contrib.gis.db import models 
 2   
3 -class MapConfig(models.Model):
4 """Model used for representing a map (ie a collection of styled map layers) 5 6 ====================== ============================================== 7 Attribute Description 8 ====================== ============================================== 9 10 ``mapname`` Name of the map. Will be refered to by URL so 11 use http friendly names (no spaces, slashes, etc) 12 13 ``mapfile`` Mapnik xml configuration file that defines data 14 sources and styles. All paths within xml must be 15 relative to media/staticmap/ 16 17 ``default_x1`` LL X coordinate 18 19 ``default_y1`` LL Y coordinate 20 21 ``default_x2`` UR X coordinate 22 23 ``default_y2`` UR Y coordinate 24 25 ``default_width`` Default image width (pixels) 26 27 ``default_height`` Default image height (pixels) 28 ====================== ============================================== 29 """ 30
31 - def __unicode__(self):
32 return u"%s" % (self.mapfile)
33 34 mapname = models.CharField(max_length=50,unique=True) 35 mapfile = models.FileField(upload_to='staticmap/', help_text=""" 36 Mapnik xml configuration file that defines data sources and styles. 37 All paths within xml must be relative to media/staticmap/ 38 """, blank=False, max_length=510) 39 default_x1 = models.FloatField( 40 help_text="Lower-left X coordinate of default map extent. Units and spatial reference system are defined in the mapnik xml.") 41 default_y1 = models.FloatField( 42 help_text="Lower-left Y coordinate of default map extent. Units and spatial reference system are defined in the mapnik xml.") 43 default_x2 = models.FloatField( 44 help_text="Upper-right X coordinate of default map extent. Units and spatial reference system are defined in the mapnik xml.") 45 default_y2 = models.FloatField( 46 help_text="Upper-right Y coordinate of default map extent. Units and spatial reference system are defined in the mapnik xml.") 47 default_width = models.IntegerField(help_text="Default map image width in pixels") 48 default_height = models.IntegerField(help_text="Default map image height in pixels") 49 default_srid = models.IntegerField(help_text="Spatial Reference ID of the output map", default=4326)
50