Git Product home page Git Product logo

esri / jsapi-resources Goto Github PK

View Code? Open in Web Editor NEW
707.0 101.0 560.0 25.85 MB

A collection of resources for developers using the ArcGIS Maps SDK for JavaScript.

Home Page: https://developers.arcgis.com/javascript/latest/

License: Apache License 2.0

HTML 18.12% TypeScript 21.91% JavaScript 52.02% Makefile 0.37% CSS 4.19% Vue 3.31% Shell 0.09%
web-development javascript arcgis-api arcgis-js-api mapping sample-apps web-components

jsapi-resources's Introduction

Resources for the ArcGIS Maps SDK for JavaScript

A collection of resources for developers using the ArcGIS Maps SDK for JavaScript. Refer to the README files in each subdirectory for specific instructions on how to use a particular resource.

Samples

This repository provides a collection of code samples that provide proof-of-concept for using the ArcGIS Maps SDK for JavaScript components and core API with a variety of popular build tools, frameworks and module bundlers.

HTML OAuth callback page

If you have set OAuthInfo's popup property to true, you'll need to host a callback page on your server. For more information, visit the Maps SDK's Access secure resources guide topic.

AMD TypeScript declaration files (Deprecated)

The AMD TypeScript .d.ts files are deprecated at 4.29 and the final update will be 4.31. The last several files can be downloaded from this repo. The NPM .d.ts files can be installed via the arcgis-js-api package, which was also deprecated at 4.29. Use the @arcgis/core package instead.

Contributing

Please see our guidelines for contributing.

Licensing

Copyright 2024 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.

jsapi-resources's People

Contributors

andygup avatar annelfitz avatar arnofiva avatar benelan avatar bsvensson avatar dasa avatar davetimmins avatar dependabot[bot] avatar dzackgarza avatar gavinr avatar gavinr-maps avatar gisdev-km avatar github-actions[bot] avatar hgonzago avatar hhkaos avatar jcfranco avatar jeffjacobson avatar jgravois avatar jwasilgeo avatar lheberlie avatar manugadde avatar mfcallahan avatar miketschudi avatar mpriour avatar odoe avatar omarkawach avatar saschabrunnerch avatar swingley avatar tomwayson avatar tylerthekoder 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  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

jsapi-resources's Issues

Bower RequireJS demo fails to build "[e.add is not a function] Cannot read property normalize of undefined"

The grunt build for the bower/requirejs demo fails with the following error using node 5.1:

Running "requirejs:single" (requirejs) task
[TypeError: e.add is not a function]

TypeError: Cannot read property 'normalize' of undefined
In module tree:
app/main
esri/map
esri/_coremap
esri/layers/GraphicsLayer
esri/layers/gfxSniff
{ [Error: TypeError: Cannot read property 'normalize' of undefined
In module tree:
app/main
esri/map
esri/_coremap
esri/layers/GraphicsLayer
esri/layers/gfxSniff

at Object.<anonymous> (/Users/barry/git-repos/jsapi-resources/bower/requirejs/node_modules/requirejs/bin/r.js:1221:35)

]
originalError:
{ [TypeError: Cannot read property 'normalize' of undefined]
moduleTree:
[ 'esri/layers/gfxSniff',
'esri/layers/GraphicsLayer',
'esri/_coremap',
'esri/map',
'app/main' ],
fileName: '/Users/barry/git-repos/jsapi-resources/bower/requirejs/src/esri/layers/gfxSniff.js' } }

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/5.1.0/bin/node" "/Users/barry/.npm-packages/bin/npm" "run" "build"
npm ERR! node v5.1.0
npm ERR! npm v3.5.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: grunt build
npm ERR! Exit status 1

Sublayers of MapImageLayersProperties Have No Optional Properties

EDIT: This is an issue with the 4.x typescript definitions.

When following the example for creating a MapImageLayer with sublayers from https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#sublayers, my compiler complains because the 'sublayers' property does not match the signature expected by ArcGISDynamicServiceSublayers.

This is solved by changing the ArcGISDynamicServiceProperties' subLayers property from ArcGISDynamicServiceSublayers[] to ArcGISDynamicServiceSublayersProperties[], which is probably what was intended.

JS Api 4.0

What are the plans to publishing definition file for JS API 4.0?
Thanks.

Typings to @Types?

Any plans to move away from Typings for 4.x? Similar to what others are doing.

"@types/core-js": "^0.9.34",
"@types/dojo": "^1.9.36",
"@types/jasmine": "^2.5.36",
"@types/node": "^6.0.46",

TypeScript: copy to DefinitelyTyped?

