Is FeatureCollection necessary for ol.layer.VectorTile layer in openlayers? - openlayers-3

I am looking to create a ol.layer.VectorTile layer from an array of GeoJSON Point objects in ol3. Right now the data that is being returned to me is an array of objects, with each object being a GeoJSON of type "Point". In examples I have seen, VectorTile layers were created from a "FeatureCollection" which contained all the Point objects as features. I am wondering if the api would need to return the data as a "FeatureCollection" or I would need to create one myself from the data being returned, in order to ultimately be able to create a vectorTile layer?

Your api just needs to return the geometries(ie. point,line, polygon). It could be in any parsable format like GeoJson/WKT.Then create OL3 feature from the geometries returned by your API. Create an instance of ol.Collection. Then add each feature in the newly created collection. And use this featurecollection as a source in a vector layer.

Related

How to render a scene with multiple hierarchy objects in DirectX11?

This might sound a dumb question but I am trying to understand the basics of 3d game programming and wanted to know this thing.
I have looked at the samples here https://code.msdn.microsoft.com/Direct3D-Tutorial-Win32-829979ef and I get it how each object's vertices and indexes to those vertices are stored in vertex buffer and index buffer respectively.
What I want to understand is how would I render a scene where I have multiple objects ? How should the vertex and index buffers be set? And how should a draw called be implemented ?
A reference or an example will help please.
To elaborate on Chuck's link, the process by which you will render multiple objects will vary depending on the architecture you choose to use.
Every model is divided into a number sections equal to the number of textures/material combinations it has. Each of these sections consists of a unique texture/material combination and will have its own vertex/index buffer pair.
The reason for this is because the HLSL is primarily designed to operate on a single texture and material at a time. You bind the vertex and index buffers of a single section to the pipeline along with the corresponding texture/material, perform a draw call on it, then bind the buffers/texture/material for the next section until the whole model has been rendered.
The cool part is that you only need to load a model once. As long as you have the information for that model, you can create instances of the model using the same data but different position matricies. This lets you create hundreds or thousands of copies of an object.
My scratch codeed engine handles models like this: during initialization, a model manager class is used to load in all the different models I use and store each unique model into a model class. I then take a pointer to the model class and feed it into scenery managers which give information on what contexts the model appears in. When I populate the game world with scenery, my game tile uses a scenery list class to handle a list of instance structures and render lists. The instance structure holds information such as position/scale/orientation, an AABB, and a pointer to the model class. Each frame, I frustum cull the scenery and populate the render lists with only the instance structures of potentially visible objects and produce an instance buffer for each list to contain the positional information. Then, I can loop through each render list, assign the appropriate buffers and textures, and draw indexed instanced() to render all the copies of the model section.
I'm not sure how my process compares to other engines, but it should serve as a reasonable example of how you might handle multiple objects and then multiple instances of objects. The levels of abstraction I have in my process were chosen due to how my engine works (random world generation). The exact method you use will vary based on your application.
Here is a basic diagram showing a fairly bare-bones set up:

Coredata performance: is there a penalty for loading many individual entities?

I'm working on an app that will include a set of points drawn from CLLocationManager and draw them on a map. I'll never really have a need for each point as an individual entity, they only have meaning in the context of the path.
Instead of creating a model representing the points, I could just store the path as a big JSON (or other more efficient string format) and thereby read only the single entity when it's time to pull the data out. It seems to me this could save overhead, is that true?
This is something that would need some testing. Finding the path directly which contains the points is probably a faster way then fetching all the points which correspond to a certain path but the part with writing them into strings seems a bit off. Parsing those strings will be slow. (JSON being a string).
For saving the points into paths I would suggest either to also add the point entity which is then linked through reference to the path. An alternative would be to use transformable data; Your point will be represented by 2 or 3 double values which could be put directly into a buffer (NSData for instance). The length of the data saved then defines the number of points as data.length/(sizeof(double)*dimensions). This would be extremely easily done in ObjectiveC while in Swift you may lose some hair when working with raw data and unsafe pointers.
It really depends on what you are implementing but if you plan to have very many paths in the database you can still expect a large delay when fetching the data. You might want to consider creating sectors. Each sector would be represented with the same data as the region (MKCoordinateRegion) where on database initialize you would iterate to create sectors for the whole earth. Then when you are inserting paths you check what regions the path intersects with and assign the path to those regions (many-to-many relation). Now when you show the map you check what regions are visible and fetch only those regions and then extract paths from them.

