How to get city coordinates?

Hi,
Is there any way to get city coordinates, such as latitude and longitude based on user's input?
I have TextBox element and when user enters, for example, New York app should get latitude and longitude for that city.

Hi Matthew_42,
>>Is there any way to get city coordinates, such as latitude and longitude based on user's input
Yes, it is possible. We can use the
GeocodeQuery Class to help us.
For more information, please try to refer to my example:
In the MainPage.xaml:
<Button Content="GetCoordinate" Click="Button_Click" Margin="252,32,0,503"></Button>
<TextBox Name="MyTextBox" HorizontalAlignment="Left" Height="72" Margin="0,32,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="267"/>
<TextBlock Name="MyTextBlock" Foreground="Red" FontSize="25" HorizontalAlignment="Left" Margin="10,179,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="80" Width="436"/>
<TextBlock Name="MyTextBlock1" Foreground="Red" FontSize="25" HorizontalAlignment="Left" Margin="10,221,0,-9" TextWrapping="Wrap" VerticalAlignment="Top" Height="80" Width="436"/>
In the MainPage.xaml.cs:
private async void Button_Click(object sender, RoutedEventArgs e)
// Get my position
var MyPosition = await new Geolocator().GetGeopositionAsync();
double MyPositionLatitude = MyPosition.Coordinate.Latitude;
double MyPositionLongitude = MyPosition.Coordinate.Longitude;
//Get the search city's Coordinate
var MyGeocodeQuery = new GeocodeQuery();
MyGeocodeQuery.SearchTerm = MyTextBox.Text;
MyGeocodeQuery.GeoCoordinate = new GeoCoordinate(MyPositionLatitude,MyPositionLongitude);
MyGeocodeQuery.QueryCompleted += MyGeocodeQuery_QueryCompleted;
MyGeocodeQuery.QueryAsync();
public void MyGeocodeQuery_QueryCompleted(object sender, QueryCompletedEventArgs<IList<MapLocation>> e)
if(e.Result.Count>0)
int count = e.Result.Count;
double Latitude= e.Result[0].GeoCoordinate.Latitude;
double Longitude = e.Result[0].GeoCoordinate.Longitude;
MyTextBlock.Text = MyTextBox.Text + "_Latitude=" + Latitude.ToString();
MyTextBlock1.Text = MyTextBox.Text + "_Longitude=" + Longitude.ToString();
The result:
Best Regards,
Amy Peng
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Thank you for your help.
This solution is working perfectly.
Best regards.