I'm new to TypeScript, but so far it's been amazing, and I'm really thankful that we have ESRI bindings. I copied the d.ts. file to my local project, and that's been good. But, now I'm using TSD to manage my d.ts files. As far as I know, you can point TSD to a different repo, but that will be for ALL of your d.ts, not just one. A limitation of the tool, I think. But, is there anything stopping ESRI from pushing this t.ds to the DefinitelyTyped repo, which is the de facto resource to rule them all?

Arcgis DynamicMapServiceLayer overlay WebTiledLayer

Hi there, I am using arcgis api 3.20. I tried to overlay arcgis dynamicmapservicelayer on top of webtiledlayer but it only shows the dynamicmapservicelayer and ignoring the webtiledlayer. And if i reverse the order, only webtiledlayer is shown. How is this so?

Below is my sample code.

  var maptiler1 =new WebTiledLayer("http://localhost:8080/tms/1.0.0/sweden/EPSG3414/{level}/{col}/{row}.png", {
      "copyright": '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="https://carto.com/attributions">CARTO</a>',
      "id": "cartodb",
      "opacity": 0
    });
   map.addLayer(maptiler1);

  var layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer", {
        "opacity":0.5
    });
  
   map.addLayer(layer); 

Any help will be appreciated!

Bower install: Dojo build hangs with uglify compiler option

