on 09-28-2015 4:07 PM
Hi All,
I am developg an applicatiinon using sap.ui.vbm.GeoCircle control. Here I am providing an input option with suggestion enabled, which I can use to search the predefined places(GeoCircles) that are coming from the backend server through oData service. So please help me to locate the GeoCircle Based on the input provided.
Thanks and Regards,
Sagar Patil
which browser do you use? Some inhibit the download of images (= map tiles) from a different server or some ask you if it's ok.
Do you see a map if you don't zoom-in?
Have you changed the default map provider settings?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ralf,
I am using chrome Version 45.0.2454.85 m.
I can see the map when I don't zoom-in and I can see the map if I zoom-in using mouse also. But if I try to zoom in,using following code
map disappears. I have not changed the default map provider settings. How and where do I need to change it??
Hi Sagar,
Not sure, whether this is what you're expecting / not? http://embed.plnkr.co/zW3GL0tBbA95qPJ9LzLL/preview
Input control is placed underneath the map, start typing '1'/'2'/'7'/'9' and suggestion list opens, select a value then the position of Geo circle will be set to the position selected in input.
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sai,
Thanks for your reply. But this is not what I am looking for.Let us say we have plotted some 10 GeoCircles on map and I have an input field with suggestion which is used to key in Geo Locations.Assume I have entered GeoLocation of Paris which is one among those 10 GeoLocations.Now Map should zoom(optional) and point to the Paris Location just like we search for the places in google map and it will point to the searched location.
Thanks and Regards,
Sagar M Patil
Hi Sagar,
Did you try using zoomToGeoPosition / zoomToArea methods?
Check this link where you can find list of samples using zoomTo - Visual Business UI5 Tests Index
Regards,
Sai Vellanki.
Hi Sagar Patil,
you can follow these steps:
1 pass your location or city in this URL, and use an appropriate google api key
var geoloc = new sap.ui.model.json.JSONModel("https://maps.googleapis.com/maps/api/geocode/json?address="+location+","+city+"&KEY%20=%20%22<your google key>%22");
2. Now get latitude and longitude using this code
var lat = geoloc.oData.results[0].geometry.location.lat;
var lng = geoloc.oData.results[0].geometry.location.lng;
3. Now pass this lat and lng to your GeoCircle or set this as maps initialPosition and initialZoom between 10-14.
It should work fine.
additionally, you can use spots instead of geocircle
Regards,
Vishnu
Hi Vishnu,
Thanks for your reply.
Till second point it's ok as I am able to get the latitude and longitude of reqired location.Can you please explain the 3rd point ??
Here is my approach which is not working. I am using below mentioned code in selectionChange event of combobox.
var geoMap=this.byId("vbi");
geoMap.zoomToGeoPosition("-73.985428;40.748817;5")
once this piece of code gets executed, map is vanishing and I can see only GeoCircles.
I tried following.This is also not working.
<vbm:GeoCircles id="GeoCircle"
items="{oModel>/CirclesGeoDist}"
click="onClickItem"
contextMenu="onContextMenuItem" >
<vbm:GeoCircle
position="{oModel>A}"
tooltip="{oModel>D}"
radius="{oModel>E}"
color="{oModel>B}"
colorBorder="{oModel>C}"
slices="{oModel>G}"
click="onClickGeoCircle"
contextMenu="onContextMenuGeoCircle"/>
</vbm:GeoCircles>
var geoCircle=this.byId("GeoCircle");
geoCircle.setPosition("-73.985428;40.748817;5")
Hi Sagar Patil,
I found the solution.
You are not calling the geocircle, you are calling its parent control.
There are 2 ways:
first method) instead of geoCircle.setPosition("-73.985428;40.748817;5")
use geoCircle.getItems()[0].setPosition("-73.985428;40.748817;5");
(or)
second method) set an ID to vbm:GeoCircle
in View,
<vbm:GeoCircle
id="circleposition"
position="{oModel>A}"
tooltip="{oModel>D}"
radius="{oModel>E}"
color="{oModel>B}"
colorBorder="{oModel>C}"
slices="{oModel>G}"
click="onClickGeoCircle"
contextMenu="onContextMenuGeoCircle"/>
in controller,
var geoCircle=this.byId("circleposition");
geoCircle.setPosition("-73.985428;40.748817;5");
I hope, this will solve your problem.
Additionally, instead of position, use your longitude and latitude which you have fetched from that google map api key
lng+";"+ lat +";0"
With Regards,
Vishnu
User | Count |
---|---|
74 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.