How can I display text labels for the features of a geojson layer in Openlayers 3 while using WebGl renderer? - openlayers-3

I'm able to create a style in Openlayers 3 for a vector source.
The style is meant to display one of the attributes in text format for all the features in the vector source.
The map perfectly displays the points along with the text except for when I switch to WebGl renderer..
I receive the following error:
'Uncaught TypeError: a.Tb is not a function'

WebGL support for text rendering was added in 4.3.0 and 4.3.1

Related

THREE.js glTF loader (binary) does not display vertex colors?

I have a model with precomputed vertex colors. If I generate glTF file and load it using THREE.GLTFLoader, I can call scene.overrideMaterial = new THREE.MeshBasicMaterial({vertexColors: THREE.VertexColors}) to convert the default material from MeshStandardMaterial to MeshBasicMaterial. The precomputed colors are then displayed correctly.
If however I generate a binary glTF (*.glb) file and override the material properties, I have to call scene.add(new THREE.AmbientLight(0xffffff) to add ambient lighting to the scene; otherwise, the display is black.
Is this a deficiency with glTFLoader, or am I (more likely) missing something?
Your first example (replacing the original materials) appears the way you expect because THREE.MeshBasicMaterial is an unlit/shadeless material type. From the three.js documentation, it "is not affected by lights", and doesn't require lights to appear onscreen.
When you don't replace the material, the default material created by THREE.GLTFLoader is usually THREE.MeshStandardMaterial, which is a physically-based rendering (PBR) material. Because it is physically-based, it requires lighting to appear onscreen. For best results, especially with metallic materials, you may need an environment map for realistic lighting.
It's also possible to create a glTF model that contains unlit materials (or THREE.MeshBasicMaterial) by default, but based on the results you describe it doesn't sound like your glTF model was authored that way.

Drawing custom data-based shapes with mapbox

I have been tasked with drawing complex custom shape using mapbox-gl iOS library. The backend created using mapbox-gl-native codebase (as well as custom iOS SDK) provides the data on where the shapes should be drawn and what data should be displayed.
My initial thoughts are on implementing the drawing in mbgl-core library where the library fetches the style and parses out the parameters of layers. However I was unable to find any documentation on this topic.
So my questions are where should I be looking to write the code that does the drawing (presumably in C++ using OpenGL) and where is the code that parses the fetched style and layer parameters?

replacing an existing color by a new one in an image with iOS

Let's say I have an image with a few colors.
I would like to replace programmatically a specific existing color by a new one.
(something simple, no need to support gradients, like I saw elsewhere).
E.g. I have an image showing a green circle and I want to display it as a red circle (every pixel initially defined with a given (R,G,B) is now displayed with a new (R,G,B).
Any idea of how to do that with the Apple ios SDK ? (or open source ...)
And btw what would be the best image file format to make this easier (png, jpg ....) ?
Thanks !
You should be able to do this using Core Image filters. the Color Cube CI filter lets you map a source color range to destination colors. You should be able to define a source color range and map it to different colors.
That's one CI Filter I didn't figure out how to use however. If you do a search on "Color Cube" in the Xcode help system there is sample code that does a "chromakey" effect that knocks out green shades to transparent. You should be able to adapt that to your needs.
I have a project on Github called CIFilterTest that shows how to use Core Image filters to process images. It's written as a general-purpose system that lets you try a wide variety of filters that use a standard set of parameters (points, colors, 1 or 2 source images, and floating-point values.) I never did take the time to generate the 3D color mapping "cube" that the color cube filter needs as input, so it doesn't allow you to use that particular filter. You'll have to look at the color Cube sample code in the Xcode docs to generate inputs for the Color Cube filter, but my sample app should help a great deal with the basic setup for doing CI based image processing.
answered similar question here:
Replace particular color of image in iOS
in short: I would suggest using CoreImage filter.

How to add point images to a map using javascript?

I am using highcharts map and would like to add point location on it using real coordinates. How can i do this in javascript any links? or any suggestions of customizable map that allows me to enter images as locations?
You can catch click event on the chart, then you get coordinates for particular point (x/y). Last step is using it in data.
Example: http://www.highcharts.com/maps/demo/mapline-mappoint
Another way to approach this would be to import the GeoJSON file ("fr-all-mainland.geo.json") in a compatible editor (for example QGIS) and plot the cities there, then inverting the y-coordinate. This would be similar to plotting the cities in Inkscape, except you would be working with the GeoJSON file instead of the SVG.
Please visit the related topic: http://highcharts.uservoice.com/forums/55896-general/suggestions/5780574-add-ability-to-plot-points-based-on-longitude-lati

rmagick or other library for producing 3D pie chart

I am interested in making a 3D pie chart dynamically on my page depending on values pulled from my database. The chart would only be updated every few days, so I don't mind a process intensive task as I could cache the image. 2D charts and pie graph libraries seem to be everywhere, but are there any libraries (server side image magic, or client side javascript) that generate decent looking 3D pie charts?
Extra points if it integrates easily into Ruby-On-Rails.
An example of the type of chart I am looking for can be found on the bottom of this page.
I made this flash based plugin that supports Pie 3D, it's not rmagick, but it's easy to use and setup with Rails.

Resources