How to specify facilityId for a tileset in Azure IndoorMaps? - azure-maps

I've followed the Azure Indoor Maps Creator tutorial here but used a python script from another repository here to make it simpler to upload the map files. No PostMan required basically.
The sample wires up a levelchanged event handler and outputs the event data to console. The event's data for facilityId is always FCL13. I cannot find where this data is specified anywhere. Not in the python script, the sample data zipfile manifest.json, nor in the DWG files (with my limited ability to view those).
I assume I should be able to specify which facility I am uploading data for so would either expect the API calls to be provided this (from the python script), or it should be some metadata within the DWG files.
My intention was to upload more than one building's floor maps so need the facilityId to be configurable. Having specific tilesets associated to different facilityIds allows me to know which facility had its level changed during a levelchanged event.
Where is the facilityId data specified for a specific map data upload?

All Ids (facilityId, levelId, unitId, etc.) are generated when you create a dataset. These Ids are not meant to be set manually.
It is possible to list facilityIds loaded in the map, along with their names, address info, etc. that was provided in manifest.json.
Note: It looks like the 'indoorTiles' source lacks the getShapes() method so a workaround is required to query the underlying mapbox.
map._getMap().querySourceFeatures('indoorTiles', {sourceLayer: 'Indoor facility'});
From Mapbox's documentation on querySourceFeatures():
Because features come from tiled vector data or GeoJSON data that is converted to tiles internally, feature geometries may be split or duplicated across tile boundaries and, as a result, features may appear multiple times in query results.

Related

WordPress : make categories automatically match according to external API Value

I'm managing a company website, where we have to display our products. We however do not want to handle the admin edit for this CPT, nor offer the ability to access to the form. But we have to read some product data form the admin edit page. All has to be created or updated via our CRM platform automatically.
For this matter, I already setup a CPT (wprc_pr) and registered 6 custom hierarchical terms: 1 generic for the types (wprc_pr_type) and 5 targeting each types available: wprc_pr_rb, wprc_pr_sp, wprc_pr_pe, wprc_pr_ce and wprc_pr_pr. All those taxonomies are required for filtering purposes (was the old way of working, maybe not the best, opened to suggestions here). We happen to come out with archive pages links looking like site.tld/generic/specific-parent/specific-child/ which is what is desired here.
I have a internal tool, nodeJS based, to batch create products from our CRM. The job is simple: get all products not yet pushed to the website, format a new post, push it to the WP REST API, wait for response, updated CRM data in consequence, and proceed to next product. Handle about 1600 products today on trialn each gone fine
The issue for now is that in order for me to put the correct terms to the new post, I have to compute for each product the generic type and specific type children.
I handled that by creating 6 files, one for each taxonomy. Each file is basically a giant JS object with the id from the CRM as a key, and the term id as a value. My script handles the category assertion like that:
wp_taxonomy = [jsTaxonomyMapper[crm_id1][crm_id2]] // or [] if not found
I have to say it is working pretty well, and that I could stop here. But I will have to take that computing to the wp_after_insert_post hook, in order to reaffect the post to the desired category on updated if something changed on the CRM.
Not quite difficult, but if I happen to add category on the CRM, I'll have to manually edit my mappers to add the new terms, and believe me that's a hassle.
Not waiting for a full solution here, but a way to work the thing. Maybe a way to computed those mappers and store their values in the options table maybe, or have a mapper class, I don't know at all.
Additional information:
Data from the CRM comes as integers (ids corresponding to a label) and the mappers today consist of 6 arrays (nested or not), about 600 total entries.
If you have something for me, or even suggestions to simplify the process, I'll go with it.
Thanks.
EDIT :
Went with another approach, see comment below.

Rename salesforce columns from API_name to field label

When you use salesforce data that has being exported through any API, tables you get have column names in their "API_Name" format. This differs a bit from their "Filed Label" format in which they are presented on salesforce's web UI (for example on reports).
You can find what API name corresponds to any of the columns (objects) in the salesforce object manager.
My question is: is there anywhere a dictionary to map API Names back to their Filed Labels? It will be very helpful to have in JSON or anything that can be used programmatically.
It's called "describe" data. It's available for whole object (label, plural label), fields (label, picklist value translations), names of related lists.
In Apex this is a good initial reading: https://developer.salesforce.com/docs/atlas.en-us.200.0.apexcode.meta/apexcode/apex_dynamic_describe_objects_understanding.htm and for fields: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_fields_describe.htm
If you're using REST API - make GET to /services/data/v55.0/sobjects/Account/describe for example.
Have a look at https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_quick_start.htm too. For example if you need to build your own UI for "dependent picklists" it can be painful to read it all from "describe", https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_features_records_dependent_picklist.htm is bit better. And when you fetch records via this API you get fields as object with visible label and raw value (useful when displaying dates, numbers for example)

How can I make a photograph database that displays the results of a query as some kind of image gallery?

