Showing posts with label spatial. Show all posts
Showing posts with label spatial. Show all posts

06 February 2008

Oracle Spatial query windowing technique

This again is one of the problems i faced while coding in oracle 10g.
I will post both the problem and the solution for it..

Dear friends,
The database i'm using (mvdemo - mapviewer demo DB that comes along with Oracle 10g), has only data about united states. Say if i have my query window like this, -180, 0, 180 , 90 (which is the upper half of the earth), i am getting the desired result. ie.,Here is that query,

SELECT count(s.geom) FROM states s WHERE SDO_FILTER(s.geom,SDO_GEOMETRY(2003,8265,NULL,SDO_ELEM_INFO_ARRAY(1,1003,3),SDO_ORDINATE_ARRAY(-180, 0 , 180, 90))) = 'TRUE';
--Returns 55
I'm currently having a problem with my rectangular window query. When i query with a window value of -180, -90, 180, 90 (which covers the whole earth), the number of spatial objects (SDO_GEOM) that is returned is 0. It is not throwing any ORA error. But the expected result is as usual 55.

SELECT count(s.geom) FROM states s WHERE SDO_FILTER(s.geom,SDO_GEOMETRY(2003,8265,NULL,SDO_ELEM_INFO_ARRAY(1,1003,3),SDO_ORDINATE_ARRAY(-180, 0 , 180, 90))) = 'TRUE';
--Returns 0
Can anyone please help me out with this issue??

Solution
I found the solution to my problem. actually the query given here works just fine.wat i was doing was using the sdo_intersection(, ). The query window am using here is the whole earth. But according to spatial rule, there cant be any geometry greater than half the surface of the earth.
Yes.. its pretty true. Imagine yourself trying to calculate the distance from Pearl harbor to japan. For a small kid, if you give the map and ask him to measure, he'l tell the longest route in the conventional map. But it is not so. We have to calculate the shortest distance which ofcourse will only be possible when you see the earth as a sphere. Oracle 10g is no exception. The design is logically correct. So any query window given exceeds half the size of the earth, oracle will throw an error.

05 February 2008

An application from the scratch

I have designed an application purely using java that has lots of spatial features. I had doubt of whether to use good old java swings or some other UI such as RCP. Well, I started my application in RCP first. The one good thing I did while creating it was the framework. I made it independent of the front end (doesn’t matter what UI you are gonna use, the core logic remains the same). What I mean to say is that, there are these map viewing/editing functionalities which do not depend on what UI being used. For example, take the simple zoom functionality. If I am going to zoom to some part of my map in the front end, all that has to happen in the background is to query for the newly zoomed area and send it back to the front end. Now, it can be sent to anywhere. It may be a swing front end or Eclipse RCP or even a C++ UI or you can even send it as a response to a HTTP request. That’s how flexible your app should be. I will provide as many details about the one I have done.

04 February 2008

Kick off

When I initially launched this website I thought I would fully focus on geo spatial applications but it was not a big hit. The following article was the first one I wrote regarding it and unfortunately it was the last one too as the ship turned direction towards DSA and Java. However, for memoir, I am keeping it.

Let me kick off with the basic understaing needed about a spatial application.

Your spatial application may be a,
1) Basic standalone version dealing with basic map viewing features such as zoom, pan etc which can be used for basic viewing purposes alone.
2) Advanced standalone version which combines the basic features along with area marking, advanced searching (searching with buffers), cartographic features etc.,
3) Web application which has a common server that serves a variety of clients who need to work on a particular region/area. It can even include ajax and web 2.0 capabilites.
Requirements are endless.

But why people really need all these? Why do they need a map viewing application?
Well, the answer is pretty straight forward. Cost cutting. There are lots of map viewing applications that are available in market which has a lot of features and cool tekniques that come with ready made frameworks. But they all have the following disadvantages,
1) As said earlier, cost is a major factor.
2) Just buying enough licenses from these spatial companies is never going to be enough. You need to have a in-depth understanding of your needs and a proper design has to be followed. Without that, whatever support or assistance you are going to get from the third party company will go into waste.
3) Limit to your imagination. If you want to develop a spatial application that need to address your expectation (mainly performance), then you should definitely ponder over your decision whether or not should i go for a third party application for my maps.
4) All major companies using geo spatial applications may at times blindly fall in trap for these geo spatial vendors without exploring enough on the beautiful open source communities (eg., www.opensourcegis.org ) available in the web and the range of free products they give.

I guess i will stop here for a kick-off. Will be back with more information. Till then, its bye from,
Bragaadeesh.