Convert screen coordinate to map coordinate

Hi
I have a question if there is any method in MapViewer that convert screen
coordinates to map coordinates.
Fredrik

getUserPoint(int x, int y)
Gets the user space point corresponding to the mouse click.
getUserPoint in Java API converts from screen to user space ( lat/lon or whatever coordinate system you are using)

Similar Messages

  • XY pixel coordinate to map coordinate!

    Hi,
    I don't know if anyone is able to help me or direct me in the right path.
    My situation is as follows:
    I'm writing an web-app to generate a map (which I am successfully doing). I display the map (GIF) on the browser.
    Now, what I would like is to be able to click on a point on the map, take the X Y pixel coordinate and convert that to a mapping coordinate so I can requery the server and generate a new map.
    Now, in terms of mapping coordinates,
    how would one convert XY pixel to LAT LON?
    how would one convert XY pixel to Mercator?
    how would one convert XY pixel to GeoMinSec?
    hou would one convert XY pixel to GeoDecimal?
    Now, I don't mind if can get an answer to one of either of those questions, but my ideal answer would be on how to convert XY pixel to GeoDecimal because unfortunately the server I am using has all of its map coordinates in GeoDecimal.
    Any help would be appreciated.
    Steve.

    i think this is the solution.... but i might be missing something, i am assuming that your x,y location of your mouse increases positivly as you move your mouse right and down from the top left of your image. you may need to adjust accoringly. also, i have a feeling i am missing something to do with the dpi of your image... but i guess this may be a start...
    so you know your x,y in pixels. you know the extent of your map in real world co-ordinates.
    so lets say the width of your map is 1000m and the pixel width is 500pixels.
    so each pixel is 0.5 real world metres.
    multiply your x and y co-ordinates by 0.5, that is how many meters in from the top left of your extent your mouse is.
    more generally:
    so your extent is (x1,y1 is bottom left, x2,y2 is top right):
    x1,y1;x2,y,2
    your mouse co-ordinates are :
    x,y (pixels in from top left)
    your map is w1 pixels wide.
    dx = x2 - x1
    pixelsPerMetre = w1/dx
    world coordinates of x,y are:
    x1 + (x * pixelsPerMetre), y2 + (x * pixelsPerMetre)

  • Map coordinate to screen coordinate algorithm

    I am working on a simple 2d RPG, but I ran into a problem while working in NPCs.
    Currently the player is fixed at the center of a panel and the map scrolls below him. The panel the character and map are drawn on is only 1000 by 520 pixels and the map image can be any size (currently testing with a 3000x1565 BufferedImage)
    I tried drawing the NPC's sprite on to the BufferedImage, and quickly realized that wasn't going to work for any kind of smooth animation (you would have to redraw the BufferedImage off screen each time the NPCs AI thread told him to move, which means the BufferedImage may or may not be complete when the panel was repainted by the player's animation thread) . I need to determine weather NPCs are on the screen and then translate or transform their map coordinate to screen (or panel) coordinates.
    I did a search on the forum, but couldn't find a quick answer if someone could help me out I'd appreciate it.

    kevinaworkman wrote:
    I guess I'm still trying to make sense of how you're trying to draw the NPCs that could be causing so much trouble. Is there any way you could provide some pseudocode, or better yet, an SSCCE ?Well, its kind of complex and probably set up all wrong so let me just explain as best I can whats going on.
    First of all Like I said i am trying to make a 2d rpg, but I may want to make it an online multiplayer thing later if I even finish the game. So its a java applet and so far it has two GUI components. What I call the Map an extension of Panel that is in charge of drawing the world that the player moves around on. The other GUI component isn't really important right now its just the console for the game (a text field and a text area you can type in).
    The map class contains a bunch of other stuff the most important things are, an array of Characters for keeping track of NPCs, as well as possible other players, a PlayerCharacter, and most import is the zone. The zone is a Class I created for storing the map itself, and the constructor reads form a text file to create the map. The text contains stuff like the type of tile (grass, sand w/e) to fill the map with, size of the map, and points of interest like where to draw building, zone lines to other zones, and also where all the npcs start at or spawn at.
    the Map classes paint function looks like this:
    public void paint (Graphics g)
            //draw map
            g.drawImage(zone.getMapImage(), 0, 0, getWidth(), getHeight(),
                player.mapX - getWidth()/2, player.mapY - getHeight()/2 ,
                player.mapX + getWidth()/2, player.mapY + getHeight()/2 , this);
            //draw player
            g.drawImage(player.getAvatar(), player.x, player.y, this);
            //draw UI
            g.setColor(Color.darkGray);
            g.fillRect(0, 0, 150, 50);
            g.setColor(Color.blue);
            g.drawString("Player", 5, 5);
            if (player.getTarget() != null)
                g.setColor(Color.darkGray);
                g.fillRect(155, 0, 150, 50);
                g.setColor(Color.blue);
                g.drawString(player.getTarget().name, 160, 5);
            for (int i = 0; i < npcs.length; i++)
                if (npcs.isDraw())
    g.drawImage(npcs[i].getAvatar(), npcs[i].x, npcs[i].y, this);
    }//end paint()
    The Character class controls the animation for the sprites with these method  (now don't laugh, lol, this was my first attempt at making a full game and animating sprites so =P)public void move(String com)
    int zoneW = inZone.getWidth();
    int zoneH = inZone.getHeight();
    int avatW = avat[avatIndex].getWidth();
    int avatH = avat[avatIndex].getHeight();
    if ( com.equalsIgnoreCase("up") )
    mapY= mapY - 5;
    if (direction != 6)
    time = 0;
    direction = 6;
    if (mapY < 0)
    mapY = 0;
    else if ( com.equalsIgnoreCase("right") )
    mapX = mapX + 5;
    if (direction != 9)
    time = 0;
    direction = 9;
    if (mapX + avatW > zoneW)
    mapX = zoneW - avatW;
    else if ( com.equalsIgnoreCase("down") )
    mapY = mapY + 5;
    if (direction != 0)
    time = 0;
    direction = 0;
    //System.out.println("y: " + mapY);
    //System.out.println("y + avat height: "+ (mapY +avat[avatIndex].getHeight()));
    if (mapY + avatH > zoneH)
    mapY = zoneH - avatH;
    else if ( com.equalsIgnoreCase("left") )
    mapX = mapX - 5;
    if (direction != 3)
    time = 0;
    direction = 3;
    if (mapX < 0)
    mapX =0;
    startAnimate();
    * @see java.lang.Runnable#run()
    public void run() {
    // lower ThreadPriority
    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    while (/*true */isAnimate)
    if (time == 0)
    avatIndex = direction;
    else if ( time == 3 )
    avatIndex = direction + 1;
    else if (time == 6)
    avatIndex = direction;
    else if (time == 9)
    avatIndex = direction + 2;
    else if (time > 12)
    time = -1;
    time++;
    try
    // Stop thread for 10 milliseconds
    Thread.sleep(animationDelay);
    catch (InterruptedException e)
    e.printStackTrace();
    // set ThreadPriority to maximum value
    Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
    } //end isAnimate loop
    tFinished = true;
    }//end run()
    public void startAnimate()
    isAnimate = true;
    if (animate == null || tFinished)
    animate = new Thread(this);
    if (!animate.isAlive())
    tFinished = false;
    animate.start();
    else
    public void stopAnimate()
    isAnimate = false;
    avatIndex = direction;
    What you don't see is that "avatIndex" is used by the following method to return the correct sprite image for the animation.public Image getAvatar()
    return avat[avatIndex];
    //return sheet;
    Its not giving me too much trouble to draw the NPCs, when I had problems with drawing NPCs to the map image I just figured it would be best to drawing on the screen and not the map.  But I couldn't figure out how to translate the two coordinate systems.
    This post may confuse readers a lot lol,  so possibly just forget you asked.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Coordinate of map in identify?

    HI,,,,
    today in my application I use the coordinate of screen in method identify, would like to know if it is possible to use coordinate of map in the method of identify, zoomIn, zoomOut and pan?

    Hi Junior,
    the identify methods use values in screen coordinates. But with the AffineTransformation of the MapResponse class you may be able to handle the map coordinate on your application. You can convert it to screen before calling the identify, zoomIn, and other methods.
    This post may help:
    Re: MapViewer and getScreenCoordinate
    Joao

  • Map coordinates in MapViewer

    Hi,
    I have a Java application that submit requests to MapViewer. MapViewer4s response is a XML document, something like:
    <?xml version="1.0" encoding="UTF-8" ?>
    <map_response>
    <map_image>
    <map_content url="http://map.oracle.com/output/map029763.gif" />
    <box srsName="default">
    <coordinates>-122.260443,37.531621 -120.345,39.543</coordinates>
    </box>
    <WMTException version="1.0.0" error_code="SUCCESS"/>
    </map_image>
    </map_response>
    Thus, what I do is using a JLabel to show the image in the URL returned by MapViewer.
    All of this is working fine. Now I4m trying to make something more complicated.
    What I want to do is caught the user4s mouse click in the image and translate the point in which the user clicked (pixels) to a point in the map coordinates (longitude, latitude).
    How can I do this ? What API may I use ?
    Thanks,
         Rodrigo

    The <BOX> element in the XML map response gives you the bounding box of the returned map image, in user's coordinate space.
    Now you can get the mouse click's x,y in terms of pixels, and you also know the map image's width/height in terms of pixels. It should be easy to translate the click's position into user space.
    lj

  • Screen color at specified coordinates

    I need to identify screen color at specified coordinates on the screen.  Can you suggest a method?

    That works, but I have a more complicated issue -- I was remiss in not explaining in greater detail:
    Portions of the screen are changing dynamically, and I need to poll a certain location and find if it becomes a specific RGB value. 
    Applescript doesn't seem to have an approach, but Terminal might?

  • How we can view convert data after XSLT mapping & before Graphical mapp

    Hello Friends,
    Currently i am working on XI standard content. In this client need some customization.
    In interface mapping, XSLT mapping on 1st position & Graphical mapping on 2nd position.
    As per my understanding 1st XSLT mapping will be exected then Graphical mapping.
    Can I see or check convert data from XSLT mapping.
    I want to check data between XSLT mapping & Graphical mapping.
    Kindly help me out.
    Regards,
    Narendra

    >
    Narendra GSTIT wrote:
    > I dont want to test standalone XSL Code.
    >
    > The data which I get from Source interface and after XSLT mapping I want to check this that my XSLT code is going well or not.
    >
    > i.e. check for proper input & get proper output.
    You have ro do standalone testing of the XSLT mapping.....Interface Mapping or Interface Determination will give you output message which will be that of message mapping (the last mapping)
    What is the issue in testing the XSLT mapping alone?...may be in Stylus Studio.
    Just ensure that XSLT mapping produces proper output and then this output message of XSLT is the input to your Message Mapping.....once the entire Interface mapping gets executed then it would mean that all the included mapping programs work fine.
    Regards,
    Abhishek.

  • When i turn in my computer it only come a white screen whit a map and a questionmark?

    When i turn in my computer it only come a white screen whit a map and a questionmark?

    That folder with the question mark icon means that the MacBook can't find the boot directory. That can either mean it can't find the hard drive or the Operating System data on the hard drive is somehow corrupted.
    Put your install DVD into the optical drive and reboot. As soon as you hear the boot chime, hold down the "c" key on your keyboard (or the Option key until the Install Disk shows up). That will force your MacBook to boot from the install DVD in the optical drive.
    When it does start up, you'll see a panel asking you to choose your language. Just press the Return key on your keyboard once. It will then present you with an Installation window. Completely ignore this window and click on Utilities in the top menu and scroll down to Disk Utility and click it. When it comes up is your Hard Drive in the list on the left?
    If it is then click on the Mac OS partition of your hard drive in the left hand list. Then select the First Aid Tab and run Repair Disk. The Repair Disk button won't be available until you've clicked on the Mac OS partition on your hard drive. If that repairs any problems run it again until the green OK appears and then run Repair Permissions.
    If your hard drive isn’t recognized in Disk Utility then your hard drive is probably dead.

  • How does Jheadstart can convert screen layout to ADF

    Hello,
    We have a Form 6i system. But now we need to convert system to ADF.
    I known has a tool called Jheadstart (develop by Oracle) can convert Form to Adf. But on demo video I see Form screen is very simple.
    I don't know license version can convert Form to ADF with very complexity Form as my system.
    Everyone who has Jheadstart license version could help me to convert screen layout of my form(Canvas PAGE_1) below  then send me back([email protected]) the adf result to see ability Jheadstart can do with screen layout before we decided to by full version.
    https://drive.google.com/file/d/0B5ztH6AIf8p2MTBYdHdTbTRlbjQ/edit?usp=sharing
    Thank you so much for help.
    Paulo Golier.

    Hi Paulo,
      I haven't used the Forms2ADF generator myself, but according to the JHeadstart Dev guide you need to upgrade your FMB file to Forms 9i first, the generator doesn't work with a 6i file.

  • Is it possible to locate a point using Latitude and Longitude or UMT coordinates in MAP?

    Is it possible to locate a point in Maps using lattitude and longitude or UMT coordinates on my iPhone?    

    Here's one:
    https://itunes.apple.com/us/app/utm-convert/id402708997?mt=8
    I don't use them, so can't recommend one over the other.

  • Delay/block the loading of the screen before geting location coordinates

    Hi,
    In My application, the user is directly taken to the map view page where the app displays a map (home screen), but I need the location co ordinates before loading the first screen. How can we block / delay the loading of the screen until the locationmanager fetches the location co ordinates(lat and lng).
    I invoked the CLLocationManager in applicationDidFinishLaunching and call a getcoordinates custom method (whic is supposed to return the coordinates) in a loop giving some delay
    [NSThread sleepForTimeInterval:2];
    between each calls. but the method retuns only 0.0000 and didUpdateToLocation method also worked only aftr the loop so I cannot get the lat/longs.
    pls suggest a solution to solve this
    pls reply
    thnks in avdance

    try using applicationWillFinishLaunching isntead of applicationDidFinishLaunching and see if that yields any results
    - (void)applicationWillFinishLaunching:(NSNotification *)aNotification

  • How do I use map coordinates in Apple Maps to set up my GPS?

    I'm trying to use an address in Apple maps that is a rural route.The rural route is not precice enough to help me set up a route in the GPS.  I have the lattitude and longitude coordinates.  How do I use the coordinates in Apple Maps to set up my GPS?
    I tried dropping a pin on the location I want to go to but Apple maps still directs me to a location about 30 miles away.

    I tried dropping a pin on the location I want to go to but Apple maps still directs me to a location about 30 miles away.
    That "should" work.  Drop the pin exactly where you want it, tap the arrow on the right and the select Directions to/from here.

  • Screen Resolution & Mouse Cursor Coordinate

    Hi,
    I would like to ask how to do the following with a java program:
    1. get the screen's resolution
    2. get the coordinate of the mouse cursor on the screen
    Thanks you very much.

    If you can use Java 1.5, the classjava.awt.MouseInfo might be what you need
    Thanks, it really works!
    Glad I could help.
    However, now i find that the method
    getScreenResolution() in class Toolkit is an abstract
    method. I would like to know how to implement this?
    You don't need to. There is a concrete implementation tailor-made for your particular platform ready waiting for you. You get it by calling the static method getDefaultToolkit:
    Toolkit tk = Toolkit.getDefaultToolkit();
    int dotsPerInch = tk.getScreenResolution();

  • Coordinate system translation from screen coordinates to stage coordinates

    I realize this is not truly a LabVIEW question, but I'm hoping for suggestions.
    I have a digitized image of a sample on a 3 axis stage. The user selects "paths" for a drill to take along the surface of the sample. On the image, 3 reference points are identified. The stage posititions (x, y, and z) corresponding to these points are then identified.
    I need to now convert the coordinates of the paths to the stage coordinate system. Are there any LabVIEW vi's that are suited to this need? I have IMAQ vi's but not very experience with these yet. Suggestions much appreciated
    Tim

    Hello Shan:
    Were almost have the same problem but mine is for a AOI handler with a robot arm which I need to pick (x,y) pairs along the work envelope. Anyway, for the most math part it will involve are coordinate transformation from a "mouse coordinates" to "real world coordinates" and your image processing textbook (I use McGrawHill Computer Graphics by Hill) will outline both the code and the math but LabVIEW will not have a facility to do with an actual VI instead you have to use the array manipulations and treat them coordinates as matrix elements. There is a Math VI and G-Math VI or a MatLAB call you can use for coordinate matrix manipulations as long as you have the math quite figured out in paper already.
    Bernardino Jerez Buenaobra
    Senior Test and Systems Development Engineer
    Test and Systems Development Group
    Integrated Microelectronics Inc.- Philippines
    Telephone:+632772-4941-43
    Fax/Data: +632772-4944
    URL: http://www.imiphil.com/our_location.html
    email: [email protected]

  • Is there an easy way to get GPS coordinates from Maps.app in Mavericks?

    My DSLR doesn't have a GPS built in, but I like to Geo-tag some of my photos. I usually just take a pic with my iPhone and then copy the geo data (GPS coordinates) and paste into the photos (in Adobe Lightroom). Unfortunately, I didn't have my phone with me. I have the location stored as a bookmark in Maps, but I don't see any easy way to just pull coordinates.

    Hi,
    I am doing the same thing too. I have to call my reports thru menu. I tried web.show_document in my menu and it works. I also added paramform=yes and it gives the report parameters, but I want to give the user the choice of format for the reports. eg. pdf, html, excel, etc. instead of hardcoding it.
    Could you please give me some idea on how can I do that??
    Thanks.