Similar Messages

  • How to get the coordinate of a cell in the jtable?

    How to get the coordinate of a cell in the jtable?
    How to get the point of a cell in the jtable?
    Thanks for help!

    getCellRect(...);

  • How to get Panel coordinates

    Hi All,
                i have a panel in canvas layout.
               if want to add one more panel immediate  next to the first panel i need to know  x, y coordinate of the first panel.
                How can i know i the coordinates.
    Can any help me?
    thanks
    Raghu

    You can get the coordinates by:
    panelOne.x and panelOne.y
    panelOne is the id of your panel. e.g. <mx:Panel id="panelOne" ...>...</Panel>
    To add a new panel right next to it you have to set the x and y for the new panel like this:
    newPanel.x=panelOne.x+panelOne.width;
    newPanel.y=panelOne.y+panelOne.height;
    Hope this helps.

  • How to get correct coordinate & size of components in scaled swf

    I use canvas (I set it to fit whole screen size) to enclose a swfloader which loads a swf with width & height set to 100%. This swf has a movieclip. How can I get the correct coordinates of its position and its size after scaled in Flex?
    In the Flash CS4, the movielip has x=40, y=700. In Flex, the swf is scaled 100% but when I get the x value of this movieclip, it's still 40. I try to get the scale ratio of x-axis by refering to swf's scaleX. But its 1, weird enough.
    How can I get correct coordinates of movieclip?

    I do try the localToGlobal but it seems its 1:1 ratio, the codes I use:
    // swf is loaded by swfloader, there's a movieclip child named 'child_mc' in it, I want to locate its postion and size. It's top-left coordinates in flash cs4 is 4,740
    var swf_obj:MovieClip = MovieClip(swf.content);
    var mymc:MovieClip = swf_obj.child_mc;
    child_before:Point = new Point(mymc.x, mymc.y);
    child_after:Point = swf.localToGlobal(child_before);
    Alert.show(
         "before:"+child_before.x+","+child_before."y"+"\n"
         + "after:"+child_after.x+","+child_after."y"+"\n"
    the dump result is:
    before:4,740
    after:4,740
    dump screenshot is here: http://img198.imageshack.us/img198/2396/image2ew.png
    I use values of child_after to draw green box. The white box is child_mc's actual position after scaled to fit canvas size (in turn the screen size). You can see they are far from each other. Why?
    Do you mean I have to multiply the transform matrix myself to get the correct position?

  • How to get Absolute Coordinates of a Field.

    I know that the properties "x" and "y" of any field of PDF Form will give me the coordinates relative to the parent object.
    How to get the absolute coordinates of any object (or any field) on a PDF Form?
    My objective is to make a Subform Visible or Hidden and reposition it close to any other field in order to display some extra text to show more info about the required field.
    How I can do that?
    Tarek.

    Hi,
    I wrote a recursive function that will go up in the forms hierarchy and summarizes the x and y coordinates of the parent objects.
    var vX = 0
    var vY = 0;
    function findCoordinates(vNode) {
        if (vNode !== null) {
            if (vNode.className === "field" || vNode.className === "subform") {
                console.println(vNode.name + " > " + vNode.x);
                var xUnit = vNode.x.match(/(mm|cm|pt|in)/g);
                var xValue = parseFloat(vNode.x.replace(xUnit, ""));
                if (xUnit === "mm") {
                    vX += xValue / parseFloat("25.4");
                } else if (xUnit === "cm") {
                    vX += xValue / parseFloat("2.54");
                } else if (xUnit === "pt") {
                    vX += xValue / 72;
                } else {
                    vX += xValue;
                var yUnit = vNode.y.match(/(mm|cm|pt|in)/g);
                var yValue = parseFloat(vNode.y.replace(yUnit, ""));
                if (yUnit === "mm") {
                    vY += yValue / parseFloat("25.4");
                } else if (yUnit === "cm") {
                    vY += yValue / parseFloat("2.54");
                } else if (yUnit === "pt") {
                    vY += yValue / 72;
                } else {
                    vY += yValue;
            findCoordinates(vNode.parent);
        var vCoordinates = (Math.round(vX * 2) / 2) + "mm " + (Math.round(vY * 2) / 2) + "mm";
        return vCoordinates;
    Textfeld2.rawValue = findCoordinates(xfa.resolveNode("Teilformular1.Teilformular2.Textfeld1"));

  • SDO_ORDINATES how to get the coordinates?

    Hello,
    how can i get the individual x1,y1 and z1 coordinates of a box? when i use in an sql statement sdo_ordinates i just get an object sdo_ordinate_array. But how can i filter out the coordinates? To explain what i want to do here a pseudocode sql-statement:
    select min(v.shape.sdo_ordinates.x1),min(v.shape.sdo_ordinates.y1),min(v.shape.sdo_ordinates.z1),max(v.shape.sdo_ordinates.x1),max(v.shape.sdo_ordinates.y1),max(v.shape.sdo_ordinates.z1) from veith.voxel v
    Is there a way to get an sql-statement that gives me the min and max x1,y1 and z1 from a table and also a statement where i get the x1,y1 and z1 value from all tableentries? For any help thanks in advance.
    Greetings,
    Markus Veith

    Markus,
    If you are using 9i there are two functions: sdo_geom.max_mbr_ordinate and sdo_geom.min_mbr_ordinate which will return either the min or max ordinate values in a layer.
    If you are using 8i, you will have to write a sql block or procedure to compare the x ordinates or y ordinates and retrieve the min or max values.
    Hope that helps.
    Dave
    David R. Miller
    Michael Baker Jr., Inc.
    3601 Eisenhower Avenue
    Alexanria, VA 22304
    [email protected]
    www.mbakercorp.com

  • How to get 3D coordinates of reflective markers using two cameras?

    Hi,
    I am very new to LabVIEW (in fact to any coding at all) and helping my adviser to get the 3D coordinates of a few reflective markers using two cameras. I am able to read the marker coordinates (x, y) from two cameras simultaneously by processing the data in real-time using codes generated from vision assistant. However, we want to get the depth position by triangulating the markers. I have seen stereo vision doing something similar to this, but I think the stereo vision may not work with our calibration frame (markers) and we don’t need the whole depth image, but only the maker’s z coordinates. I also want to use Region of Interest to mask out other regions that are creating reflections. However, I am not sure if triangulation would work if we select region of interest (as the origin of the camera coordinates would change after selecting ROI). I saw this link http://kwon3d.com/theory/dlt/dlt.html#3d where they used DLT (direct linear transformation) method, but it is too much to code from the beginning. Is there a subVI in LabVIEW or some sort of prewritten code that can be customized? Can anyone please give me some advice on how to solve this problem?

    Well in theory, if you know exactly where the cameras are pointed, how far apart they are, and how far the reflector images are above or below the horizon and to the right or left of center line, a little simple math should give you the answer. Concerning the ROI I would think all you needed to know was where the ROI was relative to horizon and centerline. You could then calculate an absolute position from there, which would also give you the angles you would need.
    Unfortunately, I don't know of any readily availble code. But I'm sure there is some! With the emphasis on FIRST robotics, I got to believe that judging distances in 3D space is something for which there is a lot of code.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How to get Image Coordinates in a Frame

    Hi,
    I want to retrieve Image Coordinates contained in a Frame.
    I am able to get the frame coordinates through IGeometry but not the images.
    Any help will be highly appreciated.
    Regards,
    Rahul Rastogi

    Hi
    SnpGraphicHelper in SDK provides code for getting IImageDataAccess for given Frame ref. Use GetUID to get uid of the image from IImageDataAccess, obtained above.
    Once you get UID, you should be able to get its geometry.
    Rajani

  • How to get the coordinate of any character in just a single text frame?

    I am using Illustrator CS5. Better solutions in c# language.

    Hi,
    According to your description, my understanding is that you want to get the groups name of a specific user using Client Object Model PowerShell in SharePoint 2010.
    We can loop the site group collection and the users in each group and then check if the user exists in the user collection.
    ClientContext clientContext = new ClientContext("http://sp/sites/mysite");
    GroupCollection collGroup = clientContext.Web.SiteGroups;
    clientContext.Load(collGroup);
    clientContext.ExecuteQuery();
    User usr = clientContext.Web.EnsureUser(@"contoso\administrator");
    clientContext.Load(usr);
    clientContext.ExecuteQuery();
    foreach (Group group in collGroup)
    UserCollection collUser = group.Users;
    clientContext.Load(collUser);
    clientContext.ExecuteQuery();
    foreach (User user in collUser)
    if (user.LoginName==usr.LoginName)
    Console.WriteLine(group.Title);
    Console.ReadKey();
    For PoweShell command, you can convert the code above to PowerShell Command.
    Here is a detailed article for your reference:
    https://msdn.microsoft.com/en-us/library/ee538244%28v=office.14%29.aspx?f=255&MSPPError=-2147217396
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • How to get informations (coordinates, font...) of InDesign or Acrobat Objects?

    Hi guys,
    i would like to export informations like x and y coordinates, fonts and size into an xml file or something. I'm working with Windows on CS6.
    Do you know a script or tool?
    Btw, sorry for my english

    I would export it as IDML and extract the information from the generated xml files. It's the easiest I think.

  • How to get coordinates of FileSystemTree selected item ?

    Hi can some one clue me in how to get the coordinates of the
    selected itwn in a FileSystemsTree ?
    thx
    -g

    Hi Amy,
    I looked at the code, this is the width calculation.
    There are four (4) parts to each of the tree node display:
    1) the indent, from _listData.indent Only value id _data is
    not null
    2) the disclosureIcon.width
    3) icon.measuredWidth
    4) label measured or explicate width
    The positions are calculated by:
    1a) disclosureIcon.x = the indent
    1b) disclosureIcon.setActualSize = disclosureIcon.width,
    disclosureIcon.height
    2a) icon.x = the indent + disclosureIcon.width
    2b) icon.setActualSize = icon.width, icon.height
    3a) lable.x = the indent + disclosureIcon.width + icon.width
    3b) lable.setActualSize = lable.width, lable.height
    The label width:
    label.width: the size of the visible portion of the label in
    the parent. It may be clipped/truncated.
    label.textWidth: the total size of the text in the label
    Maybe I can get the code finished today.
    BTW, as I'm moving through this processes of learning flex,
    the one thing I've noticed is the lack of a concise MVC model or at
    least a breakout of the more complex UI components. I'd assume for
    such a strategic product, there would be more investment by Adobe
    in these technical areas. But, I guess its easier putting people on
    a bus and send them to city to city.
    -g

  • About get mouse coordinates on screen?

    how to get mouse coordinates in java, i don't look for a appropriate method.

    The MouseEvent which is given to the MouseMotionListener or the MouseListener has one getX() and one getY() method. That are the coordinates in your applicetion window starting with (0,0) in the upper left corner.
    Hope this helps
    Markus

  • How to extract word coordinates from PDF using vc++6.0

    In sdk,i just know how to get coordinate from pdf using javascript,and it will be completed use vb.but i dont know how to get the coordinate througt vc++6.0.anyone can help me?
    thank you advance!

    PDEWordFinder is the usual method for getting words and co-ordinates.
    PDFEdit is not usually used, it is not suitable for getting text.
    It is very hard work to make the two worlds work together (e.g. to
    edit text you find).
    Aandi Inston

  • PhotoShop Automation PlugIn: How do I get the coordinates of a polygonal selection?

    Hi.
    I try to get the coordinates out of a selection, but I can't find out how to do that.
    I tried to convert the selection into a path and get the coordinates from the path. That doesn't work either.
    Can somebody give me a list of parameters inside the action descriptor of keyPathContent in classPath? I assume that the point infos are located there...
    Thanx in advance,
    Christian

    found the answer myself. It might be helpfull to others.
    btn.addMouseListener(new MouseAdapter(){
    public void mouseClicked(MouseEvent e) {
    Rectangle ret = btn.getBounds();
    double y = ret.y + ret.getHeight();
    pop.show((Component) e.getSource(), ret.x, (int)y);
    }

  • In Flex2, How to get coordinates in a view port?

    I know one can use something like
    fooUIControl.localToGlobal(new Point(x,y))
    to get the coordinates corresponding to the origin at the top
    left of the main flex app 'document'.
    In case that the main flex app scrolls, how can I get the
    coordinates corresponding to the origin at the top left of the
    visible screen (or the 'viewport')? Or in other words, how can I
    find out how many pixels are scrolled in X and Y? Thanks.

    The horizontalScrollPosition and verticalScrollPosition
    properties of a scrolling container tell you how many pixels it has
    scrolled.

Maybe you are looking for

  • Best way to do this: repartition existing imac internal drive and restore

    Hi all, I am trying to solve this problem: flaky bootcamp/reinstall of XP/reinstall of OSX yet keep existing apps working in the process. Experience level: 4 years on a mac, decades PC sys admin. History: http://discussions.apple.com/thread.jspa?thre

  • Need to read all entris  for field prtxt from table /sapsll/prt

    hi i need to read all entries from table /sapsll/prt field prtxt but only one is coming pls see below seelct statement if not gt_sagmeld[] is initial.             SELECT /sapsll/cuit~guid_cuit         " PK                    /sapsll/cuit~QUANT_FLT   

  • Service master no ranges

    Hi guys, We have not yet gone live.  When we check the no ranges for "SERV" group of service master, current no status is 3000110 in production. Can we change this to 3000000? is there any problem by changing this number? please suggest me

  • Socket communication error in OBIEE 10g.

    Hi I have below error in nqserver log by which i am unable to connect admin tool and presentation service. I am using OBIEE 10g. [nQSError: 12002] Socket communication error at call=recv: (Number=10004) A blocking operation was interrupted by a call

  • Trying to Uninstall Codec-M: the Mac variant of Codec-C

    I'm running Firefox 10.0.2 on a Mac running OS X 10.6.8. Last week I made a bad mistake, and allowed "Codec-M" to load on my computer. This appears to be the Mac version of Codec-C. It installed into Firefox as an Add-On. It's visible in the Firefox>