Azure Maps Line Layer and Pop Ups - azure-maps

I am creating a web page that has an Azure Maps control on it. The purpose of it being a sort of snail trail of movement. I have the map rendering and am using a LineLayer with a SymbolLayer in order to draw a line from point to point and then put an arrow on the line to show movement.
Another requirement is that we are able to hover over the points on the map to see information about that specific point, but I don't seem to be finding much online about "Points" on a line.
Any idea how to access individual points in the Linestring and add attributes to them in order to show a pop up?

To accomplish what you are asking you would need to have a second data source that contains the individual points with the attribute information, then connect this data source to a bubble or symbol layer. By doing this, you can add an event to that layer.
Another, less elegant approach is to have a property in your linestring that has an array of all the attribute information for each point. Then when the user hovers the line, loop through all points in the line and calculate the distance to each point from the mouse pointer location, use the index of the closest point to do a look up in your array.

Related

Is it possible to drag-snap a point of a shape being edited by the drawing manager to another shape's point location?

I'd like a user to be able to draw a polygon using the Azure Maps Drawing Manager and have the ability to move a point of the polygon to near one of another polygon's points and have the dragged point snap to the same location such that the resulting 2 points would be the same.
I know there is snap capability with a grid but don't see a sample for this behaviour?
The ultimate goal is to prevent polygon overlaps, assuming the intersecting shared line of adjoining shapes is excluded from determination of which polygon a point resides within.
I can allow a user to manually draw and get as close as possible of course, and provide some assertion to confirm no polygons overlap but would additionally like a nice snap-to-point experience if possible.
You can find hundreds of samples for Azure Maps here: https://samples.azuremaps.com/
As you noted, the snapping grid is likely the best place to start in your scenario. Here are some specific samples of this:
https://samples.azuremaps.com/?sample=use-a-snapping-grid
https://samples.azuremaps.com/?sample=snap-grid-options
The following sample is an example of a custom snapping scenario where the routing service is used to snap a drawn line to a route (the route part can be swapped out for custom logic): https://samples.azuremaps.com/?sample=snap-drawn-line-to-roads

Problem with Blenders Array Modifier to orbit or place in circular order (blender 3.0)

I was having the problem mentioned above and found that many of the tutorials are mentioning implementing the procedure on the centre of the canvas or world origin.
The question is how to perform that in any location successfully?
If you are familiar with blender the simple answer for you is - keep the Origins at the same place for both Centre and Orbital objects and make sure to apply the transforms.
For others-
Shift + Right-click to move the 3d Cursor to the desired location.
Create the Object that is to be Orbited or rotated.
Shape it as desired, then selecting that press Ctrl + A and press All Transforms,that will move it's origin to the world Origin, to correct that In object mode select the object and Rightclick then select Set Origin. and select the centre of mass to keep it in a visible field. (You can always edit your object in edit mode that will not destroy your array but minor modification will be required. ) (centring the origin isn't mandatory at this step, described to inform the process)
Place the 3d cursor at the point of the Orbital object from which it should face the centre. (to perform in complex object go to edit mode and select with vertex or edge or face selection and press Shift+S and select "Cursor to selected")
Having the cursor at desired point Create a cube or anything that will help to visualise the rotation. The cube will be exactly placed on the 3d cursor as well as its origin. Scale it as required. and apply all transforms as previous and reposition the origin to the 3D cursor.
Select the Orbital object and set its origin to the 3d cursor too.
If required provide some spacing to the Orbital object from the centre object (cube).
(but it will be helpful to visualize if you do that after creating the array, going to the edit mode of the orbital object)
Selecting the Orbital object assign Array modifier. Provide the desired number of objects under Count and make all axis of Relative offset 0 to get all orbital objects in the same plane. (relative offset comes pre-selected)
Tick Object Offset and with the Dropper select the Cube.
Now if the array doses strange things like the image below
It means either both of your Center and Orbital objects don't have origin At the same point (here 3d cursor) or You forgot to Apply the transforms for the objects.
Now you can rotate the cube to get the desired arrangement in circular form.
To provide the spacing from the centre object, go to the orbital object and press Tab for edit mode there selecting the original and move it along the upward axis allow you to have spacing. Because moving objects in edit mode don't affect the origin. that is still at the 3d cursor
Not only spacing you can do various formations rotating, moving the orbital object in edit mode.
Play with relative offset to get various looks.
The videos skim over setting origin and checking and re-checking transforms and origin points. This is a really important step and even following your detailed instructions it took a few tries to get it right.
This circular array modification is really tricky to get, but once learned it is a great tool for speeding up workflow.
Thanks for this

Accessing or omitting non-existing data

