Code Monkey home page Code Monkey logo

Comments (13)

nickcam avatar nickcam commented on May 29, 2024

Hi @Basicside,

No worries - there's a few good resources to help you out.
You should probably just get an angular app up and running with the arcgis js api first. Here's some repositories that show how to get started:
https://github.com/nickcam/angular2-esri-netcore
https://github.com/jwasilgeo/angular2-esri-playground

Once you're up and running you can just take the flareClusterLayer.ts file and include it in your project somewhere with your other typescript files.
You'll need to add the dojo typings through npm and also copy over the typings/index.d.ts. and typings/custom-typings.d.ts files. Reference index.d.ts somewhere in your project so the custom typings and dojo typings get picked up.

Then just import and use the FlareClusterLayer class like any other class in your project.

Hope it helps,
Nick

from flareclusterlayer.

Basicside avatar Basicside commented on May 29, 2024

Hi, Thanks for the reply :)
having the arcgis api running on angular 2 is kind of tricky but I already manage that, my problem is with the flareCluster it self.
first of all, I have the FlareClusterLayer on my application inside the fcl folder, and on my index.html the configurations for the dojo to import the file.
but then I have to add to the custom-typings something like that

declare module fcl/flareClusterLayer'{
    import flareClusterlayer = __esriExtend.flareClusterlayer;
    export = flareClusterlayer;
}

so angular can know what is the import FlareClusterLayer from fcl/flareClusterLayer
and I have to remove the "dojo/gfx from the custom-typings because it is in conflict with the dojo-typings

but then I'm having a error in the Flare file on line 644 surface.containerGroup = surface.createGroup();

so I comment that line and the three next lines, so I can go forward and see this working.
but know that this should be working when I run my application I have this error on the console
Uncaught ReferenceError: exports is not defined at flareClusterLayer.ts:1
TypeError: flareClusterLayer_1.default is not a constructor

from flareclusterlayer.

nickcam avatar nickcam commented on May 29, 2024

Hey man,

Sounds like you may be trying to use the javascript version and then reference it in typescript. Easiest thing is to just copy the typescript/flareClusterLayer.ts file to somewhere along side the rest or your typescript files.

Here's some quick steps that may help:

  • Copy typescript/flareClusterLayer.ts alongside your other ts files.
  • Add the typings: dojo-typings through npm, and index.d.ts and custom-typings.d.ts to somewhere in your project, ie ./typings/
  • Add a reference to index.d.ts to the top of your app.module.ts file (or whatever your main module is called) - ie /// <reference path="../typings/index.d.ts" />
  • Add the required esri and dojo module references to load.ts where you use esri-system-js.
    ie, in the esriSystem.register([ part. You can see it in this repo - https://github.com/nickcam/angular2-esri-netcore
  • Update the imports in flareClusterLayer.ts from this format:
    import * as GraphicsLayer from "esri/layers/GraphicsLayer"; to this format -
    import GraphicsLayer from "esri/layers/GraphicsLayer";
  • Then just import flareClusterLayer into any other typescript class you want.
    for example - import { FlareClusterLayer } from ' .\flareClusterLayer\flareClusterLayer';

If you create a plunkr or some other demo site I can have a look and edit it if you like.

Good luck,
Nick

from flareclusterlayer.

Basicside avatar Basicside commented on May 29, 2024

from flareclusterlayer.

nickcam avatar nickcam commented on May 29, 2024

Good stuff! Glad you got it going...closing this issue :).

from flareclusterlayer.

dealsmyself avatar dealsmyself commented on May 29, 2024

@Basicside can you please all the plnkr for this one as you got it to working .

from flareclusterlayer.

nickcam avatar nickcam commented on May 29, 2024

Hey @dealsmyself - this advice would be a bit outdated now. There's now esri-loader instead of esri-system-js. Just raise a new issue outlining your problems in detail if you can't get it going.

from flareclusterlayer.

dealsmyself avatar dealsmyself commented on May 29, 2024

Hi @nickcam quick question
in

FlareClusterLayer_v4.ts

exporting interface works , i.e
interface FlareClusterLayerProperties extends __esri.GraphicsLayerProperties {} is good
but when exporting class
export class FlareClusterLayer extends __esri.GraphicsLayer
got a error saying " __esri is not defined"

Please suggest.

Thank you

from flareclusterlayer.

nickcam avatar nickcam commented on May 29, 2024

Hi @dealsmyself - yeah you can't subclass an interface - __esri.GraphicsLayer is an interface in the typings.

Where are you getting that code from? The repository has the class signature like this -

import * as asd from "esri/core/accessorSupport/decorators";
import * as GraphicsLayer from "esri/layers/GraphicsLayer";
... other imports as well

@asd.subclass("FlareClusterLayer")
export class FlareClusterLayer extends asd.declared(GraphicsLayer)

from flareclusterlayer.

dealsmyself avatar dealsmyself commented on May 29, 2024

Hi @nickcam ,
since i am not using esri-system , i am not able get the imports.
and
in another issue i saw you gave a code for esri.service.ts in
https://gist.github.com/nickcam/162f3a375206737e5b5e42fc638c0fd8
there you referenced a BaseLoaderService

import { BaseLoaderService } from '../shared/base-loader.service';

could you please provide the code for baseloader service , that will be helpful for me.

Thank you.

from flareclusterlayer.

nickcam avatar nickcam commented on May 29, 2024

Ok, yeah you should be using esri-loader.

If you just want to include FlareClusterLayer and not compile it as part of your project, just see this documentation from the esri loader readme. https://github.com/Esri/esri-loader#configuring-dojo

As for the BaseLoaderService, just ignore it. It was an application specific service for my app I forgot to take out of the gist, I've removed it now.

from flareclusterlayer.

dealsmyself avatar dealsmyself commented on May 29, 2024

Thank you very much for your quick response @nickcam , let me give it a try and i will update you.

Thank you

from flareclusterlayer.

dealsmyself avatar dealsmyself commented on May 29, 2024

when i do this https://github.com/Esri/esri-loader#configuring-dojo
i dont need to npm install dojo typings right?
somehow its giving me
http://localhost:4200/fcl/FlareClusterLayer_v3.js net::ERR_ABORTED 404 (Not Found)

thank you

from flareclusterlayer.

Related Issues (20)

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.