Template talk:BC Basemap: Difference between revisions

From VOC Wiki
Jump to navigation Jump to search
imported>ScottN
imported>Matthew
Line 44: Line 44:


:It might also be nice to allow external images from elsewhere on the VOC website, especially from the gallery.  [[User:ScottN|Scott Nelson]] 11:05, 27 February 2008 (PST)
:It might also be nice to allow external images from elsewhere on the VOC website, especially from the gallery.  [[User:ScottN|Scott Nelson]] 11:05, 27 February 2008 (PST)
::On closer inspection, it looks like wgAllowExternalImages makes the mediawiki parser convert the url of an image into an image tag, rather than letting you specify the <img src="... - this might be tricky since the BC basemap URLs don't actually look like images. I expect it's possible to work around with a redirect if necessary. --[[User:Matthew|Matthew]] 11:45, 27 February 2008 (PST)

Revision as of 19:45, 27 February 2008

Re: this forum thread

Making that map was mostly trial and error. There are 6 important things:

  1. min latitude
  2. min longitude
  3. max latitude
  4. max latitude
  5. width
  6. height

lat/lng coordinates (aka the bounding box) are decimal degrees, width and height are pixels. It is possible to create maps where the x-scale <> y-scale. I did it by mistake one time, and it looks quite weird, so you have to make sure the aspect ratio for the bounding box matches the image dimensions you are asking it to create. It shouldn't be too hard to automatically create maps with a wiki template - one of the dimensions (e.g. width) could be taken from a template variable, and the other calculated to match the bounding box.

How I actually created that map was:

  1. use bivouac basemap tool to generate 3km radius map of Mt Garibaldi
  2. adjust bounding box keeping aspect ratio the same (by adding/subtracting the same amount from both the co-ordinates of both sides), until map showed south end of the neve traverse
  3. subtract southern latitude from northern latitude, to get total latitude range of map.
  4. multiply that by 3, add to southern latitude to get new northern latitude
  5. increase height of map in px to 3000

I guess that's a starting point - I'll give some thought to how this template could work on the wiki. Suggestions welcome. --Matthew 21:55, 19 February 2008 (PST)

If we make this work, it would be cool to have a way to generate maps for myself without having to make a wiki page... ie. an alternate interface. Basically something for friendly than bivouac or trail.brijn.nu. The gov't web interfaces are ok, but it is hard to make a big map with them. Scott Webster 22:05, 19 February 2008 (PST)

I should be able to whip up a form to do that fairly quickly - probably more easily than the wiki template. Actually, I'd like that for myself, so it has a high likelihood of getting done. --Matthew 22:19, 19 February 2008 (PST)
I whipped together something that takes the center lat/long, a lat width, a long width and a scale as parameters. I think that's easier for the user than specifying a bounding box, height and width. It also keeps the vertical and horizontal scales the same. Right now it assumes you are at 50 degrees lattitude to do the lat/long distance ratio. Ideally we could use the cosine of the lattitude to calculate this but I haven't figured out how to do that yet. Scott Nelson 10:02, 20 February 2008 (PST)
Nice work Scott. I also whipped together something - a form for easily creating maps. I still need to add the ability to control the scale, but it does all the calculations properly using the WGS84 ellipsoid, which is rather neat - I found a function to do that. tool | source. Also, if calculations are difficult to do on the wiki, we could always make the template point to an external page that redirects to the correct map, in a similar way to the utm2latlng thing I put together for Template:Coord --Matthew 10:54, 20 February 2008 (PST)
While I think it is good to figure out your own thing, you might want to check out trail.brijn.nu as is does this same thing already with more options and stuff. I think you have to create an account (free) if you want to make large maps. Anyway, it might be worth a look to see if you can get any hints from what they do. Scott Webster 11:29, 20 February 2008 (PST)

Cosine Function

So it looks like there is a cosine function for mediawiki, but I don't know how to activate the MathStatFunctions extension. Any hints? Scott Nelson 08:38, 26 February 2008 (PST)

Looks like it's another extension that I should install. I've got to run right now, but I'll take care of this later today. Chris Michalak 09:36, 26 February 2008 (PST)
Ok, I ended up upgrading all of mediawiki while I was at it since the MathStat extension claimed it needed 1.8.x or better. So, let's see, cos(pi/2) = {{#cos: {{#const: pi/2 }}}}. Bah... close enough (I hope there aren't any mathematicians watching this program). Chris Michalak 20:37, 26 February 2008 (PST)
Ouch. [1] --Matthew 00:12, 27 February 2008 (PST)
That's close enough for me Scott Nelson 00:25, 27 February 2008 (PST)

Embedding directly into articles

Embedding images directly into articles with an <img> tag is possible: [2], or possibly more appropriate would be to enable it for the BC basemap as an exception: [3]. If Chris changes that in the settings, we can have BC basemaps embedded into articles - possibly even a default x km around the waypoint given in the hutbox template, if no alternative map parameters are given. That would be quite neat. --Matthew 10:57, 27 February 2008 (PST)

It might also be nice to allow external images from elsewhere on the VOC website, especially from the gallery. Scott Nelson 11:05, 27 February 2008 (PST)
On closer inspection, it looks like wgAllowExternalImages makes the mediawiki parser convert the url of an image into an image tag, rather than letting you specify the <img src="... - this might be tricky since the BC basemap URLs don't actually look like images. I expect it's possible to work around with a redirect if necessary. --Matthew 11:45, 27 February 2008 (PST)