Skip to content

Commit

Permalink
added counts of bags in a survey
Browse files Browse the repository at this point in the history
git-svn-id: https://cowfish.unh.edu/projects/schwehr/trunk/src/bag-py@13848 a19cddd1-5311-0410-bb07-9ca93daf0f0b
  • Loading branch information
schwehr committed May 31, 2010
1 parent 020e74e commit 4e26087
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
26 changes: 21 additions & 5 deletions bagsqlite2kml.py
Expand Up @@ -38,7 +38,20 @@ def sqlite2kml(cx,outfile):
<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
</IconStyle>
</Style>
''')
for i in range(30):
o.write('''\t<Style id="survey_{count}_style">
<BalloonStyle>
<color>ff669999</color>
<text>$[description]</text>
</BalloonStyle>
<IconStyle>
<Icon><href>http://nrwais1.schwehr.org/~schwehr/bags/survey-icon-66x66-{count}.png</href></Icon>
<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
</IconStyle>
</Style>
'''.format(count=i))
o.write('''
<Style id="survey_bbox">
<LineStyle>
<color>ff0074d2</color>
Expand All @@ -54,13 +67,16 @@ def sqlite2kml(cx,outfile):
print ('Processing:',survey)
ll = [row for row in cx.execute('SELECT MIN(x_min) as x, MIN(y_min) as y FROM bag WHERE survey=:survey;',{'survey':survey})][0]
ur = [row for row in cx.execute('SELECT MAX(x_max) as x, MAX(y_max) as y FROM bag WHERE survey=:survey;',{'survey':survey})][0]
print(ll,ur)
#print(ll,ur)
dr_url = [row['dr_url'] for row in cx.execute('SELECT dr_url FROM bag WHERE survey=:survey LIMIT 1;',{'survey':survey})][0]
print (dr_url)
#print (dr_url)
x_min, y_min = ll
x_max, y_max = ur
x_center = (ll[0] + ur[0]) / 2.
y_center = (ll[1] + ur[1]) / 2.

bag_count = [row for row in cx.execute('SELECT COUNT(*) as bag_count FROM bag WHERE survey=:survey;',{'survey':survey})][0]['bag_count']
print ('bag_count:',bag_count)
o.write('''
<Folder><name>{survey}</name>
<Placemark>
Expand Down Expand Up @@ -95,8 +111,8 @@ def sqlite2kml(cx,outfile):
</Lod>
</Region>
<Placemark>
<name>{survey} descr</name>
<styleUrl>#survey_style</styleUrl>
<name>{survey}</name>
<styleUrl>#survey_{bag_count}_style</styleUrl>
<description>
<![CDATA[
<p><b>Summary for Survey: {survey}</b></p>
Expand Down
5 changes: 3 additions & 2 deletions make_survey_icons.bash
Expand Up @@ -8,12 +8,13 @@ count=1
while [[ $count -le 9 ]]; do
#echo $count
#rm survey-icon-66x66-$count.png
convert -fill red -draw "circle 51,51 61,61" -fill white -pointsize 20 -annotate +46+59 $count $in survey-icon-66x66-$count.png
# -fill red
convert -fill brown -draw "circle 51,51 61,61" -fill white -pointsize 20 -annotate +46+59 $count $in survey-icon-66x66-$count.png
let count=$count+1
done

count=10
while [[ $count -le 30 ]]; do
convert -fill red -draw "circle 51,51 61,61" -fill white -pointsize 20 -annotate +40+59 $count $in survey-icon-66x66-$count.png
convert -fill brown -draw "circle 51,51 61,61" -fill white -pointsize 20 -annotate +40+59 $count $in survey-icon-66x66-$count.png
let count=$count+1
done

0 comments on commit 4e26087

Please sign in to comment.