Exact code to load POI from local resource wikitude - wikitude

As i am using folllowing code to load POI fro local
requestDataFromLocal: function requestDataFromLocalFn(lat, lon) {
var poisNearby = Helper.bringPlacesToUser(myJsonData, lat, lon);
World.loadPoisFromJsonData(poisNearby);
/*
For demo purpose they are relocated randomly around the user using a 'Helper'-function.
Comment out previous 2 lines and use the following line > instead < to use static values 1:1.
*/
//World.loadPoisFromJsonData(myJsonData); This line show only one POI
}
};
And I am also seeking help to reload POI from local

Use callCavaScript to pass information to JS environment and urlListener (document.location = "architectsdk://") to pass information to native code.
Have a look at these samples for more Information
Retrieving POI Data from Application Model
Native POI Detail Page
Best regards

Related

Flask-Admin GeoAlchemy2 example doesn't show a map

I'm trying to run this example about how to use Flask-Admin displaying maps: https://github.com/flask-admin/flask-admin/tree/master/examples/geo_alchemy.
In README.rst, there's this instruction:
You will notice that the maps are not rendered. To see them, you will have to register for a free account at Mapbox and set the MAPBOX_MAP_ID and MAPBOX_ACCESS_TOKEN config variables accordingly.
I already have a valid MAPBOX_ACCESS_TOKEN, and I went to MapBox to look for a MAPBOX_MAP_ID. There I read that MAP_ID was deprecated, and now I'll have to obtain a tileset ID, and it's described as a label composed by <my_mapbox_user_name>.the_tileset_ID itself.
So I located the code as they described in the instructions (in my case, mapbox-streets-v8) and fulfilled the config.py parameters:
MAPBOX_MAP_ID = '<my_mapbox_user_name>.mapbox-streets-v8'
MAPBOX_ACCESS_TOKEN = 'pk.eyJ1...'
However, I couldn't see any map displayed or any error message.
How can I fix it?
I think there is a small bug in file Lib\site-packages\flask_admin\static\admin\js\form.js. The original URL generated to get a tile is:
https://api.mapbox.com/styles/v1/mapbox/<MAPBOX_MAP_ID parameter>/tiles/12/2258/2457?access_token=<MAPBOX_ACCESS_TOKEN parameter>
However, the correct one is:
https://api.mapbox.com/styles/v1/<MAPBOX_MAP_ID parameter>/tiles/12/2258/2457?access_token=<MAPBOX_ACCESS_TOKEN parameter>
That is, I had to remove the mapbox word from the URL.
To do that I made some changes in form.js file:
//var mapboxUrl = 'https://api.mapbox.com/styles/v1/mapbox/'+window.MAPBOX_MAP_ID+'/tiles/{z}/{x}/{y}?access_token='+window.MAPBOX_ACCESS_TOKEN
var mapboxUrl = 'https://api.mapbox.com/styles/v1/'+window.MAPBOX_MAP_ID+'/tiles/{z}/{x}/{y}?access_token='+window.MAPBOX_ACCESS_TOKEN
Then, it's working now:

syncfusion ej grid javascript method

