How to use Google Maps with SAPUI5 GeoMap control - google-maps

I have an SAPUI5 app that needs to plot spots on a GeoMap control. It works fine, so long as I use HEREMaps as the provider. However, the company would like me to use Google Maps. I can't find any information out there about how to set up the MapProvider for the GeoMap control to use Google Maps.
Here is (essentially) my GeoMap control:
<vk:content>
<vk:ContainerContent title="Map" icon="sap-icon://choropleth-chart">
<vk:content>
<vbm:GeoMap id="GeoMap" width="100%" height="100%">
<vbm:vos>
<vbm:Spots
click="onClickItem"
contextMenu="onContextMenuItem"
id="caseTimeMapSpots"
items="{path: '/CaseEvents/results'}"
posChangeable="true"
scaleChangeable="true"
>
<vbm:items>
<vbm:Spot
id="Spot"
position="{Longitude};{Latitude};0"
tooltip="{EventName} - {path: 'EventDatetime', formatter: '.formatDate'} {path: 'EventDatetime', formatter: '.formatTime'}"
type="Warning"
click="onClickSpot"
contextMenu="onContextMenuSpot"
text="{EventName}"
scale="{path: 'DeleteInd', formatter: '.formatScale'}"
/>
</vbm:items>
</vbm:Spots>
</vbm:vos>
</vbm:GeoMap>
</vk:content>
</vk:ContainerContent>
</vk:content>
And here is where I set the MapProvider in my controller:
var oGeoMap = this.getView().byId("GeoMap");
var oMapConfig = {
"MapProvider": [{
"name": "HEREMAPS",
"type": "",
"description": "",
"tileX": "256",
"tileY": "256",
"maxLOD": "20",
"copyright": "Tiles Courtesy of HERE Maps",
"Source": [
{
"id": "s1",
"url": "https://1.base.maps.cit.api.here.com/maptile/2.1/maptile/newest/normal.day/{LOD}/{X}/{Y}/256/png8?app_id=XXX"
},
{
"id": "s2",
"url": "https://2.base.maps.cit.api.here.com/maptile/2.1/maptile/newest/normal.day/{LOD}/{X}/{Y}/256/png8?app_id=XXX"
}
]
}],
"MapLayerStacks": [{
"name": "DEFAULT",
"MapLayer": {
"name": "layer1",
"refMapProvider": "HEREMAPS",
"opacity": "1.0",
"colBkgnd": "RGB(255,255,255)"
}
}]
};
oGeoMap.setMapConfiguration(oMapConfig);
oGeoMap.setRefMapLayerStack("DEFAULT");
oGeoMap.setInitialZoom(13);
oGeoMap.setInitialPosition("-97.57;35.57;0");
Has anyone done this using Google Maps? How is the MapProvider set up?
Thanks.

Update
So I am finaly able to wrap this up. There is an official way to access googles map tiles directly using the Tiles API.
Following the guide in the link you could configure the MapConfig seen below with the URL from the Tiles API.
But this API is not available without a paid plan! (This plan runs about 10x as expensive then the JS API usage though) Due to this I will not follow up on this any further.
I am sorry this I still have not figured this out to the extend I'd like to. The following configuration is the most stripped down version that does the trick. The point here is that you need the url to directly get the map tiles. With X and Y specifying the tiles and {LOD} the level of detail. These parameters don't have to be replaced but will be set by the GeoMap control during run time.
The main reason I have not yet posted this is that - while it is working on a technical level - everything I have read so far indicates that accessing the tiles directly is against the ToS of Google Maps. So while it is working for fiddling around I would not use that in a production environment! Currently I am trying to find a way to clarify if there is something in the licensing to enable this use or if I am SOL.
Unfortunately the official API does not provide a way to request specific map tiles. Another way to figure this out would be to see if SAP can/does provide a different MapProvider implementation.
var oMapConfig = {
"MapProvider": [{
"name": "GMAP",
"Source": [{
"id": "s1",
"url": "https://mt.google.com/vt/x={X}&y={Y}&z={LOD}"
}]
}],
"MapLayerStacks": [{
"name": "DEFAULT",
"MapLayer": {
"name": "layer1",
"refMapProvider": "GMAP",
"opacity": "1",
"colBkgnd": "RGB(255,255,255)"
}
}]
};