Maybe you are looking for

  • How to Install em12c (12.1.0.3) on windows 64 bit

    Hi Guys, I am trying to install 12 c 12.1.0.3 on windows 2008 R2 server. The server has met the all prerequisites. But when I am trying to launch the installer it will disappear immediately without any error message. I check the installation log file

  • My auto updates are not working. I cannot find where to download Camera Raw 8.1 for Photoshop CS6.

    My auto updates are not working! I cannot find where to download Camera Raw 8.1 for Photoshop CS6 (Windows 8 64 bit). My Camera Raw is now at 7.1. I had the online Adobe folks tell me to just download all updates manually. That's great, yet I cannot

  • Is there a limit to the number of points in a polygon?

    Please excuse the entry-level question (and possible use of words like 'point' in a non-technically-precise way) but we've lost out Spatial expert! Anyway, we get problems occassionally with complex polygons and it seems that there's a limit fo the n

  • Issues after upgrading to 6.0

    Hi experts, After upgrading to 6.0 seems system overall is slow. Netflix app asks me for password everytime I open. Youtube buffering issues. I hope with software upgrade these issues might get resolved. But I could not able to install updates. I tri

  • Pl/sql logging!!

    hello, In order to log the pl/sql user messages we are trying to use log4plsql. Now, the problem is where to keep that log - In log table within the database - in File (here we are facing problem, related to some junk (hexa) characters in log file wh