Performance of Spatial Java API

I use the following statements to retrieve the sdo_geometries from Oracle Spatial Database:
Statement stmt = conn.createStatement();
OracleResultSet ors = (OracleResultSet) stmt.executeQuery("select geom from counties");
while(ors.next())
// Extract JDBC object from record into structure
STRUCT dbObject = (STRUCT) ors.getObject(1);
// Import from structure into Geometry object
JGeometry geom = JGeometry.load(dbObject);
//proecss geom...
I execute this in about 5 seconds, but I trace MapViewer loading the same sdo_geometries in about 2.5 seconds.
How do MapViewer load the sdo data?
Thanks.

Hello Ted
I have not used the API for working with SHAPE files but what I do know about shape files is that geometry is not stored in a geometry-type column. So I do not think you have to go and look for it, because it does not exist.
Shape files are made up out of minimum 3 files:
SHP: binary file storing the geometries
SHX: some kind of index file
DBF: attributes associated with the geometries in shp file.
There does not exist an explicit link or relations between the geometries and their attributes. This is more an implicit relation based on the sequence or order of the records in the files. So the third geometry in SHP file corresponds with the third record in de DBF file.
There is a toolkits available on the Spatial download page containing source code. Maybe this covers already what you are trying to accomplish.
Find out the Oracle Java Shapefile Converter:
http://www.oracle.com/technology/software/products/spatial/index.html
I hope this helps you out a little bit.
Luc

