Displaying static traffic flow in MapQuest, with Leaflet Plugin - static

I am not sure if MapQuest has an option for this, but I would like to be able to create a map with the Leaflet plugin where traffic flow is not in real time, so that I can only show static traffic for a specific time of the day. Is this possible, maybe with the update() method? From the little information they have on this method it doesn't seem as though static traffic can be displayed, but hopefully I am missing something...
This is the basic code snippet that enables traffic flow in the map, under the layer control:
L.control.layers({
'Map': mapLayer,
'Dark': MQ.darkLayer(),
'Hybrid': MQ.hybridLayer()
}, {
'Traffic Flow': MQ.trafficLayer({layers: ['flow']}),
'Traffic Incidents': MQ.trafficLayer({layers: ['incidents']})
}).addTo(map)

MapQuest's traffic api shows current traffic. Historic traffic is not currently offered.

Related

Looking to build a React Native Video Broadcasting app with a layer from a web endpoint, what's the best way to do this?

I have looked into some of the solution, the close one is
https://github.com/NodeMedia/react-native-nodemediaclient, though i am not sure how to add a layer using a web endpoint into this solution. Basically the broadcasting will be of a sport event with a layered scorecard in it. Example is like, when you'r watching a soccer game, you can see the current score in the layers.
Thanks in advance.

Relaxing GDS content security policy

I am trying to develop a visualization that relies on user-specific external graphics which are necessarily loaded from a remote source, but blocked by GDS's content security policy headers.
I'm looking for a way to stay within the CSP but still get the functionality I need. Are any of these things possible...?
Could I fetch graphical resources via a data source? (In which case I could build a custom data source connector that fetches the images and then feed those as a value into the visualization.)
Is there a valid way to load external resources of any type without violating the CSP?
Google's documentation suggests that they will relax their content security policy "in some cases." Is there an avenue to provide that?
Anyone who's managed to work around this, I'd appreciate some help figuring it out.
You can't make requests, but you can potentially render an svg/canvas image based on the data, so if you had the svg string of an icon as part of the datasource, you could render that.
2&3. There is no current way to make external requests without violating the CSP.

adding service worker to reactjs app

I'm about the create a small single page reactjs app that fetches data from 3rd API (let's say youtube videos, so those will be displayed). So I don't need any backend at all, but I'd like to make it offline first with service workers, so if there is no connection it will still display some cached data by default. For this I will use service workers, but don't really know if I have to add any other library or I can just use it right away.
Could somebody tell me what the best way is to implement this small offline-first react app?
If you're looking for a self-contained starting point, https://github.com/localnerve/react-pwa-reference looks promising.
If you're looking for a functional web app to draw some inspiration from, there's https://github.com/GoogleChrome/sw-precache/tree/master/app-shell-demo, which fetches information from the iFixit API, and is conceptually similar to a web app that would fetch information from the YouTube API.
(Just note that YouTube embedded video playback won't work offline, even with service workers.)

Segment.io and Mixpanel analytics to track activity of share plugin

What is the best approach to implement Mixpanel analytics for tracking share plugins.
Tracking third-party social network share plugins need a complex soultion and is possible if the social network API supports callbacks. Then you can catch them on your website and fire tracking events. That is the best and the most accurate method.
On the other side - if you use your own Share buttons - there are a lot of possibilities.
For Facebook - check this solution:
Facebook like and share button with callback
In function(response) you need to call Segment TRACK method.
Another solution I used in addition to the provider's callbacks when working with tracking iframes/javascript social widgets was:
https://github.com/finalclap/iframeTracker-jquery
pretty darn simple and nifty if you ask me!
jQuery(document).ready(function($){
$('.iframe_wrap iframe').iframeTracker({
blurCallback: function(){
// Do something when the iframe is clicked (like firing an XHR request)
}
});
});

Openlayers display Large data , browser issue

i have a map with large data set(more than 100k), with markers, and ma using Geojson format with cluster, and BBox strategy, [fetching geojson data through HTTP request on starting the page]
but my browser(IE7,8) has problem with large amount of data, its going stuck while processing the large amount of features and shows error message - Out of memory
is there any solution ?
please help...
Thanks in advance
Drawing 100k features on the client is not so good idea. Even "good" browsers will slow down attempting to render that much data. You have a couple of options though:
Generate images with data on the server side and serve tiles to the client. A WMS service is a way to go in this case and you can use Geoserver, Mapserver or other WMS-compliant map rendering engine. You can then use GetFeatureInfo requests to fetch attribute data for features. You can see an example of how it works in this OpenLayers demo
If you data is static and doesn't change much you can create tiles using Tilemill and then use them in OpenLayers as OpenLayers.Layer.TMS layer. You can then use UTFGrid tecnique to map attribute data to tiles. Here's an example of how it works.

Resources