Select to view content in your preferred language

Get the center of the map

1422
6
Jump to solution
09-23-2016 10:56 AM
GeorgeCastell
New Contributor

Hi guys

I have a query, I am printing several points (lat, long) on the map and want to know that the map center (lat, long) in order to show all the printed dots. Can someone help me please!!!

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

George,

   There is a time to use centerAndZoom but what you described would better be using by setting the maps extent using

map.setExtent(graphicsUtils.graphicsExtent(yourArrayofGraphics), true);

View solution in original post

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus

George,

  If you want the center of the map then you use 

map.extent.getCenter()

or

map.geographicExtent.getCenter()

if it is the center of the graphics you are adding then you will use

graphicsUtils.graphicsExtent(yourArrayofGraphics)

.

GeorgeCastell
New Contributor

thank you very much, and one more question as determined zoom to show all points on my map.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

???

0 Kudos
GeorgeCastell
New Contributor

Sorry I'm new to the use of this API.
and I have the heart to my map, now I need is to know the zoom level so that all points are shown on the map.

I'm using this map.centerAndZoom (point, zoom);

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

George,

   There is a time to use centerAndZoom but what you described would better be using by setting the maps extent using

map.setExtent(graphicsUtils.graphicsExtent(yourArrayofGraphics), true);
0 Kudos
GeorgeCastell
New Contributor

I understand, thank you very much for your help.

0 Kudos