Hello.
I want to know if there is a way to move the center of the map when querying a little bit.
Iam querying some feature (just 1 result) and im doing this for showing it in the center of the map.
map.centerAndZoom(featureSet.features[0].geometry.getExtent().getCenter(),20);
In my app when i do this i have a problem on visualization, thats why i want to move it to the right a little bit.
This is what i obtain: (See the blue line on the screen)
The red container is over the map, thats why when i do the center i got that.
this is what i want to get:
Thanks in advice
Evelyn,
featureSet.features[0].geometry
Is a line or a polygon right? If it is a point then a point does not have an extent.
A point, thats why.
So how should i do the offset with a point?
Thanks in advice
Evelyn,
The Point Class in the JS API has an offset method as well.
https://developers.arcgis.com/javascript/3/jsapi/point-amd.html#offset
So your code would look like this instead:
map.centerAndZoom(featureSet.features[0].geometry.offset(10,0), 20);
Check the geometry type for the feature.
When is Point, get the current extent of the map and offset that instead!
(I think you should considering that for whatever geometry, but is up to you to consider it.)