One of the most important tasks of a GIS application is the "Spatial Join" or "das Verschneiden" (in German):
Oracle Maps may fully take advantage of the inbuilt Oracle Spatial Technology as part of the database. The functions ANYINTERACT and/or SDO_RELATE are used to calculate above e.g. which FOI (customer) is located in the Polygon (REGIERUNGSBEZIRK = County).
When you click ('mouse_click') on the polygon the Spatial Function is invoked and no timeconsuming calculations are carried out - and you have the result within a second.
"How To?"
A mouse_click listener is registered to the map.
mapview.setEventListener("mouse_click", showSelection)
and invokes by means of the 2nd parameter "showSelection" the function below:
This listener adds two themes to display the selected county and customers inside it. Both themes take the mouse click location as the geometry binding parameter.
Sourcecode of Oracle Maps Javascript:
var countyTheme = null ;
var customerTheme = null ;
function showSelection(loc)
{
var mouseLoc = mapview.getMouseLocation();
if(countyTheme)
mapview.removeThemeBasedFOI(countyTheme) ;
if(customerTheme)
mapview.removeThemeBasedFOI(customerTheme) ;
countyTheme = new MVThemeBasedFOI('themebasedfoi1','geo.de_regbez_selected_by_click') ;
countyTheme.setQueryParameters(mouseLoc);
mapview.addThemeBasedFOI(countyTheme);
customerTheme = new MVThemeBasedFOI('themebasedfoi2','geo.de_kunden_in_selected_county') ;
customerTheme.setQueryParameters(mouseLoc);
customerTheme.enableEventPropagation(false);
mapview.addThemeBasedFOI(customerTheme);
}
Enabling the above code to work we have to define two themes based on respective tables (for my example REGBEZ and DEKUNDEN or in the MVDEMO * schema: COUNTIES and CUSTOMERS):
1. de_regbez_selected_by_click (for the MVDEMO schema: counties_selected_by_click)
2. de_kunden_in_selected_county (for the MVDEMO schema: customers_in_selected_counties)
and put some code and SQL in the style definitions (we do use the Mapbuilder:)
1. Theme "DE_REGBEZ_SELECTED_BY_CLICK" - we select the polygon by click:
The code within style of theme "DE_REGBEZ_SELECTED_BY_CLICK":
(sdo_relate(geoloc, :1, 'mask=ANYINTERACT')='TRUE' and rownum >2)
Pls look at the "Features Style"! I have created a feature style of type "Line" and named it "L.DE_NUTS2_SELECTED_YELLOW" and applied it when "Rendering" - so the borders of the county turn out to be highlighted in yellow color when clicked.
2. Theme "DE_KUNDEN_IN_SELECTED_COUNTY":
The Style of the theme "DE_KUNDEN_IN_SELECTED_COUNTY" in detail:
The code:
select a.geoloc, a.name, a.regbez, a.umsatz from dekunden a
where SDO_RELATE(a.geoloc,(select geoloc from de_nuts2 b where sdo_contains(b.geoloc, :1)='TRUE' and rownum<2), 'mask=ANYINTERACT'='TRUE'
Admittedly the above code is related to my tables.
Here is the code you may use for the MVDEMO tables "customers" and "counties":
Code for the first theme/style (county_selected_by_click):
(sdo_relate(geom, :1, 'mask=ANYINTERACT')='TRUE' and rownum<2)
Code for the customer theme (customers_in_selected_county):
select a.location, a.name,
a.city, a.sales from customers a where sdo_relate(a.location, (select
geom from counties b where sdo_contains(b.geom, :1)='TRUE' and
rownum<2), 'mask=ANYINTERACT')='TRUE'
* Using MVDEMO data:
In the Javascript funtion you will have to replace "geo.de_regbez_selected_by_click" by "mvdemo.counties_selected_by_click" and
"geo.de_kunden_in_selected_county" by "mvdemo.customers_in_selected_county"
Finally I like to thank LJ and Ji of the Oracle Maps Development team for their support in achieving the above! Thanks!
Mittwoch, 4. Juni 2008
Montag, 7. Mai 2007
Home-Link in Navigation Panel
Rarely used but very efficient is the HOME-Link integrated in the Navigation Panel:
<--- in the middle of the 8 arrows you'll fine an additional mark: the HOME-Link
It helps to go back to the HOME settings defined in the respective function
mapview.setHomeMap(mpoint, nZoom);
How to achive this ?
See the example code as below:
var mapview;
function showMap()
{
var baseURL = "http://"+document.location.host+"/mapviewer";
var mapCenterLon = -122.45;
var mapCenterLat = 37.7706;
var mapZoom = 3;
var mpoint = MVSdoGeometry.createPoint(mapCenterLon,mapCenterLat,8307);
mapview = new MVMapView(document.getElementById("map"), baseURL);
mapview.addBaseMapLayer(new MVBaseMap("mvdemo.demo_map"));
mapview.setCenter(mpoint);
mapview.setZoomLevel(mapZoom);
mapview.setHomeMap(mpoint, 2);
mapview.addNavigationPanel("WEST");
mapview.addCopyRightNote("©2006 powered by oracle(tm)");
mapview.addScaleBar();
addThemeBasedFOI();
mapview.display();
}
<--- in the middle of the 8 arrows you'll fine an additional mark: the HOME-Link
It helps to go back to the HOME settings defined in the respective function
mapview.setHomeMap(mpoint, nZoom);
How to achive this ?
See the example code as below:
var mapview;
function showMap()
{
var baseURL = "http://"+document.location.host+"/mapviewer";
var mapCenterLon = -122.45;
var mapCenterLat = 37.7706;
var mapZoom = 3;
var mpoint = MVSdoGeometry.createPoint(mapCenterLon,mapCenterLat,8307);
mapview = new MVMapView(document.getElementById("map"), baseURL);
mapview.addBaseMapLayer(new MVBaseMap("mvdemo.demo_map"));
mapview.setCenter(mpoint);
mapview.setZoomLevel(mapZoom);
mapview.setHomeMap(mpoint, 2);
mapview.addNavigationPanel("WEST");
mapview.addCopyRightNote("©2006 powered by oracle(tm)");
mapview.addScaleBar();
addThemeBasedFOI();
mapview.display();
}
Donnerstag, 3. Mai 2007
Basemap and 5 FOI Layers - Styles by Mapbuilder
Without "programming" and with just little expertise in the "Mapbuilder" and in "Oracle Maps" this is possible:
1 Basemap mit counties and sub-districts
5 FOI layers:
- customers with sales
- counties "Freistaaten" (lightgreen-transparent),
- other counties (green, transparent),
- Hansestadt Hamburg (yellow)
- APEX Selectlist: customer sales styles: variable points and bars
Cooming soon: "How To Tipps".....
Freitag, 20. April 2007
FOI's and Performance
ZOOM LEVELS for FOI's !!!
when experiencing performance issues consider this:
The more FOIs you display, the higher the overhead in the client browser.
The solution is to limit the number of FOIs to be displayed based on the zoom level.
Check out methods like:
* foiLayer.setMinVisibleZoomLevel(2);
This sets the minimum zoom level at which FOIs become visible. Above that level, the FOIs are not shown at all.
* foiLayer.setMaxWholeImageLevel(3);
This sets the level up to which FOIs are rendered as a
single image, so consuming less resources in the browser. After that level, they are rendered as individual images.
* foiLayer.setMinClickableZoomLevel(5);
This sets the level from which the FOIs are clickabke. Above that level, they are visible but not clickable. Check also
* setQueryWindowMultiplier(1)
By setting this to 1, Mapviewer will only return those FOIs that strictly fit in the current map window. The default it 2, which means that Mapviewer returns FOIs that fit twice the area.
Thanks to Albert Godfrind for pointing me to this !
An example will follow as soon as I have tested this ! stay tuned !
when experiencing performance issues consider this:
The more FOIs you display, the higher the overhead in the client browser.
The solution is to limit the number of FOIs to be displayed based on the zoom level.
Check out methods like:
* foiLayer.setMinVisibleZoomLevel(2);
This sets the minimum zoom level at which FOIs become visible. Above that level, the FOIs are not shown at all.
* foiLayer.setMaxWholeImageLevel(3);
This sets the level up to which FOIs are rendered as a
single image, so consuming less resources in the browser. After that level, they are rendered as individual images.
* foiLayer.setMinClickableZoomLevel(5);
This sets the level from which the FOIs are clickabke. Above that level, they are visible but not clickable. Check also
* setQueryWindowMultiplier(1)
By setting this to 1, Mapviewer will only return those FOIs that strictly fit in the current map window. The default it 2, which means that Mapviewer returns FOIs that fit twice the area.
Thanks to Albert Godfrind for pointing me to this !
An example will follow as soon as I have tested this ! stay tuned !
Abonnieren
Posts (Atom)