47
GIS Kickstarter JavaScript Web and Mobile Andy Gup, Esri

2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Embed Size (px)

DESCRIPTION

Join us and have fun learning how you can easily get started building JavaScript web and mobile GIS applications. We'll walk through some new quick start tools and resources that can shave off hours and even weeks of ramp-up time. There will be discussions on how to create and publish maps in minutes, as well as understanding how JavaScript and GIS services work together. Liberally sprinkled throughout the session will be lots of tips-and-tricks, and lessons learned.

Citation preview

Page 1: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

GIS  Kickstarter  JavaScript  Web  and  Mobile  

Andy  Gup,  Esri  

Page 2: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Agenda  

How  to  build  a  map  A  ton  of  resources  Mobile  Web    

Page 3: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

AssumpBons  

Basic  knowledge  of  JavaScript  and  CSS  Basic  knowledge  of  browser  debugging      

Page 4: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Who  am  I?  Andy  Gup    Developer  Evangelist  JavaScript,  Android      www.andygup.net  github.com/andygup        [email protected]  @agup    

Page 5: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

A  basic  map  (ArcGIS  Server,  WMS,  etc)  <script>!require(["esri/map", "dojo/domReady!"], ! function(Map) {! map = new Map("map", {! basemap: "topo",! center: [-122.45,37.75], ! zoom: 14! });!});!</script>!!<div id=“map”></div>!!!

Page 6: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Cool  Demos  

Flood  impact  map  hNp://coolmaps.esri.com/#8  hNp://coolmaps.esri.com/#9  hNp://gis.yavapai.us/ElecBonPollingPlace/pollingplace.htm    hNp://gis.glendaleaz.com/MyGlendaleServices/Default.htm      

Page 7: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup
Page 8: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup
Page 9: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup
Page 10: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

hNp://gis.yavapai.us/ElecBonPollingPlace/pollingplace.htm    

Page 11: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

hNp://gis.glendaleaz.com/MyGlendaleServices/Default.htm    

Page 12: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

arcgis.com  

 Create  a  map  Add  data  to  it  Share  it    

Page 13: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

ArcGIS.com  Web  Map  <script>!require(["esri/map", "dojo/domReady!”,! “esri/arcgis/utils"],! ! function(Map,Utils) {! !Utils.createMap(”mapId","map").then(!! ! ! !function(response) {!! ! ! ! !map = response.map;!! ! ! !});!

});!</script>!!<div id=“map”></div>!!!

Page 14: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

developers.arcgis.com  

Page 15: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

github.com/esri  

Open  source  137+  repositories  Feedback  Version  history  

Page 16: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

JavaScript  for  Mobile  

Page 17: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Many  different  screen  sizes  and  pixel  densiBes  

1920x1080  

Page 18: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Wait…how  do  I  pan  and  zoom  the  map??  

Page 19: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Portrait   Landscape  

Mobile  app  –  view  can  change!  

Page 20: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Desktop  app  on  smartphone  

Page 21: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

ArcGIS  API  for  JavaScript  -­‐  Compact  

<script src="http://js.arcgis.com/3.7compact">!

Page 22: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

JavaScript  mobile  framework  libraries  

Page 23: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

JavaScript  framework  libraries  

Image  by  wikipedia  

Page 24: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Mobile  libraries  help  with…  

Views      Visual  Components      Themes    

Page 25: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Views  

Image  courtesy  Dojo    

Page 26: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

The  view  port  

Page 27: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

<meta name="viewport" content="width=device-width, !!initial-scale=1, maximum-scale=1, user-scalable=no"/

>!

Sedng  the  mobile  view  port  

Page 28: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

<meta name="viewport" content="width=device-width, !!initial-scale=1, maximum-scale=1, user-scalable=no"/

>!

Sedng  the  mobile  view  port  

Minimum  view  port  

Zoom  level  on  page  load  

Force  only  map  to  zoom  

Page 29: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

No  viewport   With  viewport  

Page 30: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Views  

<div id="mapView" dojoType="dojox.mobile.View“! style="width:100%;height:100%;">! <h1 dojoType="dojox.mobile.Heading" ! back="Back" moveTo="mainView">! 5 + 10 minute Drive Times! </h1>! <div id="map“ style="width:100%; height:100%;“/>!</div>!

Page 31: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Visual  Components  

!!!<div dojoType="dojox.charting.widget.Chart2D" !

!theme="dojox.charting.themes.Claro" id="viewsChart" !!style="width: 550px; height: 550px;">!

 !    <!-- Pie Chart: add the plot -->!    <div class="plot" name="default" type="Pie" !

!radius="200" fontColor="#000" labelOffset="-20"></div>! !    <!-- pieData is the data source -->!    <div class="series" name="Last Week's Visits" ! array="chartData">! </div>! !</div>!!

Page 32: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Themes  

!!  <!--Legend Dialog-->   <div data-role="dialog" id="legendDialog"  ! data-theme="f">     <div data-role="header">       <h1>Legend</h1>     </div>     <div data-role="content" >       <div id="legendDiv"></div>     </div>   </div>!!

Page 33: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Other  types  of  styling  

&  

Page 34: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

CSS3  Media  Queries  Target  devices  by  screen  width  

Apply  styles  by  device  orientaEon  

Target  high  density  screens  such  as  iPhone  5  

!@media screen and (min-device-width:768px) and (max-device-width:1024px) {! /* styles go here */!}!

@media (orientation: landscape) { /* styles go here */ }!

@media screen and (device-aspect-ration: 40/71) { /* high resolution device styles go here */ }!

Page 35: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Phone  ProperBes  via  JavaScript  Verify  orientaEon  

Detect  user  agent  

Browser  sniffing  

! isPortrait = window.matchMedia("(orientation: portrait)").matches;

// is the user on an iPad or iPhone isiPad = navigator.userAgent.match(/iPad/i); isiPhone = navigator.userAgent.match(/iPhone/i);

// check if the browser is IE if (dojo.has("ie")) { // IE specific code } else { // non-IE specific code }

Page 36: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Responsive  frameworks  help  with…  

 Layout              AND…                    Visual  Components              Themes      

Page 37: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Responsive  Frameworks…(parBal  list)  

Boostrap  

Frameless  

FoundaEon  4  

Skeleton  

Less+  

Wirefy  

Susy  

HTML5  Boilerplate  

Page 38: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Header  

Legend   Map  

1024  x  768  

Page 39: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Header  

Legend   Map  

1024  x  768  

Page 40: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Header  

Legend  

Map  

Page 41: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Header  

Legend   Map  

Header  

Map  

     Legend  

Scro

ll D

own

Page 42: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Understanding  browsers  

!==   !==  

Page 43: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

caniuse.com  

Page 44: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Feature  detecBon  paNern  

useLocalStorage = supports_local_storage(); function supports_local_storage() { try { return 'localStorage' in window && window['localStorage'] !== null; } catch( e ){ return false; } } function doSomething() { if(useLocalStorage == true){ //write to local storage } else {

//degrade gracefully } }

Page 45: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Test  on  different  devices  

Page 46: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

Developer  resources  

Arcgis.com  hNp://github.com/esri    hNp://developers.arcgis.com  

Page 47: 2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development by Andy Gup

QuesBons?  Andy  Gup    Developer  Evangelist    www.andygup.net  github.com/andygup        [email protected]  @agup