I am taking a database design class and for a project want to make a database of my mom's digital photos for her. I haven't dealt in application up to this point, only theory, but I have Access. Therefore, ideal answers don't suggest non-database solutions and don't assume I know much about actual database implementation. Solutions specific to Access could also be a plus. I hope that precursor saves some time and effort.
Theoretically, my mom wants to see all photos of pets from '05-'07 in raw format, and she enters an appropriate query. I suspect I can handle it up to there. However, at the moment, the best I can figure out to do is to return a column of either attachments or OLE objects. 5 clicks per photo is not ideal. I need a faster way to present the images. Opening them all in a grid of thumbnails or as a one-click-slide-show would seem the natural fit, but whatever works. How can I accomplish this?
Less important but worth consideration is the fact that, at some point, it would be great if this same type of system could be implemented on the internet for all of the family reunion photos she has taken, but I will take what I can get.
Use one form to get parameters for the query. then use another form(more processing) or report(if printing) to show the selected pictures. I will not cover passing parameters but here are some links.
https://www.fmsinc.com/microsoftaccess/forms/openargs/index.htm
https://learn.microsoft.com/en-us/office/vba/access/concepts/forms-design/apply-a-filter-when-opening-a-form-or-report
There is a complication, in Access pictures are usually stored in the attachment type. the attachment column can hold many pictures in each record. So if we have a table called Pictures with an attachment type column also called Pictures, then each individual picture is actually stored under Pictures.Pictures.FileData.
So to display the picture query we use a form/report with default view set to Continuous Forms (displays many records or in this case pictures on the same page) then in the details section of our Display form we place an attachment control and bind that control to our filtered Pictures.FileData.
Format and add functionality to taste.

Custom Activity Data Binding with Salesforce Objects

We can't extract data from the incoming Salesforce Object in the Journey Builder to the Custom Activity we made. We have already followed the syntax that was instructed in your documentation -> https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/how-data-binding-works.htm (under Event Context section).
We are primarily using Postmonger for our Custom Activity, and in our config.json under the inArguments, we input something like below to fetch the data from the Salesforce Object:
"fieldKey": "{{Event." + [ eventDefinitionKey ] + ".Task:Field_Name__c}}"
The eventDefinitionKey we get from the data loaded by triggering the requestedTriggerEventDefinition exposed by the Postmonger.
The resulting inArguments from above would be something like this:
"fieldKey": "{{Event.SalesforceObjacf28b016bf83c75b4926e0ec292eda5.Task:SMS_Content__c}}"
And based from the documentation mentioned previously, that syntax should be enough, yet we cannot retrieve it on our Custom Activity.
Another thing to note is that we can fetch information using the same syntax if the entry object is a Data Extension like below:
"fieldKey": "Event.DEAudience-e56d43c3-e2cf-60f1-fecd-ecf4d358d7b4.Field_Name"
The syntax above work which uses Data Extension is okay, but the one with the Salesforce Object does not.
What are we doing incorrectly here or is not possible entirely?
NOTE: the journey gets triggered by creating a task in Service Cloud
We put " around the eventDefinitionKey and the field name as well, and it works from Salesforce Data sources.
Something like:
"fieldKey": '{{Event."SalesforceObjacf28b016bf83c75b4926e0ec292eda5"."Task:SMS_Content__c"}}'
Note the switch to single quotes and how we're explicitly wrapping those inner attributes with double quotes
Update Oct 2020
Please see this post here which allows you to see the full merge fields of the entire Data Extension (no matter what type it is)

Is it necessary to record the image paths in the database when it is associated with a unique item?

In my web application, there are several classes whose instances need an image (i.e., photo). Each of these instances can have only one image. Currently, my implementation is that when user creates a new instance, I keep the name of the uploaded file as it is, and record it in the ImageUrl field of the associated table.
I feel like this is unnecessary. I can just rename the image with the unique url of the associated instance, and I can implement the programming logic accordingly. For example, if a user's id is 145, then I can record it with this name: profilephoto_145. Later, when I need to display the user's photo, all I need will be the id of the user. If user uploads a new file, I can just overwrite the existing file with the same name.
I wonder if this makes sense assuming each instance will have one associated image, and there will be no need to keep track of the previous files. What is the common approach for this? Should I keep the full path for each image and keep their original names, or should I implement this renaming files with ID?
I can just rename the image with the unique url of the associated
instance, and I can implement the programming logic accordingly. For
example, if a user's id is 145, then I can record it with this name:
profilephoto_145.
Yes, you can do that. The general search term for this kind of thing is "tight coupling" or "coupling and cohesion". The concept applies in lots of different areas of software development.
Your underlying idea is that you'll always store one profile photo per user, and you'll store it by concatenating "some kind of path" and "profilephoto_" and user's id. The main problem is that any change to that idea requires changing source code. And changing source code has ripple effects.
The common alternative is to store the image file's name in a database. In this case, most changes to that underlying idea would require only a database update.
Programmers who have been around a while cringe a little when people start using words like always and never. Because we know that, given enough time, statements that use always and never with respect to software are always never true.

Resources