(function() {

    "use strict";

    /**
     * @module FreeDraw
     * @submodule Utilities
     * @author Adam Timberlake
     * @link https://github.com/Wildhoney/Leaflet.FreeDraw
     */
    L.FreeDraw.Utilities = {

        /**
         * Responsible for converting the multiple polygon points into a MySQL object for
         * geo-spatial queries.
         *
         * @method getMySQLMultiPolygon
         * @param latLngGroups {Array}
         * @return {String}
         */
        getMySQLMultiPolygon: function getMySQLMultiPolygon(latLngGroups) {

            var groups = [];

            latLngGroups.forEach(function forEach(latLngs) {

                var group = [];

                latLngs.forEach(function forEach(latLng) {
                    group.push(latLng.lat + ' ' + latLng.lng);
                });

                groups.push('((' + group.join(',') + '))');

            });

            return 'MULTIPOLYGON(' + groups.join(',') + ')';

        },

        /**
         * Responsible to generating disparate MySQL polygons from the lat/long boundaries.
         *
         * @method getMySQLPolygons
         * @param latLngGroups {L.LatLng[]}
         * @returns {Array}
         */
        getMySQLPolygons: function getMySQLPolygons(latLngGroups) {

            var groups = [];

            latLngGroups.forEach(function forEach(latLngs) {

                var group = [];

                latLngs.forEach(function forEach(latLng) {
                    group.push(latLng.lat + ' ' + latLng.lng);
                });

                groups.push('POLYGON((' + group.join(',') + '))');

            });

            return groups;

        }

    };

})();
@@ -771,34 +771,34 @@
 up.push(latLng.l
-at
+ng
  + ' ' + latLng.
@@ -790,34 +790,34 @@
 + ' ' + latLng.l
-ng
+at
 );%0A             
@@ -1503,18 +1503,18 @@
 latLng.l
-at
+ng
  + ' ' +
@@ -1522,18 +1522,18 @@
 latLng.l
-ng
+at
 );%0A     

swap latitude and longitude for WKT-format http://en.wikipedia.org/wiki/Well-known_text