Related

Drive API V2: Use Service Account to set useByDefault boolean for a specific app on a user's Google Drive

Is it possible to programatically set the useByDefault Boolean for an App on a user's Google Drive?
According to: https://developers.google.com/drive/api/v2/reference/apps I can List all Apps, or Get a specific App... I would have expected to see a SET command.
I'm a Google Super Administrator, and we have Read&Write for Google Chrome extension force installed for our students, but they still need to manually navigate to their drive settings and change the useByDefault checkbox before the extension can work properly with PDF files.
I've already created a working Service account with the following scopes: DriveService.Scope.Drive, DriveService.Scope.DriveFile, DriveService.Scope.DriveMetadata, DriveService.Scope.DriveAppsReadonly
I'm currently using C#.
The information on the extension we are using is:
"kind": "drive#app", "id": "982754197589", "name": "Read&Write
for Google Chrome™", "shortDescription": "Experience PDFs in a
whole new way with Texthelp’s new PDF Reader.", "longDescription":
"", "supportsCreate": false, "supportsImport": false,
"supportsMultiOpen": false, "supportsOfflineCreate": false,
"installed": true, "authorized": true, "hasDriveWideScope":
true, "useByDefault": false, "productUrl":
"https://gsuite.google.com/marketplace/app/detail/982754197589",
"productId": "ohfjebjepnlldifcbcfmopifaebcjehc", "openUrlTemplate":
"https://pdf.texthelp.com/pdfreader?state=%7B%22ids%22:%5B%22{ids}%22%5D,%22exportIds%22:%5B%22{exportIds}%22%5D,%22action%22:%22open%22,%22userId%22:%22110948624529639950901%22%7D",
"primaryMimeTypes": [
"application/epub+zip",
"application/pdf",
"application/vnd.google-apps.drive-sdk.982754197589" ], "primaryFileExtensions": [
"pdf",
"epub" ], "icons": [
{
"category": "application",
"size": 10,
"iconUrl": "https://lh6.googleusercontent.com/-eFdHkrx3NH8/VQ_ez9gL7sI/AAAAAAAABjo/qGf6VEFHbpM/s10-c-k/16.png"
}
I'd appreciate any insight on the matter.
Thanks in advance
There are only two methods for apps in google drive list and get. There is no way of updating these settings programmatically and as far as i can see these methods aren't available at all in Google drive v3.
I think your going to have to do it manually

Autodesk Forge - Extract geometry data from a 2D Cad Drawing using the modelderivative API

I am trying to extract data from a 2d Cad drawing. Essentially I would like to find the x/y coordinates of every element. However, the data does not show this information.
I am using the modelderivative/v2/designdata/{{urn}}/metadata/{{guid}}/properties endpoint to extract the data itself.
Here is an example of the output this gives
{
"objectid": 3308,
"name": "Text [67AC]",
"externalId": "67AC",
"properties": {
"AnnotationScaling": {
"Annotative": "No"
},
"General": {
"Color": "ByLayer",
"Handle": "67ac",
"Layer": "IMAGE-HYPERLINKS",
"Linetype": "ByLayer",
"Linetype scale": "1.000",
"Lineweight": "ByLayer",
"Name ": "Text",
"Plot style": "ByColor",
"Thickness": "0.000",
"Transparency": "ByLayer"
},
"Hyperlinks": {
"Description": ".\\R0010020.JPG",
"Name": ".\\R0010020.JPG"
},
"Misc": {
"Backward": "No",
"Upside down": "No"
},
"Text": {
"Contents": "R0010020.JPG",
"Height": "0.050",
"Justify": "Left",
"Obliquing": "0.000 deg",
"Rotation": "111.348 deg",
"Style": "Standard",
"Width factor": "1.000"
}
}
},
As you can see, there is no key 'Geometry'
Can anyone point me in the right direction on how I can extract the object positioning data for a 2d Cad drawing? Could it be that the drawing itself needs to implicitly set this information?
Here is an example of what I'm seeing in the Cad drawing itself.
Cad Output
There is no mention of the correct keys "Position X", "Position Y" in the modelderivative output above. Can anyone explain why this might be? Am I exporting it incorrectly? Or does Forge remove this information?
I am using PHP and getting the data server-side.
I exported another test model and found the following was generated
"Geometry": {
"Area": "1131855.821",
"Circumference": "3771.382 mm",
"Diameter": "1200.468 mm",
"Radius": "600.234 mm"
}
But there are no X/Y/Z coordinates in this data.
You can parse the individual primitives of your 2D drawing on the client side based on this blog post: https://forge.autodesk.com/blog/working-2d-and-3d-scenes-and-geometry-forge-viewer.
Parsing the drawing geometry on the server-side would be a bit more involved, since the file format used in Forge Viewer is not publicly documented. You could use tools like https://github.com/Autodesk-Forge/forge.commandline-nodejs, but I'm not sure if there are alternatives for PHP.

How can I retrieve the query key for Bing Maps API for Enterprise in an Azure Resource Group Template?

I am working on an ARM template that deploys an entire infrastructure from scratch:
The resource group
App Service plans
Application Insights
an so forth...
At some point I get to the part where I write the scripts for deploying my App Service (for hosting and deploying my web app later on) to my resource group. Prior to that I have my BingMaps API deployed in the same script.
I am stuck at the part where I am setting the Application Settings for my web app:
"type": "Microsoft.Web/sites",
"properties": {
"siteConfig": {
"appSettings": [
{
"name": "SomeKey",
"value": "SomeValue"
}, //rest of the code omitted
I would like to know how could I retrieve my BING MAPS query key within an ARM template?
I have tried, and have a feeling that this might be close to it, something like:
"value": "[reference(resourceId('Microsoft.BingMaps/mapApis', variables('bingMapsName')), '2016-08-18').queryKey]"
Anybody who has done this before? Many thanks in advance! Cheers
If you want to access query key in your ARM template for your web app setting, I would suggest you to use something like below:
{
"name": "appsettings",
"type": "config",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', variables('webSiteName'))]"
],
"tags": {
"displayName": "WebAppSettings"
},
"properties": {
"key1": "[parameter('AppSetting_Key1_Value')]",
"key2": "value2"
}
}
and then in your template.Parmeter.jso file , you can declare the key AppSetting_Key1_Value with the value of your Bing maps query key.
Specify the Parameter Value
After the Parameter has been added to the ARM Template and it’s being used to populate an Application Setting, the final step is to define the Parameter value within the ARM Templates Parameter file used for deployments. In the Azure Resource Group project template in Visual Studio the Parameters file for the default deployment is the file that ends with “.parameters.json”.
Here’s a screenshot of the “WebSite.parameters.json” file created in the previous articles in this series with the “AppSetting_Key1_Value” Parameter set to a value:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"hostingPlanName": {
"value": "WebApp1HostingPlan"
},
"WebApplication1PackageFolder": {
"value": "WebApplication1"
},
"WebApplication1PackageFileName": {
"value": "package.zip"
},
"WebApp_ConnString1": {
"value": "Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;"
},
"AppSetting_Key1_Value": {
"value": "Template Value 1"
}
}
}
for security complaint solution , you can move all your secure key and connection string to Azure key vault if you are not comfortable to have keys in param file.
This should work. Hope it helps.

Microsoft Academic API, Knowledge graph search -- retrieved paper empty

I'm using the graph search method of the Microsoft Academic API to retrieve papers by ID using the following query:
{
"path": "/paper",
"paper": {
"type": "Paper",
"id": [2557283755],
"select": [
"PublishYear",
"CitationCount",
"OriginalTitle",
"NormalizedTitle",
"DOI"
]
}
}
The issue I'm having is that for some papers the response is completely empty, even though when I lookup the paper through the user interface, it has full metadata. For example, trying to retrieve this paper through the API yields
{
"Results": [
[
{
"CellID": 2557283755,
"PublishYear": "",
"CitationCount": "",
"OriginalTitle": "",
"NormalizedTitle": "",
"DOI": ""
}
]
]
}
while for a different paper the response is correct:
{
"Results": [
[
{
"CellID": 2112796928,
"PublishYear": "1998",
"CitationCount": "135",
"OriginalTitle": "Gradient-based learning applied to document recognition",
"NormalizedTitle": "gradient based learning applied to document recognition",
"DOI": "10.1109/5.726791"
}
]
]
}
Does anyone have any experience with this? To me it looks like an error in the database, but I wanted to make sure it's not something related to my query. Thanks!
The issue is caused by data version difference. The version of the academic graph data set used by graph search method might not be the same as that of Microsoft Academic portal https://academic.microsoft.com. We are deploying a new data pipeline to make the version difference as small as possible.

How to search using the Citrix ShareFile API

I am using the Sharefile REST API for a project and have run into an issue. Their documentation is lacking and so far my 5 emails to the api# address have gone unanswered. Figured I would crowdsource this one...
What I need to do is search for a file by its name and it also has to have a specific parentID. I am following their documentation as best I can, but I still get a 500 error on the response.
According to their API documentation I have to post to: https://account.sf-api.com/sf/v3/Items/AdvancedSimpleSearch with the following post:
{
"Query":{
"AuthID":"",
"ItemType":"",
"ParentID":"",
"CreatorID":"",
"LuceneQuery":"",
"SearchQuery":"",
"CreateStartDate":"",
"CreateEndDate":"",
"ItemNameOnly":"",
},
"Paging":{
"Key":"",
"PageNumber":1,
"PageSize":10,
},
"Sort":{
"SortBy":"",
"Ascending":false,
},
"TimeoutInSeconds":10
}
The JSON post I am sending looks like this:
{
"Query": {
"AuthID": "",
"ItemType": "",
"ParentID": "xxxxxxxxxxxx",
"CreatorID": "",
"LuceneQuery": "",
"SearchQuery": "filename ='foo.png'",
"CreateStartDate": "4/2/2014",
"CreateEndDate": "4/4/2014",
"ItemNameOnly": ""
},
"Paging": {
"Key": "",
"PageNumber": 1,
"PageSize": 10
},
"Sort": {
"SortBy": "",
"Ascending": false
},
"TimeoutInSeconds": 10
}
They prefilled some properties in their example post so I replicated. I did also try sending only what I needed too (instead of the blank properties) but still get a 500.
I can upload files, delete, modify, etc all fine with no issues so I am certain it is something in this JSON structure. I think it comes down to the "SearchQuery" property. There is zero examples on their documentation site, and any libraries that were made 3rd party only show a "query" parameter being passed in with no example of what that looks like...
Try This:
{
"Query": {
"AuthID": "",
"ItemType": "",
"ParentID": "xxxxxxxxxxxx",
"CreatorID": "",
"LuceneQuery": "",
"SearchQuery": "foo.png",
"CreateStartDate": "4/2/2014",
"CreateEndDate": "4/4/2014",
"ItemNameOnly": ""
},
"Paging": {
"Key": "",
"PageNumber": 1,
"PageSize": 10
},
"Sort": {
"SortBy": "",
"Ascending": false
},
"TimeoutInSeconds": 10
}
In searchQuery we have to specify item name itself instead of filename='itemname'. Working for me :)
I've been trying to wrestle with this too. I am using the HTTPS API and not the REST API, but maybe the same argument will work? My client has specified PHP so looking at Sharefile's PHP sample code sharefile.php - you will see a search function with a "$query" parameter. After a few attempts I tried supplying this argument: '{Name="Agreements"}'. I think you might be able to generalize to more complicated searches. The PHP sample code does a http_build_query to convert the above to the usual HTML parameter string.