Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


  <div id="landno-panel" class="container mainnav">
    <div class="row">
      <div class="col-lg-offset-3 col-md-offset-3 col-lg-6 col-md-6 col-sm-6">
        <div class="panel panel-primary">
          <div class="panel-heading">
            <h3 class="panel-title">地號轉地圖</h3>
          <div class="panel-body">
            <form class="form-horizontal">
                <label for="textArea" class="col-lg-3 control-label">輸入地號:</label>
                <div class="col-lg-9">
                  <textarea class="form-control js_landno" rows="10"></textarea>

                <div class="col-lg-9 col-lg-offset-3">
                  <button class="btn btn-primary js_generate_map">
  <div id="map-canvas"></div>


                html,body {
  width: 100%;

#map-canvas {
  width: 100%;
  height: 600px;


                (function(root, factory){
  "use strict";
  if (typeof define === "function" && define.amd) {
    define(["jquery", "google"], factory);
  } else if (typeof exports === "object") {
    module.exports = factory(require("jquery", "google"));
  } else {
    root.Mapper = factory(root.jQuery,;
})(this, function($, google) {
	'use strict';

	var exports = {
		map_object: null,
		map_id: 'map-canvas',
		api_url: ''

	exports.getAPIUrl = function(query) {
		if (Object.keys(query).length > 0){
			return exports.api_url + '?' + $.param(query);

		return exports.api_url;
	}; = {
		init: function() {
			// TODO : add event listener
			$('.js_generate_map').click(function(event) {
				var landno_str = $('.js_landno').val();
				var landno_list = landno_str.split('\n');;
	}; = {
		init: function(options) {
			var map_options = $.extend({
				zoom: 15,
				scrollwheel: false
			}, options);

			var map_element = document.getElementById(exports.map_id);
			exports.map_object = new google.maps.Map(map_element, map_options);

		show: function(landno_list) {
			if (exports.map_object == null) {;

			landno_list = $.isArray(landno_list) ? landno_list : [landno_list];
			var query = { lands: landno_list };
			var json_url = exports.getAPIUrl(query);

			$.getJSON(json_url, function(geo_json){
				if (! $.isEmptyObject(geo_json)){
					var center = {
						lat: -1, 
						lng: -1

					var features = geo_json.features;


						var lat =;
						var lng =;

						if (lat >0 && lng > 0) { = lat;
							center.lng = lng;

		 			// TODO : reset the map center
	 				exports.map_object.setCenter(new google.maps.LatLng(, center.lng));

	exports.init = function() {;


	return exports;