Select to view content in your preferred language

Center at MapPoint

2446
4
Jump to solution
01-21-2016 11:43 PM
SaurabhRohilla
Deactivated User

Actually I am trying to recenter a map with a longitude and latitude from text boxes with widget in web app builder.

Can anybody help me out ?

0 Kudos
1 Solution

Accepted Solutions
MiriamBrockmann
Frequent Contributor

Hi Saurabh!

This is easy to do...you just need to use

               map.centerAt(mapPoint);

Here's the Reference:

Map | API Reference | ArcGIS API for JavaScript

You have to setup a new Point Geometry

    

               var point = new Point([x,y],new SpatialReference({ wkid:XXXXX }));
                   

with your Koordinates and use this Point to recenter the Map.

Regards

View solution in original post

0 Kudos
4 Replies
MiriamBrockmann
Frequent Contributor

Hi Saurabh!

This is easy to do...you just need to use

               map.centerAt(mapPoint);

Here's the Reference:

Map | API Reference | ArcGIS API for JavaScript

You have to setup a new Point Geometry

    

               var point = new Point([x,y],new SpatialReference({ wkid:XXXXX }));
                   

with your Koordinates and use this Point to recenter the Map.

Regards

0 Kudos
SaurabhRohilla
Deactivated User

Thanks Miriam for your response.

Can you please share the code because I need to use this javascript code in web app builder to create a widget. My doubt is where to write this code either in widget.js file or in widget.html file.@

0 Kudos
MiriamBrockmann
Frequent Contributor

I'm not familiar with the web app builder, but i think because it's javascript I

would place it in widget.js. This file is loaded at the start and so your code available

when you need it.

0 Kudos
SaurabhRohilla
Deactivated User

Thanks a lot Miriam....