Git Product home page Git Product logo

agsnode-dev's Introduction

ArcGIS JavaScript Development Environment in Node

This is a development environment I've put together to use Node.js to develop ArcGIS JavaScript applications.

Demo

You can view a demo of the application here. Easily deployed to Nodejitsu via command line.

Caveat

This is all experimental, as I have not tried to use this in production yet. But I'm excited to try it. I have some ideas on node modules I can try and use with this.

I still need to get my mocha tests implemented, which would be easy to run.

How to Use

To install, clone the repository, navigate to the folder.

Install required modules

npm install

Run the application

node app

Edit config.json Ideally this would come from a db source

{
  "appName": "AGS Node App",
  "layers": [
  {
    "type": "dynamic",
      "url": "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer",
      "id": "censusLayer",
      "title": "Census",
      "visible": true,
      "opacity": 0.5,
      "visibleLayers": [1,2,3,4,5],
      "operational": true,
      "identifyCapability": {
        "canIdentify": true,
        "identifyLayers": [1]
      }
  }
  ],

    "widgets": [
    {
      "name": "legend",
      "path": "widgets/legendtoc/LegendMenuWidget",
      "requireOperational": true
    },

    {
      "name": "geocoder",
      "options": {
        "autoComplete":true,
        "arcgisGeocoder": {
          "name":"Esri World Search",
          "suffix":" Redlands, CA"
        }
      }
    }
  ],

    "mapOptions": {
      "basemap": "gray",
      "autoResize": true,
      "center": [-118.20959546463835,34.28548773859569],
      "zoom": 10
    }
}

You can configure external css and the version of the API in routes/index.js

exports.index = function(req, res){
    var version = '3.3'; // just update the latest version of API here.
    res.render('index', { 
        title: 'ArcGIS Developer Application',
        styles: ['//serverapi.arcgisonline.com/jsapi/arcgis/' + version + '/js/dojo/dijit/themes/nihilo/nihilo.css',
                '//serverapi.arcgisonline.com/jsapi/arcgis/' + version + '/js/esri/css/esri.css',
                '//serverapi.arcgisonline.com/jsapi/arcgis/' + version + '/js/dojo/dojo/resources/dojo.css',
                '//serverapi.arcgisonline.com/jsapi/arcgis/' + version + '/js/dgrid/css/dgrid.css',
                '//serverapi.arcgisonline.com/jsapi/arcgis/' + version + '/js/esri/dijit/css/Popup.css',
                '/stylesheets/bootstrap.min.css',
                '/stylesheets/main.css'],
        scripts: ['//serverapi.arcgisonline.com/jsapi/arcgis/?v=' + version + 'compact',
                    'javascripts/main.js'
        ]
    });
};

Working Proxy

I made an attempt to try and use http-proxy for my proxy. In testing, I had some success. Will it work in all cases? I don't know, but would love some input if you are better at this than I am. The proxy appears to now be working. Needs further options for tokens and white lists, but happy so far.

Widgets

Included is a "legend" that you can add to the widgets array in the config.json file. The "legend" widget demonstrates how to make a widget work in the widget factory style. This means you can add non-Dojo widgets.

agsnode-dev's People

Contributors

odoe avatar

Watchers

 avatar  avatar

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.