store a hash-map continer type of data on edge of neo4j

I want to store lots of data into buckets or different hash-maps between two nodes on their edges. Basically there is lot of data getting generated related to the two nodes and i want to keep the data over their edge in a hash. Since the context matters, the edge should have different buckets/hasmaps so that i can write data into and return data from the data written over the edges. How to do this in neo4j, any reference articles please.
Consider that properties are already an hash map key/value. Regarding the context you can have multiple edges between two nodes one for each context. If the contexts are limited and pre-defined you can use a specific name to the relationship that identify the context, otherwise you can add a 'context' property that allow you to identify the context.
How much data do you plan to store? How many keys in the hash map?

CoreData. How Do I Seed My Data Model from an XML File?

In general I am warming to CoreData but I am currently spinning my wheels on how to seed my data model which is a cyclical object graph from a XML file with is a plain ole a-cyclical data graph.
Specifically, I have this - contrived - cyclical pattern in my data model:
A.b ----------------> B
B.a ----------------> A
A.widgets ------->> Widget
Widget.a ---------> A
B.widgets ------------->> Widget
Widget.b --------------> B
My XML file is loosely related to the data model so I need to do some re-mapping/futzing to parse its data in the data model but that is not the heart of my problem. I am struggling with how to handle the cyclical nature of the data model graph. How do I knit the entities together properly, robustly? There is no "root" to the object graph so an obvious traversal is not clear.
I have solved this for various xml and json loading needs but have not made a generalized solution.
Render this cyclical graph as a tree with a root. Choose the root in a way that makes sense for your application.
Uniquely identify each node that will be referenced.
Refer to each node that is not below the current node(the cyclical parts that the tree broke) by using its identifier. Add that "soft link" to the model as well.
Map identifiers to objects in a dictionary while loading and creating them.
After completely loading the initial tree, iterate through your model in the same fashion as your xml tree to resolve soft-links. Load the objects they refer to from the dictionary and assign them in the model.

JUNG - How to get the exact vertex in Graph?

I have to create a graph with its self-defined node type and the nodes & connections are read from a txt file one by one.
The file format is like this: startNode attibutes endNode.
Every time I read one line, I created 2 node objects: startNode & endNode. and add edge between them..
However, the startNode may exist in several lines..
e.g. V1 ... V2 ; V1 ... V3
Therefore, I have to check whether my graph has contained the node before I add edges..and I should use the vertex in graphs instead of the node newly created..
Does jung have any built-in method to solve this problem?
Or any suggestions?
The short answer is: by contract, JUNG's graph implementations take care of this for you, as long as your custom node/edge objects' implementations of equals() and hashCode() do the Right Thing.
If you try to add a vertex to a graph and it's already present in the graph, the addVertex() method will return false (meaning 'nothing done') just as with the analogous add() method in Set.
Also note that the addEdge() methods will add the connected vertices to the graph for you if they're not already present.
JUNG considers the vertices (and edges) different as long as they are referenced to different objects. If you create two vertex objects with same properties, they will be considered as different vertices and you will be able to insert both of them into the graph. JUNG doesn't have an equals method that you can override (to check the vertex object's properties) to perform a check whether two vertex objects are the same or not. Therefore you need to manually maintain the list of vertices (and edges) in your graph to avoid adding a vertex you already have in your graph. However you can easily do that with a HashMap (if your graph is not too big).

Resources