The closure compiler is less desirable b/c it is slower, requires Java, defaults to ES3 mode (and I've not found any examples that successfully demonstrate how to pass an option to tell it to use ES5 from the dojo build). For those reasons, I'd rather use uglify to compile my JS files, but it seems to hang forever w/ any build that includes the ArcGIS JS API files from bower.

Steps to reproduce:

  1. cd into bower/dojo folder and follow all install/build instructions to verify that it works
  2. npm install --save-dev uglify-js@1
  3. Modify optimize and layerOptimize options in build.profile.js to use 'uglify' instead of 'closure'
  4. Run npm run clean and npm run build the script will hang during the optimization step.

I've seen this before w/ the slurp files. However I can run the dojo-boilerplate (with no esri modules) w/ those both set to 'uglify' and it works. Furthermore, it also works to just set layerOptimize to 'uglify' and leave optmize set to 'closure'. To me, that means that there's something that is incompatible w/ the uglify compiler in (at least one of) the minified files that is not part of any build layer.

Declare public namespace to use classes

I would like to use the ArcGIS for JavaScript classes like that is possible with AngularJS:

$q: ng.IQService

Now it's like this:

First I have to declare the class:
import Map = require('esri/map');

then I can do this:
function (map: Map)

With kind regards,

Cees van Altena

when i load Tianditu(天地图) with WebTiledLayer,3.13 and 3.14 is ok,but 3.15 and 3.16 has error

image

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title></title>

    <link rel="stylesheet" `href="http://js.arcgis.com/3.15/dijit/themes/nihilo/nihilo.css">`
    <link rel="stylesheet" href="http://js.arcgis.com/3.15/esri/css/esri.css">
    <style>
        html, body, #map {
            height: 100%; width: 100%;
            margin: 0; padding: 0;
        }
        body{
            background-color: #fff; overflow:hidden;
            font-family: sans-serif;
        }
        #header {
            padding: 4px 15px 4px 0;
            background-color: #F2F2EC;
            color: #575757;
            font-size: 16pt;
            text-align: right;
            font-weight: bold;
            height:55px;
        }
        #subheader {
            color: #575757;
            font-size: small;
            padding: 5px 0 0 0;
            text-align: right;
        }
        #subheader a { color: #575757; }

        .ds { background: #000; overflow: hidden; position: absolute; z-index: 2; }
        #ds-h div { width: 100%; }
        #ds .o1 { filter: alpha(opacity=10); opacity: .1; }
        #ds .o2 { filter: alpha(opacity=8); opacity: .08; }
        #ds .o3 { filter: alpha(opacity=6); opacity: .06; }
        #ds .o4 { filter: alpha(opacity=4); opacity: .04; }
        #ds .o5 { filter: alpha(opacity=2); opacity: .02; }
        #ds .h1 { height: 1px; }
        #ds .h2 { height: 2px; }
        #ds .h3 { height: 3px; }
        #ds .h4 { height: 4px; }
        #ds .h5 { height: 5px; }
    </style>

    <script src="http://js.arcgis.com/3.15/"></script>
    <script>
        var map;
        require([
            "esri/map", "esri/layers/WebTiledLayer","esri/geometry/Point", "esri/layers/TileInfo", "dojo/parser",

            "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"
        ], function(
                Map, WebTiledLayer,Point, TileInfo, parser
        ) {
            parser.parse();

            //定义地图
            map = new Map("map", {
                "spatialReference":{"wkid":4326},
                center: [0.985, 29.822],
                zoom: 3
            });

            //定义瓦片结构
            var tileInfo = new TileInfo({
                "rows" : 256,
                "cols" : 256,
                "compressionQuality" : 0,
                "origin" : {
                    "x" : -180,
                    "y" : 90
                },
                "spatialReference" : {
                    "wkid" : 4326
                },
                "lods" : [
                    {"level" : 2, "resolution" : 0.3515625, "scale" : 147748796.52937502},
                    {"level" : 3, "resolution" : 0.17578125, "scale" : 73874398.264687508},
                    {"level" : 4, "resolution" : 0.087890625, "scale" : 36937199.132343754},
                    {"level" : 5, "resolution" : 0.0439453125, "scale" : 18468599.566171877},
                    {"level" : 6, "resolution" : 0.02197265625, "scale" : 9234299.7830859385},
                    {"level" : 7, "resolution" : 0.010986328125, "scale" : 4617149.8915429693},
                    {"level" : 8, "resolution" : 0.0054931640625, "scale" : 2308574.9457714846},
                    {"level" : 9, "resolution" : 0.00274658203125, "scale" : 1154287.4728857423},
                    {"level" : 10, "resolution" : 0.001373291015625, "scale" : 577143.73644287116},
                    {"level" : 11, "resolution" : 0.0006866455078125, "scale" : 288571.86822143558},
                    {"level" : 12, "resolution" : 0.00034332275390625, "scale" : 144285.93411071779},
                    {"level" : 13, "resolution" : 0.000171661376953125, "scale" : 72142.967055358895},
                    {"level" : 14, "resolution" : 8.58306884765625e-005, "scale" : 36071.483527679447},
                    {"level" : 15, "resolution" : 4.291534423828125e-005, "scale" : 18035.741763839724},
                    {"level" : 16, "resolution" : 2.1457672119140625e-005, "scale" : 9017.8708819198619},
                    {"level" : 17, "resolution" : 1.0728836059570313e-005, "scale" : 4508.9354409599309},
                    {"level" : 18, "resolution" : 5.3644180297851563e-006, "scale" : 2254.4677204799655}
                ]
            });

            //地图
            var baseMap = new WebTiledLayer("http://${subDomain}.tianditu.com/DataServer?T=vec_c&X=${col}&Y=${row}&L=${level}", {
                "copyright": "Tianditu",
                "id": "Tianditu",
                "subDomains": ["t0", "t1", "t2"],
                "tileInfo":tileInfo
            });
            //底图标注
            var baseMapMarker = new WebTiledLayer("http://${subDomain}.tianditu.com/DataServer?T=cva_c&X=${col}&Y=${row}&L=${level}", {
                "copyright": "Tianditu",
                "id": "Tianditu2",
                "subDomains": ["t0", "t1", "t2"],
                "tileInfo":tileInfo
            });
            map.addLayer(baseMap);
            map.addLayer(baseMapMarker);
            //定位到北京
            map.centerAndZoom(new esri.geometry.Point({"x": 116.39, "y": 39.91, "spatialReference": {"wkid": 4326 } }),14);
        });
    </script>
</head>
<body class="nihilo">
<div id="mainWindow"
     data-dojo-type="dijit/layout/BorderContainer"
     data-dojo-props="design:'headline',gutters:false"
     style="width: 100%; height: 100%; margin: 0;">
    <div id="map" class="shadow"
         data-dojo-type="dijit/layout/ContentPane"
         data-dojo-props="region:'center'">

        <!-- drop shadow divs -->
        <div id="ds">
            <div id="ds-h">
                <div class="ds h1 o1"></div>
                <div class="ds h2 o2"></div>
                <div class="ds h3 o3"></div>
                <div class="ds h4 o4"></div>
                <div class="ds h5 o5"></div>
            </div>
        </div> <!-- end drop shadow divs -->

    </div>
</div>
</body>
</html>

MapView toScreen() issue

Hi Guys,

I'm seeing some weird behavior using MapView toScreen() function in 4.2

It works fine on initial draw of a graphic, but when you pan the map all the way around the globe back to the point then the returned x value is way out.

See this plunk for an example: https://plnkr.co/edit/OPQaau3ULeGlH469Jqpz

Hover over the graphic to see the toScreen values returned.

I've worked around it by adding this code to check if the map has been wrapped around using the worldScreenWidth property and adjusting the value, but I feel like toScreen should be returning the correct value all the time, regardless of whether the map has been wrapped around?

var sp = mapView.toScreen(<some web merc point>);
var wsw = mapView.state.worldScreenWidth;
//get a ratio to determine how many times the map has been wrapped around.
let ratio = parseInt((sp.x / wsw).toFixed(0)); 
if (sp.x < 0) {
   //x is less than 0. Adjust by the world screen width.
   sp.x += wsw * (ratio * -1);
}
else if (sp.x > wsw) {
   //x is too big, cater for it.
   sp.x -= wsw * (ratio);
}

This seems to work for web merc points, using a geographic SR has a different set of issues I think.

Thanks,
Nick

Typescript: Locator Suggestions

The "suggest-locations-complete" event-object on Locator does only reference to a target Locator. It would be nice to add a reference to the received suggestions. Unfortunately there is no Suggestion Class in the js API (like AddressCandidate), but you could use an any-array:

Line 13262:

/** Fires when the suggestLocation method has completed. */
on(type: "suggest-locations-complete", listener: (event: { suggestions: any[]; target: Locator }) => void): esri.Handle;

In my case, i added a new module "esri/tasks/Suggestion"

declare module "esri/tasks/Suggestion" {

    class Suggestion {
        isCollection: boolean;
        magicKey: string;
        text: string;
    }
    export = Suggestion;

}
...
class Locator{
  import Suggestion = require("esri/tasks/Suggestion");
...
    /** Fires when the suggestLocation method has completed. */
    on(type: "suggest-locations-complete", listener: (event: { suggestions: Suggestion[]; target: Locator }) => void): esri.Handle;
...

}

Search Widget "Invalid regular expression" error

The Search Widget appears to use regex in some capacity, which crashes if passed-in an invalid string after search suggestions have appeared. As an example, type in an opening bracket "[". This will crash the widget.

I believe it is the lack of a closing right bracket which causes this error. The Widget can not recover from this error.

requirejs sample loads 164 individual .css files

the dojo build sample produced what i'd expect, but i counted 164 unconcatenated stylesheets loading when i launched the built requirejs sample.

STR:

  1. clone repo
  2. cd into ./bower/requirejs
  3. npm install
  4. npm build (all green so far)
  5. run /dist/index.html and inspect network traffic.

screenshot 2016-02-16 16 11 32

can anyone else confirm the behavior?

Typescript subclassing in v4.1

Hi,

In v4.0 I am creating some custom classes using simple inheritance in typescript. For example:

import * as GraphicsLayer from "esri/layers/GraphicsLayer";

export class CustomLayer extends GraphicsLayer {
    constructor(options: __esri.GraphicsLayerProperties) {
            super(options);
    }

    //implementation....
}

This is no longer working in 4.1 - error occurs on the super(options) call in the constructor. Not just for graphics layers, but for a renderer and the popup widget, so I'm assuming this is across the board.

I've had a quick look and from what I can gather the accessor objects metadata property is not getting assigned when subclassing in this way.

Before I dug too deep thought I'd just ask if you're aware of this and if you know of how to handle subclassing in typescript for v4.1?

For a detailed example working in 4.0 - https://github.com/nickcam/FlareClusterLayer

Thanks.

I get error by the method,please help me

I am write at here 🥇

    require.config({
        //baseUrl:url , //gisHome是全局变量,在testAll.js中判断用户是否创建
        map: {
            '*': {
                css: url+'oss_core/gis/core/js/css.js'
            }
        },
        
	    packages: [
	    'myModules',{
	        "name": "myModules",
	        "location": url + "oss_map/gis/core/platform/arcgis/ext"
	    },
	    'esri',{
	    	name:'esri',
	    	location:url+'oss_map/gis/core/platform/arcgis/library/3.13/esri'
	    } ,
	    'dojo',{
	    	name:'dojo',
	    	location:url+'oss_map/gis/core/platform/arcgis/library/3.13/dojo'
	    },
   	    'dojox',{
	    	name:'dojox',
	    	location:url+'oss_map/gis/core/platform/arcgis/library/3.13/dojox'
	    },
	    'dijit',{
	    	name:'dijit',
	    	location:url+'oss_map/gis/core/platform/arcgis/library/3.13/dijit'
	    },

.....
but brower get error:

10.45.50.45:8040/oss/oss_map/gis/core/platform/arcgis/library/3.13/dojo/_base/loader.js:10 Uncaught TypeError: h.initSyncLoader is not a function
at Object. (10.45.50.45:8040/oss/oss_map/gis/core/platform/arcgis/library/3.13/dojo/_base/loader.js:10)
at Object.execCb (require.js:1696)
at Module.check (require.js:883)
at Module. (require.js:1139)
at require.js:134
at require.js:1189
at each (require.js:59)
at Module.emit (require.js:1188)
at Module.check (require.js:938)
at Module.enable (require.js:1176)

undefinedmodule error

hi thanks for the sample, i tried to run the sample. I am ended with undefined module error . I have checked in IE developer tools MapController.js is not getting download. Any suggestions? Thanks in advance.

regards
sree

RequireJS demo application fails to build when dojox is a dependency

(Sorry if this is the wrong place) Would you be able to update the demo to show it working with dojox? I'm trying to get this running in my application and it fails when it trys to load in "dojox.js" (which doesn't exist). I'm thinking the same would occur when adding a dependency to it in this project (something in my applications dependency chain ends up relying on "dojox/json/query" which is what depends on "dojox" .

I intend to test this out myself when I have some more time but please let me know if I'm missing something obvious here.

Thanks

More docs on using types for 3.x and 4.x?

Can someone explain to me (or just set me straight) why the typings for JSAPI 3.x aren't using a namespace?

For example, I see in the 4.x typings that it does explicitly list the __esri namespace.

This question stems from an issue conversation over in
angular2-esri-loader, where I am working with JSAPI 3.19 for an Angular2+TypeScript2 demo app. I installed the types with npm install @types/[email protected], but my VSCode claims it doesn't know anything about the __esri namespace. I poked around and only found "__esri" in the 4.x typings.

Is there something else I need to do (in addition to making sure arcgis-js-api typings are/n't excluded in my project's tsconfig.json)?

Does the 3.x arcgis-js-api.d.ts file need to have this namespace declaration, too?

Thanks!

MapView hitTest() in IE11 and Edge

Hi Guys,

I hate IE & Edge as much as anyone - but unfortunately people still use them :(.
It looks like MapView hitTest() isn't returning any results for those browsers when it should be.

You can see it not working in this sample -
https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=view-hittest

Could be something to do with element ordering, because if I set the z-index of the created layerView's container element to 1 hitTest picks up results...doing this obviously introduces other problems though.
Thanks.

Deferred Return types

The type on execute of esri/tasks/QueryTask is of type any. It should be of promise so that you are not forced to use callbacks (personal pref but I much prefer promises). There are many examples where this is the case other than query

I understand that you may not want to create a dependency on the dojo typings, but could an esriDeferred or similar not be included? I believe this is what has been done with esri.color

execute(parameters: Query, callback?: Function, errback?: Function): dojo.promise.Promise

interface Deferred {

    /**
     * The public promise object that clients can add callbacks to.
     */
    promise: promise.Promise<T>;

    /**
     * Checks whether the deferred has been resolved.
     */
    isResolved(): boolean;

    /**
     * Checks whether the deferred has been rejected.
     */
    isRejected(): boolean;

    /**
     * Checks whether the deferred has been resolved or rejected.
     */
    isFulfilled(): boolean;

    /**
     * Checks whether the deferred has been canceled.
     */
    isCanceled(): boolean;

    /**
     * Emit a progress update on the deferred.
     */
    progress(update: any, strict?: boolean): promise.Promise<T>;

    /**
     * Resolve the deferred.
     */
    resolve(value?: T, strict?: boolean): promise.Promise<T>;

    /**
     * Reject the deferred.
     */
    reject(error?: any, strict?: boolean): promise.Promise<T>;

    /**
     * Add new callbacks to the deferred.
     */
    then<U>(callback?: promise.PromiseCallback<T, U>, errback?: promise.PromiseErrback<U>, progback?: promise.PromiseProgback): promise.Promise<U>;

    /**
     * Inform the deferred it may cancel its asynchronous operation.
     */
    cancel(reason?: any, strict?: boolean): any;

    /**
     * Returns `[object Deferred]`.
     */
    toString(): string;
}

Problem wrapping an Esri class with Typescript

I'm having issues creating a simple wrapper for a map using typescript.

The relevant code is

import Map = require("esri/Map");

export class MapWrapper extends Map {
  constructor(basemap: string) {
    super({
      basemap: basemap
    });

    console.log("Created map with basemap " + basemap);
  }
}

This gives me a Uncaught TypeError: Cannot read property 'basemap' of undefined.

Any ideas?

[arcgis-js-api.d.ts] PrintTask oncomplete event handler type def is different from what happens at runtime

I am using PrintTask from ArcGIS API for JavaScript 3.17. When the PrintTask completes, the argument passed to the event handler is different from what the type definition says:

Current type definition:

on(type: "complete", listener: (event: { url: string; target: PrintTask }) => void): esri.Handle;

The current definition is correct as per ESRI official documentation: https://developers.arcgis.com/javascript/3/jsapi/printtask-amd.html#event-complete

However, at runtime:

on(type: "complete", listener: (event: { result: { url: string; }; target: PrintTask }) => void): esri.Handle;

At runtime the url is wrapped into the result property of the callback argument.

Pull request will follow shortly...

Thanks for the definitions!

Please package as Commonjs\es6

The majority of the js developer ecosystem centers around NPM and commonjs / es6 modules. As you've already provided a bower package solution, could you please provide a commonjs/es6 soltuion that we can simply NPM install?

This would literally be a dream come true for those of us who belong to a growing community of developers choosing webpack / rollupjs. As a value add, both of those bundler techs support tree shaking and dead code elimination. So if you're only using the map from the js api, only the map and it's dependencies will be packaged with the 'compiled' app. So no need to provide custom api builds.

how to delete VectorTileLayerImpl and IdentityManager when building Project

I don't need the VectorTileLayerImpl.js and IdentityManager.js , then delete them in build.profile.js 。
my build.profile.js like this,but it still loaded in my app.

layers: {
"dojo/dojo": {
boot: true,
customBase: true,
// just like 3.17
include: [
"app/main",
"dojox/gfx/path",
"dojox/gfx/svg",
"dojox/gfx/filters",
"dojox/gfx/svgext",
"dojox/gfx/shape",
],
includeLocales: ["en-us"]
}
}

pg qynh6gs9_2r3b32 chr

MapView hitTest on TextSymbols

Hi Guys,

Not sure if this by design or not, but hitTest() on MapView isn't picking up graphics that are symbolized using TextSymbols.

See this plunk: https://plnkr.co/edit/WRi5xfMJFKiRITqRqy6q
The standard SimpleMarkerSymbol no problems, but the two text graphics...no joy.

Can get around it in Chrome by setting pointer-events="bounding-box" on the <text> element. But this is only supported in Chrome it seems. I realize IE/Edge won't work as well.

Thanks,
Nick

Module "Has no default export"

Hello,

I'm trying to import different objects in an angular 2 app.
To do so, I write this :
import FeatureLayer from 'esri/layers/FeatureLayer';

My IDE tells me Module 'esri/layers/FeatureLayer' Has no default export

Should the application has default export ? Maybe I'm using it wrongly...

Running the demo code verbatim results in an error

Copying the demo files, compiling using VS2015, and running in Visual Studio results in the following error:

Unhandled exception at line 143, column 273 in http://js.arcgis.com/3.14/

0x800a138f - JavaScript runtime error: Unable to get property 'id' of undefined or null reference

This error is encountered when the following line is called:

this.map = new Map(this.mapDiv, mapOptions);

Demo npm run dev fails

Here is some early feedback. Hopefully it helps yall out...

C:\2017\jsapi-resources-master\4.x\typescript\demo>npm install
[email protected] C:\2017\jsapi-resources-master\4.x\typescript\demo
+-- @types/[email protected]
+-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | -- [email protected] | | | +-- [email protected] | | | -- [email protected]
| | +-- [email protected]
| | -- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | | -- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | | -- [email protected]
| | | +-- [email protected]
| | | -- [email protected] | | +-- [email protected] | | -- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | -- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | -- [email protected]
| -- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | | -- [email protected]
| | | -- [email protected] | | +-- [email protected] | | | +-- [email protected] | | | -- [email protected]
| | -- [email protected] | +-- [email protected] | | +-- [email protected] | | | -- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | -- [email protected]
| | +-- [email protected]
| | -- [email protected] | +-- [email protected] | +-- [email protected] | | -- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | | -- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | | -- [email protected]
| | | | -- [email protected] | | | +-- [email protected] | | | | -- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | -- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | -- [email protected]
| | | -- [email protected] | | +-- [email protected] | | | -- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | -- [email protected] | | -- [email protected]
| +-- [email protected]
| +-- [email protected]
| | -- [email protected] | -- [email protected]
| -- [email protected] -- [email protected]

npm WARN [email protected] No repository field.
npm WARN [email protected] license should be a valid SPDX license expression

C:\2017\jsapi-resources-master\4.x\typescript\demo>npm run dev

[email protected] dev C:\2017\jsapi-resources-master\4.x\typescript\demo
tsc -w .

error TS6053: File '.ts' not found.
4:26:12 PM - Compilation complete. Watching for file changes.

*d.ts module export format: default or '='

Hi all,

Just wondering if there's a compelling reason as to why all of the modules in *.d.ts export in this format?

declare module "esri/Map" {
    import Map = __esri.Map;
    export = Map;
}

I would have thought since every module only exports a single object, using a default export would be better.

declare module "esri/Map" {
    import Map = __esri.Map;
    export default Map;
}

Certainly makes importing easier - well in my case it does anyway, which involves systemjs/ngc/rollup for dev and prod builds of an Angular 2 app.

I realise dojo exports the same way, but is it really necessary? Would prefer to use the official typings instead of editing after importing.

Perhaps it's possible to have multiple official typings per api?

Thanks,
Nick

arcgis-js-api-sample-app is not found in this npm registry

I get the error below: please, advice.

25 error npm v2.15.1
26 error code E404
27 error 404 Registry returned 404 for GET on https://registry.npmjs.org/arcgis-js-api-sample-app
27 error 404
27 error 404 'arcgis-js-api-sample-app' is not in the npm registry.
27 error 404 You should bug the author to publish it (or use the name yourself!)
27 error 404
27 error 404 Note that you can also install from a
27 error 404 tarball, folder, http url, or git url.
28 verbose exit [ 1, true ]

HistogramTimeSlider - bug?

Hello all,

I'm quite fresh in JS and the ESRI API and I hope this is the right spot ...

While customizing the HistogramTimeSlider sample code ( https://developers.arcgis.com/javascript/3/jssamples/widget_histogram_time_slider.html )
I experienced a possible bug in this widget.

Have a look at this url/script :
http://www.geo-informatie.nl/zoest001/AGO-JS/TimeSliderHistogram/HistogramTimeSlider-Months.html
The polygons are time-grouped by months, which is to coarse.
Grouping by days works fine too, but is to detailed.
Grouping them by weeks ( timeInterval: "esriTimeUnitsMonths" ) :
http://www.geo-informatie.nl/zoest001/AGO-JS/TimeSliderHistogram/HistogramTimeSlider-Weeks.html
leads to an error (InternetExplorer-11 and Chrome-51) :
TypeError: Unable to draw graphic (null): Unable to get property 'length' of undefined or null reference TypeError: Unable to draw graphic (null): Unable to get property 'length' of undefined or null reference at _add (http://js.arcgis.com/3.17/esri/dijit/HistogramTimeSlider.js:18:458) at Anonymous function (http://js.arcgis.com/3.17/esri/dijit/HistogramTimeSlider.js:9:195) at Anonymous function (http://js.arcgis.com/3.17/:644:363) at c (http://js.arcgis.com/3.17/:119:64) at _fireUpdateEnd (http://js.arcgis.com/3.17/:848:341) at _applyTimeFilter (http://js.arcgis.com/3.17/:1992:415) at propertyChangeHandler (http://js.arcgis.com/3.17/:1984:196) at _timeChangeHandler (http://js.arcgis.com/3.17/:1928:19) at Anonymous function (http://js.arcgis.com/3.17/:63:200) at c (http://js.arcgis.com/3.17/:119:64) { [functions]: , __proto__: { }, description: "Unable to get property 'length' of undefined or null reference", message: "Unable to draw graphic (null): Unable to get property 'length' of undefined or null reference", name: "TypeError", number: -2146823281, stack: "TypeError: Unable to draw graphic (null): Unable to get property 'length' of undefined or null reference at _add (http://js.arcgis.com/3.17/esri/dijit/HistogramTimeSlider.js:18:458) at Anonymous function (http://js.arcgis.com/3.17/esri/dijit/HistogramTimeSlider.js:9:195) at Anonymous function (http://js.arcgis.com/3.17/:644:363) at c (http://js.arcgis.com/3.17/:119:64) at _fireUpdateEnd (http://js.arcgis.com/3.17/:848:341) at _applyTimeFilter (http://js.arcgis.com/3.17/:1992:415) at propertyChangeHandler (http://js.arcgis.com/3.17/:1984:196) at _timeChangeHandler (http://js.arcgis.com/3.17/:1928:19) at Anonymous function (http://js.arcgis.com/3.17/:63:200) at c (http://js.arcgis.com/3.17/:119:64)" } "TypeError: Unable to draw graphic (null): Unable to get property 'length' of undefined or null reference at _add (http://js.arcgis.com/3.17/esri/dijit/HistogramTimeSlider.js:18:458) at Anonymous function (http://js.arcgis.com/3.17/esri/dijit/HistogramTimeSlider.js:9:195) at Anonymous function (http://js.arcgis.com/3.17/:644:363) at c (http://js.arcgis.com/3.17/:119:64) at _fireUpdateEnd (http://js.arcgis.com/3.17/:848:341) at _applyTimeFilter (http://js.arcgis.com/3.17/:1992:415) at propertyChangeHandler (http://js.arcgis.com/3.17/:1984:196) at _timeChangeHandler (http://js.arcgis.com/3.17/:1928:19) at Anonymous function (http://js.arcgis.com/3.17/:63:200) at c (http://js.arcgis.com/3.17/:119:64)"

Kind regards,
Roland van Zoest (NL)

TypeScript 4.x issue with esri/request

Hi,

Maybe I'm missing something but I get an error in the typings file for esri/request:

ERROR in [at-loader] typings\globals\arcgis-js-api\index.d.ts:7181:12
'request' only refers to a type, but is being used as a namespace here.

All the rest works fine, so I think something is wrong with this typing?

Error when loading TemplatePicker using requriejs

Version:3.19


Gives an error: 'dojo' not found.
Module Tree is:

      esri/dijit/editing/TemplatePicker
        dojox/grid/DataGrid
          dojox/grid/_Grid
            dojox/grid/_Layout
              dojox/grid/_RowSelector
                dojox/grid/_View

is it necessary that dojox/grid/_View.js has dojo as its dependency?

IdentityManager

Importing the IdentityManager will not give code completion. The object seems not to be valid. The same with the IdentityManagerBase.
image

Bower Sample Application for 4.0 does not initially build

I was testing out the bower sample application under the folder jsapi-resources/4.x/bower/dojo and after I cloned the code and tried running the commands from the README, the build failed and the app would not load. It ended up being a really easy fix.

When I ran npm install which triggers bower install, it installed all the bower components into a bower_components folder because there is no .bowerrc present. The build commands look for the bower components in the src folder. All I had to do was simply copy the contents from the bower_components folder into the src directory and then the app and build worked fine. I have this working locally but just wanted to let you guys know incase you want to add a .bowerrc or a note in the README to let people know they need to move the bower installed components into the src folder.

Issue with PictureFillSymbol in 4.2

I'm having issues using PictureFillSymbol with version 4.2 of the API and typescript. I've tried externally and internally hosted images, and always get the following error:

Uncaught TypeError: Right-hand side of 'instanceof' is not an object
    at b.l._getParentSurface (MapView.js:333)
    at b.l._setFillObject (MapView.js:333)
    at b.l.setFill (MapView.js:330)
    at Object.m.styleShape (MapView.js:381)
    at f.render (MapView.js:368)
    at d.renderChild (MapView.js:364)
    at d.renderChildren (MapView.js:259)
    at d.render (MapView.js:255)
    at m.renderChild (MapView.js:290)
    at m.d.renderChildren (MapView.js:259)

The relevant code is:

//This works
//let symbol = new SimpleFillSymbol({
//  color: new Color([0, 0, 0, 0.5]),
//  outline: { // autocasts as new SimpleLineSymbol()
//    color: new Color([255, 255, 255]),
//    width: 1
//  }
//});

//This doesn't
let symbol = new PictureFillSymbol({
  url: url,
  outline: {
    color: new Color([255, 255, 255]),
    width: 1
  },
  width: width,
  height: height
});

let polygon = new Polygon({
  rings: [
    [
      [0, 0],
      [20, 0],
      [20, -20],
      [0, -20],
      [0, 0]
    ]
  ],
  spatialReference: { wkid: 4326 }
});

let graphic = new Graphic({
  geometry: polygon,
  symbol: symbol
});

layer.add(graphic);

Can anyone that has successfully gotten PictureFillSymbol to work with 4.x give a code sample?

TypeScript 2.1.4 issue in .d.ts

I updated to TypeScript 2.1.4 and I get the error

declare module "esri/request" {
import request = __esri.request;
export = request.esriRequest;
}

Error: typings\globals\arcgis-js-api\index.d.ts(7181,12): error TS2702: 'request' only refers to a type, but is being used as a namespace here.

TypeScript definition for InfoWindowLite in 3.* api is incorrect

Based on this sample https://developers.arcgis.com/javascript/3/jssamples/widget_infowindow.html (and my own experience), I believe that the InfoWindowLite constructor for the 3.* typescript definitions are incorrect. I'm not positive what they should be, but it appears that the InfoWindowLite actually takes 2 parameters.

I'm pretty sure it's incorrect in the typescript definitions because it's also incorrect on the api documentation page: https://developers.arcgis.com/javascript/3/jsapi/infowindowlite-amd.html

Setting "visible" property on Graphic object results in error on (SceneLayer) layer.

If a graphic is returned as part of a call to "[mySceneLayer].queryFeatures()", a call to "[myGraphic].visible = [true/false]" will result in an error "TypeError: this.layer.graphicChanged is not a function".

Digging into the (minified) code, it appears that the call to "_notifyLayer()" within "esri/Graphic", which in turn calls "this.layer.graphicChanged()", is the culprit:

Object.defineProperty(a.prototype, "visible", { set: function(b) { var a = this._get("visible"); a !== b && (this._set("visible", b), this._notifyLayer("visible", a, b)) }, enumerable: !0, configurable: !0 });

According to the API docs, it seems this should be a valid call.

RequireJS demo app "single" build is incomplete

Making a new ticket since my last comment in #15 was missed/ignored.

The single file build for the requireJS configuration doesn't contain all of the required files. You can reproduce this by running the build and then searching through the compiled main.js for any of the following keywords used in the non-compiled main.js:

  • "measureDiv"
  • "map-area"
  • "esri/dijit/Measurement"

Am I missing something here? I've got a couple other issues I'm encountering with my own app specific code that'd I'd like to reproduce in this sample project but I can't if it doesn't build into a single file.

Missing semicolons

There are a lot of lines in the d.ts-file with missing ";" (e.g. line 1527). The line end is always: ": esri.Handle"

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.