Skip to content

Commit c993908

Browse files
committed
small updates
- Removed the margin option - Added the usage message to README.md
1 parent da7e2c1 commit c993908

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

README.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# star-maps
22

33
Genmap is a script written in Ruby to generate simple star maps in
4-
scalar vector graphics (SVG) format. My original intent was to
4+
scalable vector graphics (SVG) format. My original intent was to
55
generate diagrams showing the location of the Herschel 400 objects on
66
the Sky Atlas 2000 maps, something like the following:
77

@@ -14,3 +14,24 @@ layers. The end result looks like this:
1414

1515
<img src="images/map9.svg">
1616

17+
## Command-line options
18+
19+
```
20+
Usage: genmap [options]
21+
-w, --width SPEC Width of image, e.g. 6in
22+
-m, --map NUM Sky Atlas 2000 map number
23+
-u, --ul DDDD.D+DDDD Upper-left map coordinate
24+
-l, --lr DDDD.D+DDDD Lower-right map coordinate
25+
-S, --stars MAG Plot stars
26+
-G, --grid Plot grid
27+
-H, --herschel Plot Herschel 400 objects
28+
-p, --plus Print dsos as plus signs
29+
-M, --messier Plot Messier objects
30+
-D, --dso MAG Plot deep sky objects
31+
-C, --const Plot constellation lines
32+
-B, --border Plot constellation borders
33+
-W, --milkyway Plot milky way contours
34+
```
35+
36+
Note, the map extent is either specified via the Sky Atlas 2000 map number or
37+
by the upper-left and lower-right coordinates.

genmap

+7-11
Original file line numberDiff line numberDiff line change
@@ -409,27 +409,24 @@ end
409409
# Parse the command line.
410410
options = {}
411411
OptionParser.new do |opts|
412-
opts.banner = "Usage: test.rb [options]"
412+
opts.banner = "Usage: genmap [options]"
413413

414-
opts.on("-w", "--width ", String, "Width of image") do |v|
414+
opts.on("-w", "--width SPEC", String, "Width of image, e.g. 6in") do |v|
415415
options[:width] = v
416416
end
417-
opts.on("-r", "--margin PIXELS", Integer, "Margin outside map") do |v|
418-
options[:margin] = v
419-
end
420417
opts.on("-m", "--map NUM", Integer, "Sky Atlas 2000 map number") do |v|
421418
options[:map] = v
422419
end
423-
opts.on("-u", "--ul DDDD.D+DDDD ", String, "Upper-left coordinate") do |v|
420+
opts.on("-u", "--ul DDDD.D+DDDD ", String, "Upper-left map coordinate") do |v|
424421
options[:ul] = v
425422
end
426-
opts.on("-l", "--lr DDDD.D+DDDD", String, "Lower-right coordinate") do |v|
423+
opts.on("-l", "--lr DDDD.D+DDDD", String, "Lower-right map coordinate") do |v|
427424
options[:lr] = v
428425
end
429426
opts.on("-S", "--stars MAG", Float, "Plot stars") do |v|
430427
options[:stars] = v
431428
end
432-
opts.on("-g", "--grid", "Plot grid") do |v|
429+
opts.on("-G", "--grid", "Plot grid") do |v|
433430
options[:grid] = v
434431
end
435432
opts.on("-H", "--herschel", "Plot Herschel 400 objects") do |v|
@@ -456,7 +453,6 @@ OptionParser.new do |opts|
456453
end.parse!
457454

458455
Width = options[:width] || "6in"
459-
Margin = options[:margin] || 0
460456

461457
# Establish some globals to specify the map to be generated.
462458
if options[:map]
@@ -496,8 +492,8 @@ amt, units = parse_width(Width)
496492
Height = (amt*(ymax-ymin)/(xmax-xmin)).to_s + units
497493

498494
# Print the header material.
499-
puts %Q[<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 #{g(xmax-xmin+2*Margin)} #{g(ymax-ymin+2*Margin)}" width="#{Width}" height="#{Height}">]
500-
puts %Q[<g transform="translate(#{g(-xmin+Margin)}, #{g(-ymin+Margin)})">]
495+
puts %Q[<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 #{g(xmax-xmin)} #{g(ymax-ymin)}" width="#{Width}" height="#{Height}">]
496+
puts %Q[<g transform="translate(#{g(-xmin)}, #{g(-ymin)})">]
501497
puts %Q[<clipPath id="CP">]
502498
puts %Q[<rect x=#{f(xmin)} y=#{f(ymin)} width=#{f(xmax-xmin)} height=#{f(ymax-ymin)} stroke="black" stroke-width="1" fill="white"/>]
503499
puts %Q[</clipPath>]

0 commit comments

Comments
 (0)