I am very new to syncfusion controls for mvc. While exploring how to set dynamic datasource to grid, I came across this line of javascript code which I cannot understand. I have been through the javascript api docs for ej grid but couldn't find the meaning.
var obj = $("#Grid").ejGrid("instance");
If someone can explain the meaning and point out some reference documentation, I will be highly grateful.
The example I came across
https://help.syncfusion.com/aspnetmvc/grid/how-to
The javascript api I have been through
https://help.syncfusion.com/api/js/ejgrid#members:datasource
P.s: I know from a comment I came across that this has something to do with current instance of ej grid but I would like a solid understanding via a reference so I can understand.
From my little experience with Syncfusion controls the documentation explaining how to perform tasks is not well stated. If you have a license you can ask questions in their forum but I can tell you what little I learned perusing their forum.
In their JS 1 version
var obj = $("#Grid").ejGrid("instance");
and in their JS 2 version
var obj = document.getElementById('Grid').ej2_instances[0];
The variable obj appears to get an object reference to the grid identified by the id Grid. I am not sure what the instance value refers to other than the examples in the documentation show it and it works when it is used.
Not sure if I was much help.
In the Below code example Grid – Grid ID and you can take the Grid instance using the above code example. From the instance you can get the details regarding the column, dataSource, filterSettings, sortSettings etc currently applied to ejGrid. We have given support to customize the Grid using several public method. You can call those method by taking the Grid instance.
#(Html.EJ().Grid<EJGrid.Models.Order>("Grid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.AllowPaging()
.Columns(col =>
{ col.Field("OrderID").HeaderText("Order ID").TextAlign(TextAlign.Right).Width(75).Add();
col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(90).Add();
col.Field("Freight").HeaderText("Freight").Format("{0:c}").TextAlign(TextAlign.Right).Width(90).Add();
col.Field("ShipCity").HeaderText("Ship City").Width(90).Add();
col.Field("Child.Test").HeaderText("TEst").Format("{0:c}").Width(90).Add();
col.Field("ShipCountry").HeaderText("Ship Country").Width(90).Add();
})
)
<script>
var obj = $("#Grid").ejGrid("instance");
var value = $("#colValue").val();
//Add custom parameter to the server
var query = new ej.Query().addParams("EmployeeID", value);
//Creating ejDataManager with UrlAdaptor
var dataManager = ej.DataManager({ url: "/Home/GetData", adaptor: new ej.UrlAdaptor() });
var promise = dataManager.executeQuery(query); promise.done(function (e) {
//Assign the result to the grid dataSource using "dataSource" method.
obj.dataSource(e.result);
</script>
To update the Grid, you can use dataSource() method. To call that method you need to take the Grid instance and call that method.
Refer the below API documentation for your reference
https://help.syncfusion.com/api/js/ejgrid#methods:datasource - used to update the Grid dataSource dynamically
https://help.syncfusion.com/api/js/ejgrid#members:datasource - returns the Grid dataSource.
Please get back to us if you have further queries.

Mapbox GL JS - possible to get the street name for a specific lng/lat?

I have a Mapbox GL JS implementation that gets its data from a vector mbtiles file that I downloaded from www.openmaptiles.com. I use tileserver.php with the mbtiles file to serve the PBF data, which Mapbox GL can use to display the map.
Is there any way to extract data from this in a specific area or lng/lat-pair using Javascript ?
Once you have added your sources to a Mapbox-GL-JS map and created a layer ("roads", say) that references it, you can use map.querySourceFeatures() to get features at a given screen location. To turn a lat/long into a screen location, you need to use map.project().
So all up:
var features = map.queryRenderedFeatures(map.project([mylng, mylat]), { layers: ['roads'] });
var p = features && features[0] && features[0].properties;
p now contains the properties of the object at that location.

Use topoJSON in Leaflet map

I'm learning how to use Leaflet to make online interactive maps for public health purposes (experienced ArcGIS user, Mapbox TileMill). I'm taking it slow so I understand each piece of code, and I'm working from the Leaflet choropleth example as I want to make choropleth maps. The current task I'm stuck on is how to correctly add topoJSON data to a Leaflet map. I've tried the following code to convert the us states geoJSON to topoJSON, but it hasn't worked. Any suggestions?
var geojson;
var test = topojson.feature(us-states-topo, us-states-topo.objects.layer1 );
geojson = L.geoJson(test, {
style: style,
onEachFeature: onEachFeature
}).addTo(map);
I've reviewed the topoJSON API reference, but I'm sure I must be making a simple error as I am a beginner to JavaScript in general. Thank you all for your help!
Best
Eli
I'd recommend using your browser debug tools to start through debugging this.
var test = topojson.feature(us-states-topo, us-states-topo.objects.layer1 );
This is not valid JavaScript: us-states-topo is not a valid variable name, since -s are not permitted.

Balloon flyto Google Earth API

In my KML I have an aggregate of placemarks in a table format. When you click the placemark you can see all the placemarks currently being loaded. Each of the placemarks have an id like below
<Placemark id="Location1">
When I add the following below I am able to fly to that balloon and it will open. However in the API this function does not work. It tries to do the following http://www.something.com#ballooonFlyTo is there a way to allow the balloon fly to method in the API?
<a href="#Location1;balloonFlyto>Location 1</a>
Not directly no, but it would be easy to modify your links to call a custom function that will support the behavior you require.
Also, if you are loading your features via kml rather than creating them programmatically then you would need to supply the full path to the kmlFeature - not just its ID. i.e.
http://somesite.com/my.kml#Location1 rather than just #Location1 - where http://somesite.com/my.kml is the file that defines the feature with the id Location1.
If you have something like the following javascript method it should work as expected. That is it will fly to the view and open a feature balloon. (This is presuming ge is the google earth plugin in your application and that the placemarks have abstract views defined).
// Attempts to find and element by ID,
// fly to its abstract view and open a feature balloon for it.
var flyto = function(id) {
var placemark = ge.getElementByUrl(id);
if(!placemark) {
return false;
}
if (placemark.getAbstractView()) {
ge.getView().setAbstractView(placemark.getAbstractView());
}
var content = placemark.getBalloonHtmlUnsafe(); // or getDescription()
var balloon = ge.createHtmlStringBalloon('');
balloon.setFeature(placemark);
balloon.setContentString(content);
ge.setBalloon(balloon);
return false;
};
Then you can simply modify your links to call the flyto function passing the desired id. e.g.
Location 1
If your placemarks do not have abstract views, then you would have to do something like extracting the point geometry and then create a lookat or camera using the latitude and longitude data to set the view.
EDIT
I decided that this functionality was really cool, so I have put together an example that does not require any special mark up of the links at all. When kml links containing a command are clicked the plugin behaves just like the full Google Earth Client would.
Here is a fully working example.