Select to view content in your preferred language

Bookmark Widget---how to convert the Longitude and Latitude to Extent information?

1176
6
01-06-2011 07:19 AM
yeeouyang
Deactivated User
Hi guys,

Happy new year~

I wanna add some new area in Bookmark Widget configuration file. It requires the Extent information of the area, while my data is in longitude and latitude format. It not the same as Extent. Anybody can tell me how to convert Longitude and Latitude to Extent information?
Thanks very much.

Yee
Tags (2)
0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus
Yee,

   Just use the locate widgets coordinate option (the blue push pin button) to recenter the map to the coordinate and then zoom in to the extent that you would like and then use the book mark widget to add the new bookmark.
0 Kudos
yeeouyang
Deactivated User
Hi Robert,

Thanks very much.  I ever thought this idea. while the problem is that I have several hundreds areas(counties and cities) which has different Extent and I like to customize the bookmark widget, firstly put all the area information in xml configuration file, then providing a search box or a list in bookmark widget for users to choose their interested area.

The data I have is the Longitude and Latitude of Xmin, Xmax, Ymin, Ymax of each area, so there is a barrier between this and the Extent. i don't know how to covert them, and tried some methods, but failed.

Thanks.

Yee



Yee,

   Just use the locate widgets coordinate option (the blue push pin button) to recenter the map to the coordinate and then zoom in to the extent that you would like and then use the book mark widget to add the new bookmark.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Yee,

   So the code to get the four values you have into an extent would simply be:

import com.esri.ags.geometry.Extent;
var ext:Extent = new Extent(your.xmin, your.ymin, your.xmax, your.ymax);


If your map is using ESRI base maps then you need to have the extent in webMercator in that case use this instead:

import com.esri.ags.geometry.WebMercatorExtent;
var ext:WebMercatorExtent = new WebMercatorExtent(your.xmin, your.ymin, your.xmax, your.ymax);
0 Kudos
yeeouyang
Deactivated User
hi Robert,

It seems that I didnt explain my problem clearly. Here is an example.

in the xml configuration file, we could see

<?xml version="1.0" ?>
<configuration>
    <bookmarks>
         ....
        <bookmark name="Louisville, Kentucky">-9559973 4601704 -9529513 4621654</bookmark>
         ....
   </bookmarks>
</configuration>

and in Wikipedia (http://en.wikipedia.org/wiki/Louisville,_Kentucky), we could see

Coordinates: 38°15�?�15�?�N 85°45�?�37�?�W

My problem is:
how to convert the coordinates in Wikipedia to the extent information in the xml configuration file. we can see their difference: the latitude for louisville is 38°15�?�15�?�, I dont know how it is transfered to xmin 4601704,  xmax:4621654. We can have a min latitude and max latitude, but the number 38 is far from 46****.  I think this is relates with project, but i dont know how to convert it.

Thanks.

Yee





Yee,

   So the code to get the four values you have into an extent would simply be:

import com.esri.ags.geometry.Extent;
var ext:Extent = new Extent(your.xmin, your.ymin, your.xmax, your.ymax);


If your map is using ESRI base maps then you need to have the extent in webMercator in that case use this instead:

import com.esri.ags.geometry.WebMercatorExtent;
var ext:WebMercatorExtent = new WebMercatorExtent(your.xmin, your.ymin, your.xmax, your.ymax);
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Yee,

   The difference between those lat lon DMS numbers is the ones in the bookmark xml is one is geographic coordinates and the XML has WebMercator coordinates (Meters). So like I said in the previous post you can use WebMercatorExtent to handle that. If are really starting with coordinates like"38°15�?�15�?�N 85°45�?�37�?�W" then the first thing you have to do is some math to convert those to Decimal Degrees. Just Google it.
0 Kudos
yeeouyang
Deactivated User
hi Robert,

It works. Thanks very much. I didn't pay attention to what you said : if using the ESRI base map at first since I thought my map was focused on dynamic layers.

Thanks again.

Yee



Yee,

   The difference between those lat lon DMS numbers is the ones in the bookmark xml is one is geographic coordinates and the XML has WebMercator coordinates (Meters). So like I said in the previous post you can use WebMercatorExtent to handle that. If are really starting with coordinates like"38°15�?�15�?�N 85°45�?�37�?�W" then the first thing you have to do is some math to convert those to Decimal Degrees. Just Google it.
0 Kudos