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

Similar Messages

  • 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)

  • Get coordinates from mapviewer svg output (JavaScript)

    hello,
    i would like to read the coordinates of the mousepointer moving over the svg output of the MapViewer using java script in datas coordinate systems (not screen!).
    the svg is included by the object-tag of html (like an image).
    has somebody done something like this, i´m new to JavaScript an don´t want to reinvent the wheel.
    Maybe there is an easy way to solve this, but i don´t know.
    thanks

    Hi,
    We strongly recommend that you look into using Oracle Maps when developing mapviewer applications. It has an open and well documented JavaScript API, unlike the SVG support which is currently on the back burner.
    If you have to use SVG, there is a chapter in the MapViewer User's Guide that documents some of the javaScript functions you can use.
    thanks
    lj

  • 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • 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)

  • 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.

  • External Map Source Adapter - MapViewer

    <p>
    Hi
    I am developing an application using Oracle Maps of OracleMapViewer 10.1.3 using OC4J
    </p>
    <p>
    The objective of this exercise is to make use of a cache generated by a non-MapViewer solution. The cache is stored at an external location and can be accessed by sending multiple HTTP requests. For any given extent, multiple HTTP requests needs to be sent to access the individual tiles covering the given area.
    http://servername/mapname/cache?level=0&row=11&column=1
    http://servername/mapname/cache?level=0&row=11&column=2
    http://servername/mapname/cache?level=0&row=12column=1
    http://servername/mapname/cache?level=0&row=12&column=2
    The logic to identify the tiles is also available. The problem is that the getMapTileRequest(...) returns only one string and this when passed would return only one image tile. (Correct me if my understanding is wrong)
    public abstract class MapSourceAdapter
    <strong>public abstract String getMapTileRequest(TileDefinition tile);</strong>
    public byte[] getTileImageBytes(TileDefinition tile) ;
    public Properties getProperties() ;
    One option is to have a servlet at the other end that would accept the extent and zoom level and then identify the tiles. But still it is not clear as whether MapViewer will accept one response or multiple responses from the external server.
    Need some guidance in this aspect
    Regards
    Govindarajan
    </p>

    1. The mapviewer tile servlet can response to multiple tile requests simultaneously. It makes multiple calls to the getMapTileRequest method, each of which gets the URL for one tile. So if you can define the map tile layer(map cache instance) in such a way that its tiles have the same size as the external tiles, mapviewer should be able to handle the tile requests without problem. You also need to modify the XML tile layer(map cache instance) definition and add parameter "fetch_larger_tiles" to the root node and set its value to "false". Without this change, mapviewer will fetch map images that are several times larger than the actual tiles and cut them into tiles later on.
    2. With the latest patch, you can define a custom tile layer on the client side and fetch the tiles directly from the non-mapviewer tile server. Because this approach does not duplicate the tiles in mapviewer's tile cache, it is better than 1 if the non-mapviewer tile server can serve the tiles as fast as mapviewer. Demo #50 on the mapviewer tutorial page shows how to use custom tile layer.

  • Visualizing map data with mapviewer

    Hello. I have successfully deployed mapviewer using oc4j standalone. What I want to do now is to visualize maps based on data from tables I have in my database. I have successfully added a datasource using the admin tools on the http://localhost:8888/mapviewer/ site as I am getting the following response:
    <?xml version="1.0" ?>
    - <non_map_response>
    <add_data_source succeed="true" />
    </non_map_response>
    How can I visualize this data in a map format? Is mapviewer simply a middle tier application or is there some way I can view the data like in an applet?

    This also relates to your subsequent post on visualizing data with the Map Definition Tool.
    As Justin suggested, use the 9.0.4 preview version if you're getting started with MapViewer. And use the demo JSPs to do some basic visualization.
    Assuming your database version is 9.2.x.x do the following (if the database version is 8i or 9.0.1.x then you need to install some views. See section 1.4.2.3 in the doc for the steps and where to locate the sql scripts):
    1. Install the demo data (in mvdemo.dmp), and
    2. Use the demo JSPs mapinit.jsp or mapclient.jsp to view the demo data as a map.
    The doc (section 1.6) explains how to do this.
    Now for the map def tool.
    That is only for setting up symbology, styling rules, and specifying which themes make up a map. It does not render the maps.
    To simply view your spatial data without any fancy styling and symbology (e.g. to test that Mapviewer works and your data is valid) use the jview demo jsp.
    Hope this helps. If it does not, complain.

  • C7-00 - Maps coordinates

    Hello there!
    I'm a fan of geo caching and I've been using my E90 for finding the caches.
    During the winter I bought C7-00 and was hoping to continue this hobby with the new phone, but I can't input the coordinates with the latest versio of the Maps.
    Is there a way to do so in C7-00?
    Lumia 1020, N9, 808 PureView, Windows 7 Pro 64bit
    Vote NO to Nokia - MS -deal.
    Solved!
    Go to Solution.

    @Jayzteroid
    Have a look at this post for inputting on N8 a similar Symbian^3 device:/t5/Maps-Navigation-and-GPS/GPS-Time-and-coordinate-settings/m-p/966347/highlight/true#M32210
    Happy to have helped forum with a Support Ratio = 42.5

  • Geotiff's map coordinates

    Hi,
    I have a problem with obtaining geotiff map's coordinates. I would like to get coordinates for upper left and lower right corner. Tool called listgeo (ftp://ftp.remotesensing.org/geotiff/libgeotiff/listgeo_GUI.zip) returns good coordinates for my map, but when I try to get these coordinates using geotiffs java libs I get an error: "GeoKey directory does not exist" (using http://geotools.codehaus.org libs) or I get empty values for interesting geotags (using http://sourceforge.net/projects/geotiff-jai or http://sourceforge.net/projects/xtiff-jai).
    Can you tell me how can I retrieve this information using java libs? Google doesn't say anything interesting about this :(
    BTW: Map is in UTM zone 34 and compressed LZW.

    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

  • Can I create Maps without using Mapviewer?

    I want to just write my own Java Application pulling spatial data of type SDO_GEOMETRY from my database. Can I do this? Can anyone ponit me to some examples of straight Java code that does this or some documentation resources.
    Thanks!

    Have you tried the "The Oracle Spatial Java Library (which) enables applications written in Java to access and process geometry objects managed in Oracle Database with Oracle Spatial."
    available at http://www.oracle.com/technology/software/products/spatial/index.html

  • How to get the screenshot of mapview from apple maps server?

    Hi,
    Can we get the map view screenshot image from apple server?
    Acually i am getting the map view screenshot using mapquestapi. Below url is sample url for get the map view screenshot.
    http://open.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd%7Cluub256b2d%2Cax%3Do5 -9u829z&center=33.943359,-118.212891&zoom=13&size=380,184&type=map&imagetype=jpe g&pois=blue_1,33.943359,-118.212891
    We have to pass the center coordinates of mapview, zoom level, map type, image type and pin color. We will pass these parameters to url then server will return the image.
    Is it possible to get the mapview screenshot from apple map server. If possible please provide some sample urls. If not possible then tell me the reason.
    Thanks in advance.

    James Ward4 wrote:
    Press and hold the Power button, and press the Home button, release both simultaneously. You will hear a camera shutter sound. The image will be stored in the Photo app.
    https://discussions.apple.com/thread/4250596

  • 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

  • MapViewer base map image is not loading on OBIEE 11.1.1.6.4

    Hi Experts ,
    We are facing issue in OBIEE 11.1.1.6.4 and OBIEE 11.1.1.6.5. The background maps are not loading. The measure is getting plotted the as per postal code but the background map is not coming up.
    The Issue is only with External maps. It is working in Google maps.
    In Mapviewer > Management > Manage Map Tile Layers we can see GOOGLE_MAP as well as our required map tile layer.
    When we select GOOGLE_MAP and click on view map / manage tiles button we can see the background map.
    But the same doesnt happen for our background map.
    Our Operating System is Windows 2008 (We have tried in Linux as well).
    Thanks

    In case you have not found the reason for your problem. You mentioned that the problem is only with External maps, but also say that it works with Google maps (which is external). I'm assuming you had an internal map that was not working, right? First suggestion is to check MapViewer log for errors after you try to view the tile layer. You may have missing metadata, or broken definitions (base map or tile layer) pointing to data that do not exist.

  • How to call google map in mapviewer application?

    Hi
    i want to use google map as the base map in my mapviewer application, on which i can do all the analysis provided by mapviewer like geocoding tool etc. how can i do it? if anyone can help?

    On otn.oracle.com an article was posted a while ago on how to use Google Maps. Search there - this might help.
    cu
    Andreas

Maybe you are looking for

  • Can iPhone messaging be used for free when in Europe?

    Please advise if free iPhone messaging can be used in Europe.  It would be handy if we could communicate this way to set up meetings

  • Text Rendering issue in Safari 4 for Windows

    Note: I've failed to find a thread pertaining to this particular issue. If someone is aware of one, please excuse me and point this discussion in that direction. I am experiencing a problem with a Windows instal of Safari 4 that seems not to manifest

  • PO Line item deletion and change documents

    Hello All We have cases where when we delete certain lines of a Purchase order, a change document gets created while for certain other lines it doesn't. Has anyone expereienced this issue before ? Any solutions on how to resolve it please ?

  • Having trouble installing Itunes on ny pc w/windows 8

    I can't install Itunes on my new PC that has Windows 8. Message says, "error ocurred in the installation of assembly Policy 8.0 Microsoft VC 80 CRT.type.  Any help on what to do?

  • New Macbook Pro with old Macbook HD

    Is it possible to upgrade to a new macbook pro and use the old HD from my current macbook. I would like to get the performance upgrade without having to reload all my programs and other things. It will also make it easier to put the new HD from the n