Similar Messages

  • I can not find java library for spatial java api B14373-01

    hi
    at the following link there is a description of the current java api..
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14373/toc.htm
    but i can't find the appendant *.jar files
    can anybody help me...
    jens

    You can find them under $ORACLE_HOME/md/lib
    directory.
    siva

  • Network.addNode (arg1,arg2,arg3) is there a bug in Spatial Java API ?

    Hi
    when I try to add a Node on a Link to the Network - I'm really confused. I have a LinearLineString {0 0 10 0). When I try to add a Node on the position (2,0) my first new Link have the right coordinates (0,0,2,0) but the second new link have the coordinates (2,0,8,0) when I expected (2,0,10,0)?
    maybe somebody have any idea?
    Thanks Jens
    //new SDONetwork
    Network net = NetworkFactory.createSDONetwork("myNetwork", 0, false, 0,
                        2);
    Node start = NetworkFactory.createSDONode(1, "start", 0, 0);
    Node end = NetworkFactory.createSDONode(2, "end", 10, 0);
    // LinkGeometry x=0 y=0 x=10 y=0
    JGeometry linkGeom = JGeometry.createLinearLineString(new double[] { 0,0,10, 0 }, 2, 0);
    try {
    net.addNode(start);
    net.addNode(end);
    net.addLink(NetworkFactory.createSDOLink(1, "firstLink", start,end, 1, linkGeom));
    //add new SDONode to Link
    Node n = net.addNode(net.getLink(1), 0.2, false);
    //all new Links on Node
    for (int i = 0; i < net.getNode(n.getID()).getIncidentLinks().length; i++) {
    for (int j = 0; j < net.getNode(n.getID()).getIncidentLinks()
    .getGeometry().getOrdinatesArray().length; j++) {
    System.out.println(net.getNode(n.getID())
    .getIncidentLinks()[i].getGeometry()
    .getOrdinatesArray()[j]);
    System.out.println("----");
    } catch (NetworkDataException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();

    Hi,
    This has been verified as a bug in 10203.
    You can track this bug in Oracle bug database.
    The bug number is 6070333.
    Regards,
    -Jack

  • Oracle Spatial 10g R2 Java API

    Hi All,
    I have a JAVA tool said to be written for Oracle Spatial 10g R2 Java API which uses for example the class oracle.spatial.georaster.JGeoRaster. I have to port it to 11g R2. The tool is definitely written for an earlier version, because compilation fails on for example JGeoRaster.getProperties() method which is not present in the new API. For this new API I have a fine Javadoc documentation here:
    http://download-llnw.oracle.com/docs/html/E11829_01/
    I have searched for a similar one for 10g R2 but found only like
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14373/toc.htm
    which misses the oracle.spatial.georaster package. Is there such a package and if so, where can I find docs for it?
    thank you in advance, best regards: Balázs Bámer

    Hi Balázs,
    the GeoRaster Java API was first released with 11gR2. Your first link points to that, or this link:
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11829/toc.htm
    your second link points to 10g Oracle Spatial Java API, which doesn't include any GeoRaster related API. your tool might have been developed based on the old INTERNAL georaster jar file, which is not supposed to be used by your java program. But if you do want the api doc, you can run javadoc or jdeveloper to find out the api from the old sdogr.jar file.
    jeffrey

  • Oracle 11g Standard Edition + Locator Java API

    We have Oracle 11g Standard which includes the Oracle Locator package, but not the Oracle Spatial.
    I would like to use the Oracle® Spatial Java API in my java code, but am unsure of the licensing implications of this.
    I require some form of java api in order to access the geomettry objects stored in the database. Oracle do not allow the download of the java files seperately. I was unable to find any reference to a 'Oracle Locator Java API'
    Could someone let me know what exists in terms of Java API's, what i am entitled to use under the current licensing rules, and where I can download the necessary source/jar files?

    Thanks for letting me know the location of the jar files, that will at least help me get things going.
    I am still concerned about licensing issues, as your reply appears to contradict itself:
    "There is no licensing issues if you just want to use Oracle Spatial Java API(sdoapi.jar) with your spatial data in the Oracle 11g Standard DB."
    and
    "You cannot use some oracle spatial features (PL/SQL packages and their java APIs) in the standard edition."
    I could use some clarification on this. I'm currently assuming that you mean I can legitimately use the spatial java API with any features I have available within the 11g Standard DB (i.e Oracle Locator subset of the Oracle Spatial package), but that I can't take that for granted, especially considering how militant Oracle are being over licensing and patents these days.

  • Java api + polygon self intersecting.

    Hi,
    I am using this sdo_geom.validate_geometry_with_context to validate the polygon geometry.
    Is there any equavalent oracle spatial java api to do similar validation (Oracle 10g), before loading the data. thanks.

    Dear (What is your name?) User 810260,
    Yes, there is the Java Topology Suite (1.12 is the latest).
    Here is an example from its test harness:
    public class IsValidTester {
      public IsValidTester() {
      public static void main(String[] args) throws Exception {
        WKTReader reader = new WKTReader(new GeometryFactory());
        Geometry g = reader.read("GEOMETRYCOLLECTION (POINT (110 300), POINT (100 110), POINT (130 210), POINT (150 210), POINT (150 180), POINT (130 170), POINT (140 190), POINT (130 200), LINESTRING (240 50, 210 120, 270 80, 250 140, 330 70, 300 160, 340 130, 340 130), POLYGON ((210 340, 220 260, 150 270, 230 220, 230 140, 270 210, 360 240, 260 250, 260 280, 240 270, 210 340), (230 270, 230 250, 200 250, 240 220, 240 190, 260 220, 290 230, 250 230, 230 270)))");
        IsValidOp op = new IsValidOp(g);
        if (!op.isValid()) {
          System.out.println(op.getValidationError().getMessage());
        else {
          System.out.println("OK");
    }To create a JTS Geometry you can do something like this:
        public static void setPrecisionScale(int _numDecPlaces)
            precisionModelScale = _numDecPlaces < 0
                                  ? (double)(1.0/Math.pow(10, Math.abs(_numDecPlaces)))
                                  : (double)Math.pow(10, _numDecPlaces);
        public static String  myFunction(STRUCT _geom,
                                                    int    _precision)   // _precision is decimal digits of precision NOT Oracle tolerance.
         throws SQLException
            try
                // Check geometry parameter
                if ( _geom == null )
                    throw new SQLException("Supplied Sdo_Geometries is NULL.");
                // Get valid connection
                setConnection();
              int SRID = getSRID(_geom,0);  // My own function that gets the sdo_srid value from an SDO_Geometry STRUCT...
              PrecisionModel  pm              = new PrecisionModel(getPrecisionScale(_precision));   // <-- note use of getPrecisionScale method
              GeometryFactory geometryFactory = new GeometryFactory(pm,SRID);
              GeometryConverter     converter = new GeometryConverter(connection,geometryFactory);
              Geometry                    geo = converter.asGeometry(_geom);
              // Check converted geometries are valid
              if ( geo == null )
                throw new SQLException("SDO_Geometry conversion to JTS geometry returned NULL.");
              IsValidOp op = new IsValidOp(geo);
              if (!op.isValid()) {
                 return op.getValidationError().getMessage();
            } catch(SQLException sqle) {
                System.err.println(sqle.getMessage());
                throw new SQLException(sqle.getMessage());
             return "TRUE";
        } If this helps you, please mark this post as the answer that got you the solution you wanted.
    Simon

  • Location of Oracle Spatial Java Class Library

    Hello All,
    I'm looking for this library and there seems to be no link for it on the download page (http://www.oracle.com/technology/software/products/spatial/index.html). Can someone please help me?
    Thanks!
    --john                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    there is a "jlib" directory under each db component. the oracle spatial Java API is under $ORACLE_HOME/md/jlib.

  • Performance of Java API 2

    Hello,
    we are currently using Java API 2 that comes with MDM 5.5 SP5 (Build 5.5.42.65) to read extended information from the mdm repository.
    Our process:
    We are export every product as a XML file over the MDM Syndicator and enrich this file with extended information from the API (This step is needed because we cannot export all data by the Syndicator, for example multilingual attributes / some product data like textblocks / id's for incremental updates ...).
    Actually the performance is really bad, we need ca. 10-15 secs to process one file, that is really frustrating when you have stored near 70.000 products in your repository.
    Are there some tricks to improve the performance or is the API really so slow? Or any better alternatives for an fast export?
    Thanks for your help ....
    Best Regards,
    Jan

    1 - If you are able to use the EJB connection with the LiveCycle SDK classes (you have are using a supported java version such as 1.5_xx, your network security doesn't prevent RMI calls, etc.) then that is your best bet.
    2 - Yes, you will need the java APIs to be accessible for your application. The LiveCycle APIs have remote EJB endpoints so you can access them from another server.
    3 - There are samples that ship with the LiveCycle server (located in your LCInstall\LiveCycle_ES_SDK\samples\Forms). There are also samples on the LiveDocs page at: http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000064.html

  • Process Performance monitoring Java API

    Hi,
    I am looking for java API's which can help me monitor performance stats like CPU utilization, memory utilization etc on a windows platform. I did get a handle on few APIs to measure memory utilization but somehow monitoring the CPU seems to be a problem. My requirement is to measure CPU and memory for a particular process and not for the entire system. Any pointers on this front would be of great help.
    Thanks
    Bhavin

    I don't see any great free libraries that you can just drop in and make this happen.
    There's an interesting looking product called "SIGAR" that seems to speak directly to what you want to do here.
    Or this might be a great opportunity for you to play with JNI and some C++... awesome! ;-)

  • Invalid Argument Exception on Java API's DB Close

    When closing the database via the Java API's close method, I am getting an invalid argument exception... how can this be fixed... subsequent access to the DB causes the JVM to crash??
    ERROR: An exception has occurred: java.lang.IllegalArgumentException: Invalid argument
    java.lang.IllegalArgumentException: Invalid argument
    at com.sleepycat.db.internal.db_javaJNI.DbEnv_close0(Native Method)
    at com.sleepycat.db.internal.DbEnv.close0(DbEnv.java:217)
    at com.sleepycat.db.internal.DbEnv.close(DbEnv.java:77)
    at com.sleepycat.db.Environment.close(Environment.java:39)
    at com.sleepycat.dbxml.XmlManager.closeInternal(XmlManager.java:301)
    at com.sleepycat.dbxml.XmlManager.delete(XmlManager.java:33)
    at com.sleepycat.dbxml.XmlManager.close(XmlManager.java:310)
    at com.iconnect.data.adapters.BerkleyXMLDBImpl.insert(BerkleyXMLDBImpl.java:827)
    at com.iconnect.data.DataManagerFactory.insert(DataManagerFactory.java:182)
    at Xindice2Berkley.main(Xindice2Berkley.java:99)

    I had the same problem. I could fix it by carefully calling the delete() function on all those DBXML Xml..xyz objects that you create when you perform queries etc. It seems that those Java objects have some 'shadow' object in the underlying DLL and by calling delete() you free resources that remain otherwise assigned (maybe somebody with a C++ background who programmed this stuff?). Call delete() before the Java object gets out of scope. For instance:
    results = mgr.query(collection,context,null);
    XmlValue value;
    try {
    while ((value = results.next()) != null) {
    XmlValue c = value.getFirstChild();
    String ref = c.getNodeValue();
    c.delete(); c = null;
    value.delete(); value = null;
    catch (Exception e) {
    finally {
    if (results != null) {
    results.delete();
    results = null;
    Once i did this on all possible dbxml objects i used in my code, the java.lang.IllegalArgumentException: Invalid argument disappeared.
    Message was edited by:
    user562374

  • Iterate through all the records in a table using Java API

    Hi All,
    What is the easiest way to iterate through all the records in a given table using Java API? I cannot find any methods that will return all records in a table and the only way I can use is to perform a free form search with a condition that is always true. The code works but is pretty ugly. Is there an alternative to this approach?
    Thanks!
    Kenny

    Hi Kenny,
    You can construct a new Search object with your table's code name, a new ResultSetDefinition object for your table and just execute this search using the GetResultSet method of CatalogData.
    Please look at the following code:
    Search search = new Search(<code name of your table>);
    ResultSetDefinition rsd = new ResultSetDefinition(<code name of your table>);
    rsd.AddField<code name of a field>);
    rsd.AddField(<code name of a field>);
    String sortField = <code name of your sort field>;
    boolean sortAscending = true;
    int page = 0; //page number
    A2iResultSet rs = <your CatalogData object>.GetResultSet(search, rsd, sortField, sortAscending, page);
    for (int i = 0; i < rs.GetRecordCount(); i++)
        Value fieldValue = rs.GetValueAt(i, <code name of a field>);
    Hope this helps,
    Nir
    PS - I really recommend you to start using the new API, as it is much more efficient and straight-forward.

  • How to use the Public Java API

    Is it possible to use the Public Java API to write a custom transformation in Java and use this in OWB. i.e. Say I have a Dateofbirth field in my source database and an Agegroup field in the target database, and I write a transformation in Java to take the Dateofbirth as an input parameter to the method and calculate the Agegroup e.g. 25-30, and return it from this method which then populates the Agegroup field in the target database. If so, how do I go about this?

    Martin,
    In general, yes you could... but you do not need to. You could use the UI to implement this requirement. The public Java API is there for you to manipulate metadata. How you implement your system, is independent of that.
    The way you would go about the case you just mentioned... you would write the Java code, deploy it into the database, wrap it in a PL/SQL procedure or function, and call it from OWB.
    Would this be a good idea...? I think no. Unless you have very complicated calculations that can only be performed in Java, I strongly encourage you use the PL/SQL language. Reason being: transformation will be much faster, because there is no need to translate PL/SQL into Java and back again.
    Hope this helps,
    Mark.

  • How to build a small application using Java API

    Hai expertise,
         I want to retreive MDM repository info using JAVA API, i am following these blogs:
    /people/andreas.seifried/blog/2006/03/26/performing-free-form-searches-with-mdm-java-api
    /people/udi.katz/blog/2005/08/21/retrieving-data-from-mdm-server-using-the-mdm-java-api
    /people/udi.katz/blog/2005/07/17/mdm-connectivity-to-java-application
    <b>where to get the jar and sda files to build the application??
    In Developer Studio.. Windows -> Preferences -> Java -> Classpath variables. Is this the only place where we need to give the jar file path??
    Are there any other configurations to do(except setting container variable to MDM4J jar file) to connect my java application to MDM repository???</b>
    Regards,
    Chand.

    Hi Govada,
    (1)You need to add the MDM4j and other JAR files at:-
    right click on project -> Java Build Path -> Libraries -> Add External JARs
    (2)If the project is Web Dynpro project one
    then right click on project -> Web Dynpro Reference -> Library Reference -> and add sap.com/com.sap.mdm.tech.mdm4j
    Are you using JAVA API 1 or 2???
    Thanking you
    Namrata Dixit

  • Performance DB vs Java Edition

    Hi there,
    we've been investigating wether a (and when which) NoSQL-DB outperforms a standard SQL solution for our usecase:
    500.000 records bulk insert
    2k - 5k per record
    With 2 Indices
    Using Java API
    Multi OS: Linux, Windows, z/OS
    Berkeley DB performed best (bulk insert, selects and deletes) on our Windows-Tests (with 2GB memory).
    Unfortunately theres a huge gap between Berkley DB and its Java Edition performance.
    For a 20.000 record chunk insert Berkeley DB (using BTREE) takes 2000 - 3500 ms. When the cache is full and the first cache misses appear the inserting time grows and stays at arround 8000 ms. After a while st_cacheMiss decreases again resulting in 2000 - 3500 ms per insert.
    The JE starts with 4500 - 5000 ms per insert. After the first 200.000 records the cache is full and the nCacheMiss grows rapidly along with the inserting time (11s, 13s, 16s, ... 30s and even longer). There is no constancy like the non Java version shows to have.
    Is there any way to reach the Berkeley DB's performance with the JE? Esp. the constant insert time.
    We've tried already different CacheModes but default mode is the best.
    Setting je.log.faultReadSize=5120 leads to a slighter better perfomance, but still the inserting gets slower and slower.
    Since we need z/OS support we'd prefer to use the JE.
    Thanks for any help.
    Jonas

    Hello Jonas,
    Glad you found the main problem.
    I don't find it's productive to compare the two products' performance as they are so different, but I can help with tuning BDB JE.
    The first step is to take a look at the performance section of the FAQ:
    http://www.oracle.com/technetwork/database/berkeleydb/je-faq-096044.html
    If you have further questions on tuning please be sure to post:
    + Your EnvironmentConfig settings and je.properties (if any)
    + Your DatabaseConfig or StoreConfig settings.
    + A couple dumps of the EnvironmentStats covering the performance test time period, and be sure to clear the stats each time with StatsConfig.setClear(true).
    This is just the starting info for doing any sort of tuning with JE.
    I'm surprised that CacheMode.EVICT_LN didn't help, since moving the LNs out of cache immediately should reduce the burden on the evictor and Java GC. If you don't have enough cache to hold all LNs (see the FAQ entry on DbCacheSize), then EVICT_LN is usually beneficial. If you use EVICT_LN, be sure to also set EnvironmentConfig.CLEANER_LAZY_MIGRATION to false. Lazy migration retains LNs in cache and partially negates the benefits of EVICT_LN.
    As described in the FAQ, be sure your cache size is large enough to hold the BINs.
    The deferred-write mode is sometimes a win for bulk loading, but if you are doing pure insertions it may not help.
    I suggest enlarging these ENVIRONMENT_CONFIG settings if you haven't already:
    CLEANER_LOOK_AHEAD_CACHE_SIZE - try 1MB
    CLEANER_READ_SIZE - try 1MB
    See Durability if your database/store is transactional. Using NO_SYNC durability is much faster of course, but there are trade-offs. NO_SYNC is the default for a non-transactional database/store.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Java API for CVS access

    Hi,
    I am looking for a third party Java API which i can use to connect to a CVS repository and perform code synch up operations with the repository. If anybody has any informations. Pls let me know.
    Thanks.

    Thanks for the reply. I did try jcvs. I am still trying to get it running in my system. That apart, i am not sure if jcvs exposes any of its API's that I could use to connect to a CVS repository. I did not find any API documentation with it. I am finding it painfull to go thru its source code to find out what its core classes are and how I should call them.
    Anyways, there should be other third party APIs in the www. And I need to get my hands on them.
    Pls help !!

Maybe you are looking for