Tech

By peterm, 27 April, 2015

One of my objectives with migrating data out of Drupal and into a MEAN stack app is for easier management of downstream requests for JSON data. We want to take advantage of the built in functionality of the MeanJS stack, and here's a simple exaple.

In this use case we wish to expose articles to some other app who will make a HTTP GET request for all the articles or just one.

In app/controllers/articles.server.routes.js, we need to add entries for the two functions we'll allow via GET.

app.route('/api/articles')

.get(articles.list);

By peterm, 23 April, 2015

Created a norcal.cities.geojson file via geojson.io site.

 

In this tutorial we will load a small data set into MongoDB and build a simple map that adds a marker to a map. There is some preparation for this tutorial, so you will need the following:

- a working MeanJS environment

- created an Article in your working environment

- be prepared to do some find / replace in the GeoJSON data file attached to this tutorial

- be able to run commands from the terminal to load data into MongoDB via mongoimport and install angular-leaflet-directive

Tags

By peterm, 23 April, 2015

Well, I'm no expert but here's a tip that might save you some time. I have a Drupal databae outputting valid GeoJSON data. Our data looks like this:

{

"type": "Feature",

"geometry": {

"type": "Point",

"coordinates": [

-122.0570486784,

36.99607280576

]

},

"properties": {

"name": "Dean of Students Office",

"description": null,

"Food Type": "",

Tags

By peterm, 15 April, 2015

Update 5/1/15 - On a different instance of Mongo, I had run the command noted below and got errors. However, this worked:

mongoimport --db mean-dev -c points --file "points.geojson" --jsonArray

 

Let me save you the hours lost in trying to figure out getting GeoJSON features into individual documents in a collection versus one document with nested features.

MongoDB 3.0.2. Valid GeoJSON file full of 809 features.

Using this code:

mongoimport --db test --type json --file ./'mobilemaps.geojson' 

Tags

By peterm, 6 March, 2015

Here's how I lost 3 hours. In using a comination of these modules with the Drupal Foundation theme. I wanted a small search button aligned right in the right sidebar. See http://mobilemaps-dev-proxy.ucsc.edu.

  • search api
  • search api autocomplete
  • search api live results
  • Foundation 4 theme

 

function zurb_maps_form_alter(&$form, &$form_state, $form_id) {

  // Sexy submit buttons

Tags

By peterm, 23 January, 2015

Over the past week, in between meetings, I've gotten some additional functionality added. I've been able to enter a number of Leaflet nodes (records) and then display markers on the "list" view. I've created a link in the popup that then takes us to the detail record. I've also been taking Dan Whalin's Udemy course. His site has a 50% off coupon code.

By peterm, 12 January, 2015

I've been looking at how to refactor our campus maps app from being Drupal based to sometihng that is based on a RESTful API so that data can be easily shared with other apps. Drupal has gotten us a long way, but the map stack of modules we're using has some limitations. I need to pull some custom map work stored at Mapbox.com giving us deeper zooms and styling rules we've decided upon.

The MEAN stack offers one refactoring option. So, I spent Christmas vacation doing some reading, configuring and thinking about how the MEAN stack might work for our needs.

By peterm, 8 December, 2014

I'm still getting up to speed with SmartOS. Here are some notes I took while trying to get PostgreSQL on SmartOS to parse OpenStreetMap (osm) files. My intent is to use Mapbox Studio to do some custom styling for OSM as we develop some "single purpose" maps.

Here's the summary I wrote at LAX when I came home from MMWCON down at UCLA in September 2014.

I was ultimately successful in getting data parsed in the VM and can use Mapbox Studio to connect and style the maps. Now to find some time to finish that little project...

 

Tags