I'm performing some geographical computations in a grid with squares (i.e. regions). I'm using Delphi, but the logic could probably be applied to C++ too. Let me first explain what I want to do.
The following image is a portion of my grid, which is represented by a two-dimensional array Square that denotes the centre point in each square, and the "movement through the layers":
The green square has an X and Y coordinate of 2, so that is Square[2,2]. The actual coordinates are stored in Square[2,2].Latitude and Square[2,2].Longitude as wel as extra information in e.g. Square[2,2].Info that I use for computations.
Now comes the purpose: I need to do some computations on the surrounding areas. How many of the surrounding areas can be called "neighbours", depends on how many "layers" I have defined. In the image above, I used two of these "layers". That means that when starting from the green cell, I go around it once (blue arrows) and then again in the second layer (red arrows).
Now comes the problem: if I would have started in Square[1,1] (green square) instead of Square[2,2] as in the image below, the second layer (in red) would try to access data on the left side and at the bottom that does not exist (i.e. in the "-1" column and row). See the image below. This problem occurs at all borders of course.
I probably can make exceptions with IF-statements for every scenario, but I was wondering if there are common programming "tricks" that can handle such situations where you try to access data does not exist.
For example, I imagine it would be very handy if I can follow the pattern of the arrows depicted in the first image to access all the neighbouring squares every single time, even if there are non-existing squares. So, looking at the first image, after Square[3,0] you'd go to something like Square[3,-1] etc. and then eventually come back into the "feasible" zone in Square[0,3].
To visit neighborhood, you can use some kind of BFS (breadth-first search).
But for sparse structure (like the last picture shows) it is worth to use some data structure to organize cells in a good way. Perhaps kd-tree is suitable - you add all existing cells in the tree and make range search around given cell to get other cells in its vicinity.
Also look at another spatial data structures (see list at the bottom of kd-tree page).

How to find out if the surface detected by ARKit is no more available?

I am working on an application with ARKit and SceneKit frameworks. In my application I have enabled surface detection (I followed the placing objects sample provided by Apple). How to find if the surface detected is no more available? That is, initially only if user has detected the surface in ARSession I am allowing him to place the 3D object.
But if the user moves rapidly or focuses somewhere, the detected surface area is getting lost. In this case if the user tries to place another object I shouldn't allow him to place it until he scans the floor again and get the surface corrected.
Is there any delegate which is available to let us know that the surface detected is no more available?
There are delegate functions that you can use. The delegate is the ARSCNViewDelegate
It has a function that is renderer(_:didRemove:for:) that fires when an ARAnchor has been removed. You can use this function to perform some operation when a surface gets removed.
ARSCNViewDelegate Link
There are two ways to “lose” a surface, so there’s more than one approach to dealing with such a problem.
As noted in the other answer, there’s an ARSCNViewDelegate method that ARKit calls when an anchor is removed from the AR session. However, ARKit doesn’t remove plane anchors during a running session — once it’s detected a plane, it assumes the plane is always there. So that method gets called only if:
You remove the plane anchor directly by passing it to session.remove(anchor:), or
You reset the session by running it again with the .removeExistingAnchors option.
I’m not sure the former is a good idea, but the latter is important to handle, so you probably want your delegate to handle it well.
You can also “lose” a surface by having it pass out of view — for example, ARKit detects a table, and then the user turns around so the camera isn’t pointed at or near the table anymore.
ARKit itself doesn’t offer you any help for dealing with this problem. It gives you all the info you need to do the math yourself, though. You get the plane anchor’s position, orientation, and size, so you can calculate its four corner points. And you get the camera’s projection matrix, so you can check for whether any point is in the viewing frustum.
Since you’re already using SceneKit, though, there are also ways to get SceneKit to do the math for you... Working backwards:
SceneKit gives you an isNode(_:insideFrustumOf:) test, so if you have a SCNNode whose bounding box matches the extent of your plane anchor, you can pass that along with the camera (view.pointOfView) to find out if the node is visible.
To get a node whose bounding box matches a plane anchor, implement the ARSCNViewDelegate didAdd and didUpdate callbacks to create/update an SCNPlane whose position and dimensions match the ARPlaneAnchor’s center and extent. (Don’t forget to flip the plane sideways, since SCNPlane is vertically oriented by default.)
If you don’t want that plane visible in the AR view, set its materials to be transparent.

Intersected, buffered polygon - ArcGIS API for Silverlight

I am using Silverlight (4) to create an application in (VS 2010). I utilized the ArcGIS API’s for Silverlight to generate the following scenario:
I buffered a polyline to a variable distance.
I then retrieve all but only those polygons that are overlapped by the buffer.
I then intersect the overlapped portions to separate them.
Attaining the separated overlapped portions, I was about to utilize the Area and perimeter service to retrieve the areas of the portions, but realized that this last step would be in the wind.
I have no problem coding the above scenario except; I now realize that step 4 would not be very useful at this point, since I have no way of sharing data between the separated overlapped portions to the original polygons. Imagine if you will; before I separated the overlapped portions from the polygons, they had data tied to them; such as valuationNumber and volume, but after the separation due to the intersection service, the separated portions seems blank with no data. My goal is to have a list highlighting the valuationNumber, volume, and the area of the separated portion.
Something like:
Valuation:
12345678
Volume:
1234/123
Area of Separation (M):
12
Any, and I mean any help would be appreciated.
[copied and pasted my comments from above due to laziness]
Well then, I would suppose I created a work around, I wonder if there is a right way out there though. Anyhow, I did the following: I created a Dictionary Object and populated it with the Attribute values of the original polygon just as they are created. Then, just as the overlapped portions are being created I assigned the attribute values from my Dictionary. So, now the values match up, and all binding works just fine. But hey, if anyone know a better way; I'm all eyes.
In fact, to make matters seem a bit better, I made an improvement on the work around. I create a class with the fields I wanted to be in both original and separated portions. Then added this class as the value parameter of my dictionary object I spoke of earlier, then followed the same procedure. Now I have all the fields being mapped to in XAML working nicely (for now).

Resources