Comments (7)
That's strange, maybe try a quick test using a single Graphic.geometry
? Or, maybe create a separate Graphic's Collection and try injecting that into mapview.goTo()
?
from angular-esri-map.
tried just adding a single graphic to the mapview and not using a graphiclayer ...
var polygonsymbol = {
type: "simple-fill",
color: [68, 68, 68, 0.25],
style: "solid",
outline: {
color: "#cc0000",
width: 3
}
};
var ncgraphic = new Graphic({
geometry: Poly,
symbol: polygonsymbol
});
vm.mapView.graphics.add(ncgraphic);
vm.mapView.goTo(ncgraphic.geometry);
the graphic gets added to the mapview but its extent does not get zoomed into the graphic's geometry
also, what do you mean by creating a separate Graphic's Collection? Like a GraphicsLayer? I have tried using the graphicslayer in the beginning and it didn't work
var graphiclayer = new GraphicsLayer();
var polygonsymbol = {
type: "simple-fill",
color: [68, 68, 68, 0.25],
style: "solid",
outline: {
color: "#cc0000",
width: 3
}
};
var ncgraphic = new Graphic({
geometry: Poly,
symbol: polygonsymbol
});
graphiclayer.graphics.add(ncgraphic);
vm.mapView.graphics.add(graphiclayer);
vm.mapView.goTo(graphiclayer.graphics);
Now if i use the Instantiated map object (instead of mapview) to set the extent the original Polygon's extent... it zooms in ... like this
vm.map.extent = Poly.extent;
vm.map.zoom = 10;
however, I want to see BOTH my point and polygon graphics extent in the map
from angular-esri-map.
-
How does AngularJS, Angular, or angular-esri-map play a role in this issue?
-
Can you recreate your described behavior in standalone sample?
I was able to get it to work by adding this quick test line to this sample:
https://developers.arcgis.com/javascript/latest/sample-code/intro-graphics/index.html
setTimeout(function() { view.goTo(view.graphics); }, 2000);
from angular-esri-map.
wow... so it seems like the mapview needs a couple seconds to register the graphics ...
thank you very much ... setting a timeout worked for me too
from angular-esri-map.
@snobrdinrtiste I would advise against relying on setTimeout
. That was just for a quick test.
You should rely on view.when...
as you continue to work with JSAPI v4.
from angular-esri-map.
@jwasilgeo thanks for the heads up... i was actually reading up on that Promise while in my meeting just now... i'll definitely try that out. thanks for all your help!!!!
Edit: Finally got a chance to make the necessary changes and this works ....
vm.mapView.when(function () {
vm.mapView.goTo(vm.mapView.graphics);
vm.mapView.zoom = 12;
});
from angular-esri-map.
Here's a good overview of working with promises in the JS API v4 https://developers.arcgis.com/javascript/latest/guide/programming-patterns/#async-data
from angular-esri-map.
Related Issues (20)
- Cannot use popupTemplate functions HOT 4
- Bower package not working but NPM Is HOT 3
- Critical dependency: the request of a dependency is an expression HOT 5
- Access ArcGIS Online items using OAuthentication - 4.3 HOT 10
- esriLoader.require()'s promise resolve an array failed HOT 1
- Vector Tile Layer not working HOT 2
- Graphics Layer Events Not Raised HOT 4
- Update README w/ status and up to date info on Angular 2(+) HOT 5
- Calcite bootstrap moved our cheese and broke gh-pages site HOT 2
- Need information on displaying routes HOT 7
- Minor: Broken CSS in the doc HOT 2
- AngularJS goes into Long Term Support on July 1, 2018 HOT 2
- Map loads only certain tiles HOT 4
- Short video tutorial HOT 3
- Testing the ArcGIS online sample shows error view.then is undefined HOT 4
- This repository is retired. It will be archived soon (Q4 2020) HOT 1
- Is there a wrapper for Angular2+ HOT 1
- Local csv file upload to csv layer of esri arcgis javascript api 4.12 HOT 8
- File Uploading to csv layer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-esri-map.