MapViewer API

Hi all,
I am building an application on top of MapViewer, where session information is not maintained on my application side. I am using MapViewer (bean) API for accessing MapViewer services.
For every user request I create a new instance of MapViewer bean and destroy it after completion of request.
Is it a right approach or does it have some side effects on performance.
Thanks,
Vinod

Hi Vinod,
you are paying the price of allocating memory again for the MapViewer class, and also losing some important information that the MapViewer class keeps. For example, after rendering the map, MapViewer stores some map response information, which is used for zoom and pan methods. MapViewer also keeps the dynamic styles that you create, which can be used in future requests. Also the current themes added to MapViewer are kept for future requests, unless you remove them. Therefore, my suggestion is that you keep the MapViewer class alive on your application.
Joao

Similar Messages

  • Templated predefined theme and JavaBean MapViewer API

    Hello,
    i have problems using a templated predefined theme and the JavaBean Mapviewer API.
    I defined a theme with a styling rule:
    <?xml version="1.0" standalone="yes"?>
    <styling_rules>
      <rule>
        <features style="MYSTYLE">id in ( select column_value from table(:1))</features>
      </rule>
    </styling_rules>When i use the javascript api i can provide the parameter to my Foi using a MVArrayParameter :
    var myparams = "\"aaa\",\"bbb\"";
    var myArrayPar = new MVArrayParameter(myparams,'sarray','id_list');
    myFoi.setQueryParameters(myArrayPar);id_list is a table of varchar2(64).
    This works fine in OracleMaps, but i have troubles to get this working with the JavaBean API.
    String[] sArr = new String[2];
    sArr[0] = "aaa";
    sArr[1] = "bbb";
    mv.addPredefinedTheme(themeName);
    mv.setPredefinedThemeParameters(themeName,sArr);
    ...This results in a theme node with two parameter nodes in the xml map_request:
    <theme name="MYTHEME">
      <binding_parameters>
        <parameter value="aaa" type="String"/>
        <parameter value="bbb" type="String"/>
      </binding_parameters>
    </theme>
    ...But the output does not include the theme. Instead i get this error message:
    2007-12-20 09:14:36.081 ERROR *** Exception while querying theme: MYTHEME
    2007-12-20 09:14:36.081 ERROR Exception fetching data for theme MYTHEME.How can i solve this problem?
    Thanks for help in advance,
    Dirk

    Hi Dirk,
    your type in this case is 'id_list' and the XML should be something like:
    <theme name="MYTHEME">
      <binding_parameters>
        <parameter value="aaa,bbb" type="id_list"/>
      </binding_parameters>
    </theme>
    ...However, if you are using version 10.1.3.1 (sending a direct XML request or using the API) it does not support this binding_parameter with a custom type. With version 11 preview that we posted recently, you should be able to send a direct xml request using the example above, but it seems that using the API, you will not be able to get the correct XML. We will check that.
    Joao

  • How to use MapViewer API?

    Hi,
    I have a problem that is acturally regarded to java programming. I want to use MapViewer JavaBean-Based API. I did the preparing work described in Mapviewer doc §4.2.
    I saved the demo jsp page "mapclient.jsp" in my own application folder (under oc4j\j2ee\home\default-web-app). The other jsp pages written by myself can be displayed. But this mapclient.jsp can not be retrieved. "HTTP 500 internal server error The page cannot be displayed." It seems that I don't have J2EE container that contains the MapViewer service.
    I also changed the codes of mapclient.jsp. I use
    import oracle.spatial.mapclient.MapViewer;
    MapViewer mv = new MapViewer("http://localhost ...");
    It does not work, either. "The page cannot be displayed."
    I don't know how to invoke the MapViewer service. I use oc4j standalone. I don't know how to get the error message, either.
    I hope somebody can give me some suggestions. Thanks in advance.

    Hi,
    about the addDataSource using the Java API, for now you have to disable the security
    in order to add the data source using the MapViewer client API.
    You can do that editing the MapViewer config file:
    <mv_security enforce_sec_role="false" />
    Assuming that you have added your data source, and you have rendered some map,
    you can get the attribute information using the "identify" methods of the
    MapViewer client API.
    1) To identify one individual geometry:
    String [][] result = mapviewer.identify(dataSource,table_name,columns,
    geometry_column,srid, x, y);
    where: "columns" contains the table attribute names that
    you want to retrieve
         x,y represents the device coordinate.
    2) To identify geometries inside a rectangle:
    String [][]result = mapviewer.identify(dataSource,table_name,columns,
    geometry_column,srid, xlowleft,ylowleft,
    xupright,yupright,false);
    where the rectangle coordinates are defined by xlowleft,ylowleft,
    xuprigth, and yuprigth values in device unit.
    3) The resulted String array contains on the first row the attribute
    names, and on the remaining rows the attribute values for each geometry.
    int nlin = result.length; // return the number of lines
    int col = result[0].length; // number of columns
    To get the attribute names:
    // attribute names
    Object []tableattrs = new Object[ncol];
    for(int j=0;j<ncol;j++)
    tableattrs[j] = result[0][j];
    To get the attribute values:
    Object [][]tablevalues = new Object[nlin-1][];
    for(int lin=1;lin<nlin;lin++)
    tablevalues[lin-1] = new Object[ncol];
    for(int col=0;col<ncol;col++)
    tablevalues[lin-1][col] = result[lin][col];
    Regards.

  • MapViewer API: addMapCacheTheme creates unexpected XML request string

    Hi,
    I try to get a map with map cache theme on it. But MapViewer class generates an xml request string in which an unexpected wfs theme
    exists. So I'm unable to add a map cache theme since the wfs theme causes a problem and i only get an image painted with background
    color...
    my java code is as follows:
                   String viewerUrl = "http://localhost:8888/mapviewer/omserver";
                   String dataSource = "ADATASOURCE";
                   String mapCache= "AMAPCACHE";
                   MapViewer viewer = new MapViewer(viewerUrl);
                   viewer.setDataSourceName(dataSource);
                   viewer.setImageFormat(MapViewer.FORMAT_PNG_URL);
                   viewer.setMapRequestSRID(8307);
                   viewer.setAntiAliasing(false);
                   viewer.setMapTitle(null);
                   viewer.setBackgroundColor(new Color(0xA6CAF0));
                   viewer.setBackgroundImageURL(null);
                   viewer.setDeviceSize(new Dimension(480, 480));
                   //viewer.setBaseMapName(baseMap);
                   viewer.addMapCacheTheme(mapCache, dataSource, mapCache, true);
                   viewer.setCenter(29, 41);
                   viewer.setSize(1);
                   //For debugging issues
                   String req = viewer.getMapRequestString();
                   viewer.run();
    value for req variable is:
    <?xml version="1.0" standalone="yes"?>
    <map_request
    datasource="ADATASOURCE"
    srid="8307"
    width="480"
    height="480"
    bgcolor="#a6caf0"
    antialiase="false"
    format="PNG_URL"
    >
    <center size="1.0">
    <geoFeature>
    <geometricProperty typeName="center">
    <Point>
    <coordinates>29.0,41.0</coordinates>
    </Point>
    </geometricProperty>
    </geoFeature>
    </center>
    <themes>
    <theme name="AMAPCACHE" datasource="ADATASOURCE">
    <map_cache_theme map_cache_name="AMAPCACHE" snap_to_cache_scale="true"/> </theme> <theme name="AMAPCACHE" >
    <wfs_feature_request
    datasource="ADATASOURCE"
    />
    </theme>
    </themes>
    </map_request>
    The first theme is the one that i wanted to add.
    The second one (bold) is the one that causes trouble. I don't know where it comes from.
    This problem occured when i started to use mvclient.jar that came with patch 6453515 which changed MapViewer version from
    Ver10131_B06102 to Ver11_B07100.
    The old mvclient.jar (came with MapViewer Ver10131_B06102) produces the following xml request string:
    <?xml version="1.0" standalone="yes"?>
    <map_request
    datasource="ADATASOURCE"
    srid="8307"
    width="480"
    height="480"
    bgcolor="#a6caf0"
    antialiase="false"
    format="PNG_URL"
    >
    <center size="1.0">
    <geoFeature>
    <geometricProperty typeName="center">
    <Point>
    <coordinates>29.0,41.0</coordinates>
    </Point>
    </geometricProperty>
    </geoFeature>
    </center>
    <themes>
    <theme name="AMAPCACHE" datasource="ADATASOURCE">
    <map_cache_theme map_cache_name="AMAPCACHE" snap_to_cache_scale="true"/> </theme> </themes>
    </map_request>
    What might cause this problem?
    OS: Windows XP Pro SP2
    IDE: JDeveloper 10.1.3.1.0
    Thanks in advance,
    Cihan

    Hi Cihan,
    it is confirmed to be a bug with this client library and it will be fixed. Thanks.
    Joao

  • Clickable on a theme that contains lines, rather than points in Java API

    Hi,
    I am working on a Java thick client application using the MapViewer API.
    The use case I am trying to implement is to click on a line that has been rendered by MapViewer, and identify the object that this lines represents.
    I have been able to implement a click on a point (e.g. defined as MDSYS.SDO_GEOMETRY(2001,null,MDSYS.SDO_POINT_TYPE(3,3,null),null,null).
    However, I am having difficulty with a line. I have tried with a line defined as follows:
    MDSYS.SDO_GEOMETRY(2002, null, null,
    MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(3,3,4,4))
    and also using the entry in the INTERSTATES table from the mvdemo sample database:
    GEOM: MDSYS.SDO_GEOMETRY(2002,8307,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(-95.368599,29.77528,-95.366074,29.77133,-95.365822,29.771009,-95.365341,29.769661))
    HIGHWAY: I 10/I 45
    The approach I have taken is to use live features by making a JDBCTheme ("INTERSTATES_THEME") clickable.
    The following is the code I used:
    MapViewer map = new MapViewer("http://localhost:8888/mapviewer/omserver");
    map.setServiceURL("http://localhost:8888/mapviewer/omserver");
    map.setDataSourceName("mvdemo");
    map.setImageFormat(MapViewer.FORMAT_PNG_URL);
    map.addJDBCTheme(config.getDataSourceName(), "INTERSTATES_THEME",
    "select HIGHWAY, geom from INTERSTATES where HIGHWAY = 'I 10/I 45'", "geom", "8307",
    "L.DPH", null, null, true);
    map.setFullExtent();
    Then, I make a call to map.run(), map.getGeneratedMapImage() and render the generated image in a JPanel paintComponent method.
    This all works fine, and I can see the highway being rendered.
    However, if I add
    map.setClickable(true, "INTERSTATES_THEME");
    before the call to map.setFullExtent();
    I get the following stack trace when map.run() is invoked:
    java.lang.IllegalStateException: unread block data
         at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2377)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1361)
         at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
         at oracle.lbs.mapcommon.MapResponse.readObject(MapResponse.java:513)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
         at oracle.lbs.mapclient.MapViewer.processRawResponse(MapViewer.java:6706)
         at oracle.lbs.mapclient.MapViewer.run(MapViewer.java:6363)
    Does anyone know if it is possible to make lines (rather than points) clickable on a thick client?
    Any help is much appreciated.
    Thanks.

    Hi,
    I want to have click event on Point.
    I have written following code using Mapviewer API:
    String serverUrl = "http://ps3962:7101/mapviewer/omserver";
    mapClient = new MapViewer(serverUrl);
    mapClient.setDataSourceName("mvdemo");
    mapClient.setBaseMapName("demo_map");
    mapClient.setCenterAndSize(-122.40, 37.80, 2.5);
    mapClient.setDeviceSize(new java.awt.Dimension
    (1280,768));
    mapClient.setImageFormat(MapViewer.FORMAT_PNG_URL);
    I have added point feature to it by mapClient.addPointFeature(cx, cy, 8307, "M.CIRCLE", "Point1",null,null);
    After this I did mapClient.run()
    and mapClient.getGeneratedImage()
    The image returned is null.
    I am able to get Image Url only.
    And By using that URL if I rendered the image in jsf page, How can I make point feature clickable ?
    In your first post You mentioned that you have used MapViewer.FORMAT_PNG_URL and still You are getting generatedImage.
    Can you please tell me what can be the problem in my code?
    I referred Mapviewer API and it is mentioned that for getting generatedMapImage the format should be FORMAT_RAW_COMPRESSED.
    So could you please tell me how can you get Image by using FORMAT_PNG_URL ?
    And also how to make point feature clickable ?
    Its urgent. Your help will be greatly appreciated .
    Thanks

  • Polygons in MapViewer using JavaAPI

    How do I display polygons in MapViewer using the JavaAPI?

    Hi Randy,
    assuming you have a table with a geometry column and valid polygons:
    1) the table must be registered on user_sdo_geom_metadata
    2) a spatial index must be created on the geometry column
    3) with MapViewer API you can add a dynamic theme using the addJDBCTheme method, and then call the method run to generate your map image.
    Take a look on MapViewer documentation for more information and examples.
    Joao

  • MapViewer (10.1.3 HTTP/XML version)

    Hi,
    Can some one please point me to the javadoc for the mapviewer/mapclient/mapcommon packages. Could not locate them on Bali or OTN.
    Thanks in advance.
    Sasidhar

    Sasidhar,
    If you have deployed MapViewer to an OracleAS instance (or OC4J), the MapViewer API can be found at:
    http://your_host:your_port/mapviewer/mapclient/ (where your_host is the OC4J host and your_port is the port).
    You can also find some detailed info. about how this API works in the MapViewer user guide at:
    http://download-west.oracle.com/docs/cd/B14099_01/web.1012/b14036/vis_beanapi.htm#i1021651
    Hope this helps.
    -Justin

  • Mapviewer- omserver and SSL

    My goal is to set up the mapviewer to ask for a client certificate before it presents a map. I followed the instructions in the Oracle 10g Container Security Guide to set up CLIENT-CERT authentication. So far so good. I am able to get the maps through HTTPs using the mapviewer's javascript (MapView) API. However, I am unable to get a list of cached based maps on the mapviewer server using Java (MapViewer class) API. It seems to me that the client cert get lost when my code get to the omserver.
    When I initiate the following code from both jsp and servlet
    MapViewer mv = new MapViewer(omserverURL);
    I got the following error:
    javax.net.ssl.SSLHandshakeException null cert chain
    even though I can print out the cert (before the the above code) from the jsp or the servlet.
    Is there a way to pass the client cert down to the omserver in the mapviewer Java API? I cannot find a solution in the current MapViewer 11g TP 2.
    Thank you very much for your help.
    TDV

    Yes. Its not really very different but if you are copying the examples then change
    var baseURL = "http://"+document.location.host+"/mapviewer";
    to
    var baseURL = "https://"+document.location.host+"/mapviewer";
    Mike

  • ASK:Mapviewer JSP demo not work in HTML DB

    Hi all, First I apologize if my thread is an old topic, but I need to know it...
    When I'm trying create a URL region...and I give an url like this...http://localhost:8888/mapviewer/demo/mapnavi.jsp?&centerx=106.88&centery=-6.94 and soon... I get the result like I need for the first time, but when I'm trying to submit some change (i.e. turn off one layer from base_map or zoom in the map) I get the error message from HTTP server like internal error or something (sory I forget to capture the error message)...
    How can I embed jsp page into HTML DB region without problem?
    Thanks for help!

    Hi Adhi,
    explaining the MapViewer API here would be a little bit too much... But there is a good documentation available under
    http://www.oracle.com/technology/products/mapviewer/mapviewer_doc_index.html
    I also think, questions regarding MapViewer itself are better placed in
    Spatial
    Reagard
    Stephan

  • Installing Mapviewer for JBOSS

    The Oracle Mapviewer webpage and documentation states that Mapviewer is supported for JBOSS 4.x and later.
    http://www.oracle.com/technetwork/middleware/mapviewer/overview/j2ee-server-support-097757.html
    However there doesn't appear to be any documentation or help on installing Mapviewer on JBOSS or the other J2EE servers.
    Is anybody aware of any Oracle documentation (or non-Oracle!) that covers how to install for JBOSS ? I assume it must have been done within Oracle to be able to confirm support !
    Much appreciated if anyone can provide any help.
    Thanks,
    Mike

    Hi,
    I meant that I use the function "Identify" provided by MapViewer API to query the information associated with a point.
    return: java.lang.String[][]
    identify(java.lang.String dataSource, java.lang.String table, java.lang.String[] columns, java.lang.String spatialColumn, int srid, int x, int y)
    A convenient method where only datasource name is needed instead of all the jdbc connection information.
    Above I copied the information about the function from MapViewer API. There are also many other useful methods, such as
    return: java.awt.geom.Point2D
    getUserPoint(int x, int y)
    Gets the user space point corresponding to the mouse click.
    For more information you could read the APIJavaDoc from the mapClient application.
    Regards

  • [MapViewer] can not set stroke width

    hi
    I am using MapViewer API. I will add dynamically Sytles with addColorStyle.
    How can i set the value for stroke width.
    I can only set the stroke color and stroke opacity.
    best regards
    mathias °ö°

    Hi Mathias,
    you can create Color objects with alpha value and use them on ColorStyleModel. For example:
    Color fill = new Color(255,0,0,100);
    Color stroke = new Color(0,0,0,255);
    ColorStyleModel cmodel = new ColorStyleModel();
    cmodel.setFillColor(fill);
    cmodel.setStrokeColor(stroke);
    float strokeWidth = 2f;
    cmodel.setStrokeWidth(strokeWidth);Joao

  • How to get the whole map image after zoom in?

    Hi,
    I use mapviewer API to generate map images and put them in JSP as well as in Java Applet. I called the method getGeneratedImage(). After I using the methods zoomIn() or zoomOut(), I got a new map image. But the size is fixed, so after zoom in I can only see a part of the whole map. I would like to use scrollbar to see other part of the map after zoom in.
    How can I solve this problem? I have the images as predefinied themes saved in database with MBR information.
    Thanks in advance.

    Hi,
    For the map request in MapViewer you may define the data area that you want to display, as well as the device size (width and height). The result is a java Image with width and height sizes. You can draw this image on a canvas with scroll bars, and if the size of the canvas is smaller than the image size, then you should see the scroll bars. But you have to code that. MapViewer will just return an Image with the specified size.
    The zoom in/out options just change the data area, but keeps the device size. Therefore you should use the API methods to set the data area (setBox or setCenterAndSize) and to set the device size (setDeviceSize), in order to control the size of your resulted image, and then draw it on your canvas with scroll bars.
    Regards.

  • Problem with image returned from getGeneratedMapImage method

    I'm a newbie as far as map viewer and Java 2D goes....
    My problem is the java.awt.Image returned from the getGeneratedMapImage method of the MapViewer API. The image format is set to FORMAT_RAW_COMPRESSED. The image returned is of poor quality with colors not being correct and lines missing. I'm painting the Image returned from this method onto my own custom JComponent by overriding the paint() method...
    public void paint( Graphics g )
    Image image = map.getGeneratedMapImage();
    if ( image != null )
    g.drawImage( image, getLocation().x, getLocation().y, Color.white, this );
    If I take the xml request sent to the application server and paste it into a "sample map request" on the map admin website (along with changing format to PNG_STREAM) my image renders exactly how I expect it to.
    Anyone have any idea what I need to do to get the java.awt.Image with format set to FORMAT_RAW_COMPRESSED to render correctly. I was hoping to get back a BufferedImage or a RenderedImage from the getGeneratedMapImage call but I'm getting back a "sun.awt.motif.X11Image".
    Will downloading the JAI (java advanced imaging) from sun help me at all?

    Joao,
    Turns out it is related to colors. I'm dynamically adding themes, linear features and line styles. I ran a test where I changed the color being specified in the line style from magenta (ff00ff) to black. When I changed the color the linear feature would show up. It was being rendered as white on a white background when I was specifying it to be magenta. I'm specifying another linear feature to be green and it is showing up in the java image as yellow. This doesn't happen when I take the generated XML from the request and display it as a PNG_STREAM.
    Any clue what is going on there?
    Jen

  • How to use keywords in a correct way for Acrobat Pro AND Spotlight

    When I enter keywords in a PDF using CMD-D in Acrobat Professional I also want to find those keywords via OS X Spotlight. At the same time I to be able to use keywords when I enter keywords in PDFs using Preview.app.
    What's the path to do this, and how do these three applications work together to provide a consistent search. I also need to know the details like do I enter keywords in Acrobat with komma or without, with a space before the komma or not etc.
    The goal is to be able to have a constistant, compatible workflow for keywords/tags in PDFs using Acrobat, prevoew.app, and other applications; in order to manage large amounts of PDF files.

    Hello Joao,
    Thank you for your answers. I hope I can ask some more of your time because it is not totally clear yet.
    I tried your suggestion to change the stroke width. This has no effect, other than the stroke width, the curves stay filled. It would be nice to show this in a picture... And I just noticed that I had the arguments wrong in my example (been playing around with it too much), the null and green should be the other way round. But also this did not make any difference. Specifying the fill color with the same color as the background color of the map is a workaround though.
    Adding the theme_name to the feature attributes is an option, but would that be possible with predefined themes? At the moment we have all the theme definitions in the database.
    The most important question however is how do I draw a single feature, based on some condition. The only method I can find in the MapViewer api is drawLiveFeatures with no feature args which "Draws all the live features that are returned to this client from MapViewer". I must be overlooking something.
    Thanks again very much for your help,
    Ida

  • Advantages of using Google or Bing Tile layers

    Within the Mapviewer API they allow you to use either Bing or Google tile layers for your map. I was just wondering what the functional advantages of using Mapviewer (with those layers added) would be versus just using Google or Bing directly through their own javascript APIs.
    Thanks.
    Edited by: user1175540 on Dec 29, 2010 2:16 PM

    Hello,
    if you just want to display google or bing maps, than there is no functional advantage.
    But if you want to display your own data on top of the googel or bing maps, than you get the whole advantages of mapviewer.
    Of course you can use the google api to display your own data, but you won't get the mapviewer advantages like pre rendering, caching, fois etc.

Maybe you are looking for

  • Webi Stucks while trying to create report with BW7.0 (WIS 10901)

    Hello, I have some problem about using data created from BW 7.0 1. After I try to drag more than one object to create report from webi and run the query, it got sutcked and appear error as below; A database error occured. The database error text is:

  • How do I save and mp4 that was sent to me in a text message?

    My brother sent me a voice memmo of my nephew and I can not seem to figure out how to save it to my computer so I can turn it into a ringtone. HELP!

  • Image won't print on pdf form.

    I copied an image (jpeg) onto my pdf form. When I print the form the image doesn't print. The handles around the image are blue instead of black. Can I somehow embed this image onto the form?

  • How to create a special collapsible panel?

    First, i'm sorry if i posted this on the wrong place. Second, i'm using Dreamweaver CS5 I've been trying to create something like this collapsible menu The button(tab) is separated from the menu(content) it opens/closes. If it's possible, can somebod

  • My time capsule  light

    My time capsule light does not go green every time i switch it on. The light flashes amber. I have to switch it off and back on until it does. Any ideas