Giter VIP home page Giter VIP logo

quickstart-map-js's Introduction

quickstart-map-js

A simple set of examples that illustrate how to accomplish different mapping (and GIS) tasks with the ArcGIS API for JavaScript and ArcGIS Online Services. Also, learn how to style your apps nicely with the Bootstrap 3.x framework.

View the samples

App

Features

  • Basemaps - Set different basemaps interactively
  • Geolocation - Find and display your geolocation
  • Place Finding - Find places or geocode an address
  • Geocode - Forward and reverse geocoding
  • Directions - Get directions, use direction widgets, multi-directions with barriers
  • Graphics - Draw points, lines and polygons
  • Maps - Load and auto resize and center maps
  • Cloud - Draw and query features stored in the ArcGIS Online cloud
  • Data - Load JSON services
  • Popups - Format and position info windows and your own map pins
  • Map Pins - You can use new Esri markers for point locations

NOTE: All examples are built with Bootstrap 3.x styles. To build fully responsive maps for all devices, see Bootstrap-map-js.

Instructions

  1. Fork and then clone the repo.
  2. Try the examples locally or try them here.

NOTE: You should just be able to cut-and-paste and run the examples in JSFiddle!

Example

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9">   
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
  <title>Basemaps</title>
  <link rel="shortcut icon" href="//esri.github.io/quickstart-map-js/images/favicon.ico">
  <!-- ArcGIS API for JavaScript CSS-->
  <link rel="stylesheet" href="//js.arcgis.com/3.10/js/esri/css/esri.css">
  <!-- Web Framework CSS - Bootstrap (getbootstrap.com) and Bootstrap-map-js (github.com/esri/bootstrap-map-js) -->
  <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="//esri.github.io/bootstrap-map-js/src/css/bootstrapmap.css">
  <style>
    html, body, #mapDiv {
      height: 100%;
      width: 100%;
    }
  </style>

  <!-- ArcGIS API for JavaScript library references -->
  <script src="//js.arcgis.com/3.10compact"></script>
  <script>
    require(["esri/map", 
      "dojo/on", 
      "dojo/dom", 
      "dojo/domReady!"], 
      function(Map, on, dom) {
        // Create map
        var map = new Map("mapDiv",{ 
          basemap: "gray",
          center: [-122.69, 45.52],
          zoom: 3
        });

        // Wire UI Events
        on(dom.byId("btnStreets"),"click", function() { 
          map.setBasemap("streets");
        });
        on(dom.byId("btnSatellite"),"click", function() { 
          map.setBasemap("satellite");
        });
        on(dom.byId("btnHybrid"),"click", function() { 
          map.setBasemap("hybrid");
        });
        on(dom.byId("btnTopo"),"click", function() { 
          map.setBasemap("topo");
        });
        on(dom.byId("btnGray"),"click", function() { 
          map.setBasemap("gray");
        });
        on(dom.byId("btnNatGeo"),"click", function() { 
          map.setBasemap("national-geographic");
        });
    });
  </script>   
</head>
  <body>
    <div class="panel panel-primary panel-fixed">
      <div class="panel-heading">
        <h3 class="panel-title">Basemaps</h3>
      </div>
      <div class="panel-body">
        <div class="btn-toolbar">
          <div class="btn-group">
            <button id="btnStreets" class="btn btn-default">Streets</button>
            <button id="btnSatellite" class="btn btn-default">Satellite</button>
            <button id="btnHybrid" class="btn btn-default">Hybrid</button>
            <button id="btnTopo" class="btn btn-default">Topo</button>
          </div>  
        </div>
        <div class="btn-toolbar">
          <div class="btn-group">
            <button id="btnGray" class="btn btn-default">Gray</button>
            <button id="btnNatGeo" class="btn btn-default">National Geographic</button>
          </div>  
        </div>
      </div>
    </div>
    <div id="mapDiv"></div>
  </body>
</html>

Requirements

  • Notepad or your favorite HTML editor
  • Web browser with access to the Internet
  • All samples reference:

Bootstrap 3.x: Web Framework CSS

//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css

Bootstrap-map-js: Map, Popup and Dijit CSS

//esri.github.io/bootstrap-map-js/src/css/bootstrapmap.css

Resources

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue. Thank you!

Contributing

Anyone and everyone is welcome to contribute. Please see our guidelines for contributing.

Licensing

Copyright 2013 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's license.txt file.

[](Esri Tags: ArcGIS Web Mapping QuickStart) [](Esri Language: JavaScript)

quickstart-map-js's People

