AngularJS and Google Maps – dynamic marker updates

I have a need to dynamically create and display markers on a Google Map. Statically declaring a single or an array of markers seems pretty easy, but updating an array of markers so they are displayed and removed over time seems more tricky using the available AngularJS libraries for Google Maps.

The two libraries I have looked at are:

Both offer AngularJS directives to insert a Google Maps into an existing page. Let’s take a quick look at each approach.

Angular Google Maps

With Angular Google Maps, use the provided directives to insert the map and an array of markers:

[code]
<ui-gmap-google-map center=’map.center’ zoom=’map.zoom’>
<ui-gmap-markers models="markers" coords="’self’" modelsbyref="false"/>
</ui-gmap-google-map>
[/code]

In my Controller I’ve added a map object to $scope with values for center and zoom:

[code]
$scope.map = {center: {latitude: 37.7699298, longitude: -122.4469157}, zoom: 12};
[/code]

… and to add the initial array of markers (random markers in SF):

[code]
var marker1 = {id: 1, latitude: 37.7699298, longitude: -122.40};
var marker2 = {id: 2, latitude: 37.7699298, longitude: -122.45};
var marker3 = {id: 3, latitude: 37.7699298, longitude: -122.46};
$scope.markers = [];
$scope.markers[0] = marker1;
$scope.markers[1] = marker2;
$scope.markers[2] = marker3;
[/code]

Since the markers array in $scope is reference by the ui-gmap-markers element, setting the markers array to [] deletes the markers from the map, and adding them back re-adds them back to the map. The property ‘coords’ is the name of the property on the object passed to models that contains the objects with the latitude/longitude properties for each marker. modelsByRef=”false” seems to add support for watching changes to the model.

ngMap

The ngMap approach is very similar. To add the map to a page with a repeating list of markers:

[code]
<map style="height:100%" center="37.7699298, -122.4469157" zoom="11">
<marker ng-repeat="pos in positions" position="{{pos.lat}}, {{pos.lng}}"></marker>
</map>
[/code]

To create the markers, create an array of markers with lat and lng properties, similarly to Angular Google Maps:

[code]
var marker1 = {lat: 37.769, lng: -122.44};
$scope.positions = [];
$scope.positions[0] = marker1;
//etc
[/code]

Summary

Since my app needs to dynamically add and remove markers for display to the Google Map, this was my primary requirement for selecting one of the libraries. I struggled to get this working initially with Angular Google Maps, but seemed to work straight out of the box with ngMap. Most of my struggles though may have been related to my misunderstanding of how $scope works in AngularJS (which I’m still learning), so maybe at some point I should go back and re-evaluate both of these again once I have a better understanding of AngularJS.

I put together a sample app that uses both of the libraries, which you can find on GitHub here: https://github.com/kevinhooke/AngularJSGoogleMapsExamples

Also, my final usage for ngMap you can see in action in my app, SpotViz, which is available here: http://www.spotviz.info/ . It allow Amateur Radio operators to playback an animated display of received station locations over time from log files from a digital mode application called WSJT-X.

 

Choosing an Issue Tracker for an Online Service

I’ve been working on an application that I’m getting close to publicly launching, and while the site is mostly functional with most of the development done (I’ve been working on it in my ‘spare time’ for almost a year), there’s some non-development tasks I need to complete before launching, including:

  • adding Google AdSense and Analytics
  • completing online documentation
  • setting up an online issue tracker

The options for an issue tracker has taken me by surprise as there are so many options, ranging from free to varying monthly fee options. I’m somewhat familiar with some of the older free development project focused options, like Bugzilla, Trac, Redmine, and commercial options like Atlassian’s Jira. Part of my app is open source on GitHub and so to use the GitHub issue tracker for that part is an easy choice. I’d also like to make sure whichever issue tracker I chose is easy to use from the point of view of my end users, the majority of which are unlikely to have existing GitHub accounts, or accounts on other online tracker sites, and I want to make sure it’s as easy as possible for them to log issues and enhancement requests.

(This article here has a good list of a number of issue trackers.)

Ranging from simplest to use, Trello is a stand-out from the crowd. Although it’s not a dedicated issue tracker, the approach of managing lists of items and moving items (cards) from one list (e.g. open items) to another (e.g.closed items) is trivial.

Categorized in interesting-but-with-high-technical-requirements is YouTrack from JetBrains, and free for upto 10 users … but requiring 1GB heap to run, this would cost me some monthly runtime costs for  medium gear on OpenShift, so I’m not sure  if this is worth the investment at this point.

Next up in the looks-interesting category is Asana – I’m not familiar with this service, it looks like it offers much more than I would need, but could be worth investigating.

I’ve some decisions to make here, and right now I’m thinking either using GitHub’s issue tracker or Trello. What would you recommend – leave me a comment!

Success! Packet Radio via the International Space Station

I think this was my third or fourth attempt, but I just successfully bounced a packet off of the ISS as it passed over this evening – if I understand this right, the red highlighted message is my message as I received it coming back from RS0SS (the callsign for the packet digipeater on the ISS):

2014 12 07 iss packet - 1st contact

Amateur Radio Packet via the International Space Station (update 2)

On yesterday’s pass I realized too late that the AGWTerminal software doesn’t send unproto packets needed to send packets via the ISS. I’ve now downloaded UISS, got it sent up and checked into the Sacramento Valley Sunday evening packet net, so looks like everything is good to go.

On this evening’s pass, I started sending my cq unproto packets, but looks like I wasn’t heard. I’m wondering after reading around that my ‘via’ value should be ARISS and not RS0ISS that I was using. Apparently your via should be ARISS, but the packets recevied from the digipeater on the ISS will come from RS0ISS. So, will give it another try on the next pass at a good time.

Here’s the packets I received this evening:

Fm K7LWV-6 To APRS Via RS0ISS* <UI pid=F0 Len=47 >[21:08:50]
=4454.96N/12319.98W`Dallas, OR Via ISS {UISS53}
Fm K7LWV-6 To APRS Via RS0ISS* <UI pid=F0 Len=33 >[21:08:59]
:NWS      :Hello from Dallas, OR!
Fm N7HQB To CQ Via RS0ISS* <UI pid=F0 Len=45 >[21:09:04]
=40.637569n/111.931580w/Hello From SLC Utah!