Bookmarklet to view OSM from coordinates parsed from URL
Aug 12th, 2016 by miki

Here’s a quick Javascript bookmarklet I threw together for opening a new browser window showing an area in OpenStreetMap that is defined from extracting the current window’s URL and searching after useable values for latitude, longitude and zoom.

It grew out of an annoyance over Mapillary’s rendering of the Danish endpoint of the under construction HVDC Cobra Cable(more about it from 4C, even more from EnergiNet and the EU) in Endrup nearby where I live.

In Mapillary’s tiles rendering it is just a bunch of roads and a single POI indication. Whereas the Mapnik rendering shows the existing power infrastructure and the area under construction.

Cobra HVDC, Endrup, Mapillary vs. OpenStreetMap

Well, I have been subjecting my oldstyle C brain to some Javascript lately so I decided to use that haemorrhage for attempting to put together a bookmarklet extracting coordinates from the current window’s URL and opening a new with the same approximate location in OSM.

It ended up like the below code block, and should also be usable on any other sites which receives locations via URL (both using HTTP GET notation with ‘?’ and locally in the page using anchors with ‘#’) and identifying them with key-value pairs using common names ({z,zoom},{lat},{lng,lon}). Note that this doesn’t include OpenStreetMap itself neither Google Maps as they only use the lat/lon values.

javascript:(function (){params={};kvs=document.location.href.split('&');kvs.forEach(function(kv){if(kv.indexOf('?'))kv=kv.substr(kv.indexOf('?')+1);if(kv.indexOf('#'))kv=kv.substr(kv.indexOf('#')+1);skv=kv.split('=');params[skv[0]]=skv[1];});''+(params.z?params.z:13)+'/'+('/'+(params.lng?params.lng:(params.lon?params.lon:8.5)));console.log(params);})();

Copy and paste the above into the “Location” or “URL” of a bookmark and you’ll be able to click it to open a new OSM window on, at least for Mapillary maps pages, the same location as the original site. If nothing is found it will default to coordinates of my hometown of Esbjerg at 55.5/.8.5.

Here’s a prettified edition of the code:

}); ''

Possible TODOs

  • get rid of default location, warn instead
  • support and test more sites (gmaps/osm!)
  • scan page contents for other geo markers
Frostlight RGB LED strip
Aug 1st, 2016 by miki

Stumbled across a very cheap RGB LED strip where I live in Denmark from the brand Frostlight. Priced at down to DKK 50 ~ EUR 6.5 ~ USD 7.5 in Fleggaard at Danish/German border but goes for around DKK 200 ~ EUR 26 ~ USD 30 in the ordinary DIY and internet shops (still cheap compared to other sources). For this amount you get a product which on the packaging is called “3 meter farvede LED bånd (RGB)” (which is a little gibberish Danish and not grammatically correct), English: “3 meter colored LED strip (RGB)”, containing these components;

  • 3 meter strip
  • Controller + IR receiver
  • PSU (Power Supply Unit), 230 V->12 V, 22 W
  • IR Remote control

According to the description this setup “does it all”; RGB multi color LEDS, controller doing colour change, fading etc.

  • Length: 3 meter
  • LEDs: 90 (30 LEDS pr. meter, 3.33 cm between LEDs)
  • Width: 10 mm
  • Colors: 16
  • Burn time: 20.000 hours
  • Silicone protected

The big question for me as a maker/hacker/tinkerer was; Does it use individually addressable LEDs?

And no, it doesn’t;

Frostlight RGB LED, strip segment interconnection

Obviously (as could be expected from the price), this strip is made from plain RGB LEDs with discrete R, G & B LEDS in a common anode setup (12V pin is common, current needs to be sinked from each RGB to control colour and intensity).

The brand Frostlight is unknown to me (they have a very non-informative website without any real product information), but they seem to supply LED products to many discount supermarkets in Denmark. They have a youtube channel (which is not even mentioned on the homepage) containing some product information. Even one for the “Frostlight LED farve-bånd”.

I was looking for a quick and cheap way to source LEDs for the awesome WordClock project by grahamvinyl (Arduino source code at However, it won’t work as all LEDs on the strip will light up in the same colour, but I consider using it for a cheaper tweak of it.

At least I’m confident I’ll find something to use the strip for anyway.


»  Substance:WordPress   »  Style:Ahren Ahimsa
© 2016 Mikini Services