Contributors

ajturner avatar alaframboise avatar andygup avatar jgravois avatar nixta avatar ungoldman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quickstart-map-js's Issues

Write a FeatureCollection example

FeatureCollections are super-powerful as they allow you to create more powerful graphics/featurelayers. They are useful because they don't need a FS, you can push any JSON/GeoJSON into it and take full advantage of renderers etc...

Programatic example

Hi Alan,
I really like this quick start. I'm currently building a web application and am trying to fully utilise Dojo: separating code into modules, using dijits etc. Much of the UI is built programmatically, e.g. var btn = new Button({label: "A button"}).placeAt("somewhere") etc. However, I really like the look of Bootstrap. I came across bootstrap-map-js first and considered switching to that. However, here I see you are not fully using bootstrap-map-js but have achieved the look and feel of Bootstrap by including it's css, which sounds like it might be closer to what I want.

I can see from the examples, e.g. the show panel example, that when you create buttons declaratively you don't decorate the tag with data-dojo attributes so they don't become a dijit/form/Button. Likewise, the panel is just a div with particular css classes, not a dijit/TitlePane etc.

I just wondered how well this worked when creating and controller a UI programmatically? How would you inject in new buttons with event handlers and so on. i.e. when creating a new dijit/form/Button you can add an 'onClick: function() { ... }' to the properties object. Also you can use lang.hitch and so on. Can you build a UI programmatically with bootstrap css and if so, do you have any tips?

My current approach has been to use pure Dojo but with the dbootstrap (https://github.com/thesociable/dbootstrap) module that skins regular Dojo dijits to look like bootstrap components. It works pretty well so far but I want to compare it against what can be achieved using bootstrap natively which seems like it might be a better supported method going forward.

Thanks in advance for any advice you can offer and sorry for the lengthy essay!
Simon

PS. came across this after watching some of your presentations from the dev conference earlier this year on video.esri.com. I didn't know it existed until I stumbled across it by accident. What a great resource though!

Add a GeoJSON to ArcGIS sample that uses Terraformer

There are two parts to this request. I've gotten a number of requests for this simple sample that shows converting point, line and polygon from GeoJSON to ArcGIS JSON for placement on an a map.

Last, is hosting a small file in the repo and show how to grab the GeoJSON file via an XHR request and then parse it as described above.

Samples are broken at http://esri.github.io/quickstart-map-js/html/symbols/symbols_polygons.html

init.js:927 dojo.io.script error Error: Token Required.(…)
2015-10-02 16:50:30.742 init.js:205 Error: Token Required.(…) "Error: Token Required.
at Error (native)
at Object.l.load (http://js.arcgis.com/3.10compact/init.js:570:220)
at http://js.arcgis.com/3.10compact/init.js:187:69
at c (http://js.arcgis.com/3.10compact/init.js:74:221)
at d (http://js.arcgis.com/3.10compact/init.js:74:10)
at b.Deferred.a.resolve.callback (http://js.arcgis.com/3.10compact/init.js:75:350)
at c (http://js.arcgis.com/3.10compact/init.js:74:436)
at d (http://js.arcgis.com/3.10compact/init.js:74:10)
at b.Deferred.a.resolve.callback (http://js.arcgis.com/3.10compact/init.js:75:350)
at http://js.arcgis.com/3.10compact/init.js:925:441"

Enhancement Request - Base Map Tour

Minor suggestion - provide a visual indicator that gives the user feedback as to which map is being displayed. For example, change the background color of the associated button, or add a new text field below the buttons that says the name of the map.

add geocoder sample that incorporates a 'category' search

documentaiton for the new feature is planned for 7/10

some examples:
http://geocodeqa.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?f=pjson&text=New+York+City%2C+New+York%2C+United+States&category=Populated%20Place

http://geocodeqa.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?f=pjson&text=New+York+City%2C+New+York%2C+United+States&category=City

there were already some POI category types, but i assume the changes in the service will make it easier to drill down and get what you want.

Load Feature Service Doesn't work

The Load Feature Service Map is not able to find any web services. I have tried multiple ESRI and personal rest services.

Thanks,
BG

Getting tile url 404's in Load Feature Service sample

In both Firefox and Chrome I'm seeing a bunch of 404 (and 502) errors that are hanging the app. The loading icon continues to display the addFeatureService() method runs but nothing gets added to the map.

"NetworkError: 404 Not Found - http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/2/0/1?blankTile=false"

"NetworkError: 502 Bad Gateway - http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/0/0/0?blankTile=false"

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.