How to configure GeoServer to use .mbtiles osm map with the mb styles (map box styles) - geoserver

I am setting up GeoServer v2.20 to use .mbtiles osm(OpenStreetMap) vector tiles map file with the map box styles (style.json). Able to enable the MBTiles Store and MBStyle options by adding the corresponding extension for MBTiles & MBStyle in GeoServer.
The map is getting rendered via openLayers and the url for the map will look like as below:
http://localhost:8080/geoserver/mydomain/wms?service=WMS&version=1.1.0&request=GetMap&layers=layer_group_name&bbox=2117772.049113751%2C8242859.778951772%2C3517794.983414251%2C1.1101207517961873E7&width=376&height=768&srs=EPSG%3A3857&styles=&format=image%2Fpng
The map is getting rendered, however the following issues are occurring in the configuration and display as :
When saving the MB style (In GeoServer -> adding new Style), not able to save the details for 'background' layer type, am getting the error "Layer background:This layer is not meant to be transformed, but converted in a Style background fill". Hence I need to remove this section, in order to save the style.
"layers": [
{
"id": "background",
"minzoom": 0,
"paint": {
"background-color": "rgba(239, 239, 228, 1)"
},
"type": "background"
}
May be because of this, in the Map view a lot of white color area is appearing for the map background with minimal zoom. But with maximum zoom level (17), am able to view most of the map information correctly.
There are lots of small red color square boxes are shown (as points) in the map. I guess its not able to get the correct styles/images for this points. In the MBStyle the 'sprite' attribute is specified as:
"name": "My custom map style",
"pitch": 0,
"sources": {
"openmaptiles": {
"type": "vector",
"url": "#maptiler-osm"
}
},
"sprite": "#",
"version": 8,
"zoom": 8.759936762170502
Is there a way to point to the local directory for the sprite files (.json & .png) ?
The same .mbtiles map file and the MB style are working fine with the MapTiler server, but not with the GeoServer as mentioned above.
Would be great if any configuration steps are available / or any directions to make this work.

Related

Kendo UI Grid - Checkbox filter issue

We are facing one issue with Kendo UI grid. (We are evaluating it, so no license copy as of now)
Scenario is:
We need to show data in Grid component.
For each column, we will have filter in form of multi select list box (see image attached).
We tried Kendo UI trial copy, and were successful to set data in it.
When we tried setting items in filter box, they appear to be blank.
Following is JSON which provides list of items in filter:
data which should be displayed in that dropdown list
[
{
"id": 67,
"name": "Investigation ESP"
},
{
"id": 88,
"name": "Refuse & Pickups"
},
{
"id": 101,
"name": "Dead Bug Removal"
}
]
Can you share proper example or point our mistake.
please try to combine the following two things...
http://demos.telerik.com/kendo-ui/grid/filter-menu-customization
http://www.telerik.com/forums/multi-select-with-checkboxes-plugin

Cropped layer in Kartograph.py for SVG maps

I'm trying to draw a SVG map with two layers using Kartograph.py.
The end result should be a single country on the first layer (say France) with the main rivers on a second layer.
The first layer with France borders works perfectly, but then I would like to add additional topological information on top of the map (say rivers). I have found the shapefile describing the rivers. However, when I add it in the JSON configuration file as shown below, the rivers are out of the country (but inside the square defined by the country, see image).
The documention of Kartograph mentions crop-to, but I cannot get it to work. When I add this option to crop the second layer to the first one, all the river data does not appear.
{
"proj": {
"id": "laea"
},
"layers": [
{
"id": "layer0",
"src": "FRA_adm2.shp",
"simplify": 2
},
{
"id": "rivers",
"src": "rivers.shp",
"crop-to": "layer0", /* This is not working */
"simplify": 0
}
]
}

How to save a real time flot chart as image?

I know that this type of question has been already made. I have seen answers on this topic, but I didn't understand actually how to save a flot chart as an image (png or jpeg). Bellow you have a print screen of my real time graph. .
When I click "Save Image As..." the photo which is saved is completely black. I tried many ways but none of them worked for me. So how could I save my graph as an image?
Here is an updated version of the fiddle you posted in the comments. Instead of generating an image and a PDF document after clicking a link, it creates the image directly after plotting the chart and hides the original canvas. Using "Save Image As ..." on the new chart works fine for me. The code:
$.plot($("#placeholder"), [{
label: 'Test',
data: [
[0, 0],
[1, 1]
]
}], {
yaxis: {
max: 1
}
});
html2canvas($("#placeholder").get(0), {
onrendered: function(canvas) {
document.body.appendChild(canvas);
$('#placeholder').hide();
}
});
When drawing a new chart (after changing the option or so) you have to show() the original container and remove the copy before calling html2canvas(...) again.

jsPlumb: Large endpoint to make touch easier

My implementation has two lists of elements and you basically connect items from the list on the left to items from the list on the right.
We have set the endpoints to be transparent so on the desktop it looks like you just drag from elements on one side to the other.
It works brilliantly on desktop but on touch devices we need the endpoint to cover exactly the space of the element it is attached to in order for it to work as the user would expect. So in effect the whole element becomes an endpoint.
I can achieve this by making the endpoint a rectangle of the same size and anchoring in the center, but I want to anchor on the right/left. If I anchor in the right/left, then my large endpoint is then half covering the element.
Is there a way of anchoring on the right/left but have the endpoint covering the element entirely? Or offsetting the endpoint somehow so it still covers the element?
Thanks in advance for any help
Btw jsPlumb is awesome
You can do it using a transparent image. I did it that way.
endpoint:[ "Image", { src:"/javascript/project/img/c.png",
cssClass:'node' } ]
If you use jsPlumb.addEndpoint() you can add additional parameters for each endpoint you create.
I got this code from one of the examples:
var exampleGreyEndpointOptions = {
endpoint:"Rectangle",
paintStyle:{ width:25, height:21, fillStyle: color }, // size and color of the endpoint
isSource:true,
connectorStyle : { strokeStyle: color }, // color of the line AND the arrow
isTarget:false,
maxConnections:20,
anchor: "BottomCenter"
};
var endpointOptions = {
isTarget:true,
endpoint:"Dot",
paintStyle:{
fillStyle: color // color of the end point
},
beforeDrop: function(info){
return handleConnectionDrop(info);
},
dropOptions: exampleDropOptions,
maxConnections: 20,
anchor: "TopCenter"
};
function InitContainer(el, data) {
elem = $(el);
jsPlumb.addEndpoint(el, {
uuid: elem.attr("id")+"sr"
}, exampleGreyEndpointOptions);
jsPlumb.addEndpoint(el, {
uuid: elem.attr("id")+"tr",
parameters: data // store data in the drain Endpoint
}, endpointOptions);
....
}
in this function I added two endpoints to one element, each with different attributes.
The actual problem you have is that the surface of the endpoint needs to be offset from it's position so that it is within the element. This is mentioned in the API docs, but I didn't find an example yet:
http://jsplumb.org/apidocs/files/jquery-jsPlumb-1-3-16-all-js.html#Endpoint.paint
You can change the position of a anchor, not only by the documented text (like "TopCenter") But also by a array:
anchor: [0.2, 1,0,1]
Give it a try, You'll be able to position the anchor relative to it's element

A control to optimize data entry

I was looking for a solution that
displayed multiple columns of independent data
did not require a click (or focus) to show the list
had a simple interface
supported visible & hidden values (like HTML's <select>)
has color highlighting to show matches
automatically deletes character entries that are not in any of the choices
I wasn't able to find a control that met these requirements, so I created one. Here is an image of the control in use.
The code to create this control is:
$('input#scrolltest').menuoptions({
"Data": { 1:"January",2:"February",3:"March",4:"April",5:"May", 6:"June",7:"July",
8:"August",9:"September",10:"October",11:"November",12:"December" },
"onSelect": function(mo, data) {
console.log(mo, data.newVal, data.type );
},
"InitialValue": { 'val': 'December'},
"Height": 200,
"Sort": []
});
This control is documented here
The above example is part of this demo page

Resources