How to achieve swipe functionality that ignores nodata in "top" layer - dictionary

I want to compare a raster I made against Google's satellite basemap. I produced a georeferenced coloured TIFF with appropriately placed nodata where it should have. I then tiled this using gdal2tiles. When I overlay my custom TIFF on Google sat. map it works fine but my custom map is surrounded by a gray background instead of a transparent one.
I believe it's because swipe replaces the two layers altogether. Is there a way to achieve what I want properly?

You are probably using leaflet-side-by-side plugin?
In that case, and if you need the same background tiles in both sides, a very simple trick is to add that background Tile Layer to the map, but not to L.control.sideBySide. You can leave the left side as an empty array for example.
var backgroundTiles = L.tileLayer(backgroundTilesUrl).addTo(map);
// Tiles with transparent background
var customTransparentTiles = L.tileLayer(customTilesUrl}).addTo(map);
L.control.sideBySide([], customTransparentTiles).addTo(map);
Demo: http://jsfiddle.net/ve2huzxw/149/
If you need a different background tile layer on the right side (under your custom transparent tiles), simply create a new Tile Layer instance and pass an array of layers as 2nd argument of L.control.sideBySide.
Note: for some reason the left Tile Layer must be added last to the map.
var backgroundTilesRight = L.tileLayer(backgroundTilesRightUrl).addTo(map);
var backgroundTilesLeft = L.tileLayer(backgroundTilesLeftUrl).addTo(map);
// Tiles with transparent background
var customTransparentTiles = L.tileLayer(customTilesUrl).addTo(map);
L.control.sideBySide(
backgroundTilesLeft,
[
backgroundTilesRight,
customTransparentTiles
]).addTo(map);
Demo: http://jsfiddle.net/ve2huzxw/150/

Related

Add marker/dot on image at accurate pixel with zoom in/out functionality

I'am using reactJS and want to design a component with following functionality :
Display pixelated image which is able to zoom in and zoom out at pixel level.
When clicked on image , display a marker- which can be a dot or icon at specific position.
When image is zoomIn/zoomOut, marker size and position should not change.
Even after zoomIn/zoomOut when clicked on image, marker should get repositioned at proper pixel on the image.
I am thinking of applying same logic as used in the maps/ leaflet. Like they maintain separate layers for map and markers on the map. If we zoomIn/out maps it won't affect the marker position or size, same functionality I want for the image.
Anyone with the solution or related library will be welcomed !
(For reference, I want this design for marking GCP(Ground Control Points) on the image, which requires very precise marking at pixel level)

How to adjust overlay on polygon to left and right in openlayers

I have openlayers map with a polygon feature.
When we hover over the polygon, it displays the description in overlay.
However the overlay is always displayed on the polygon and not to left and right which is what I am trying to do. In doing so I juggled with css of overlay but couldn't come to the solution. There is leaflet bindPopup() method to display tooltip on objects added to map which I tried to understand but couldn't gain anything there.
My goal is to keep the overlay within the viewport of the map so that it would always be visible.
Just to illustrate what I am expecting here is the fiddle : leaflet popup
Current status : Openlayers overlay positioning
Just set the overlay to appear on the left of the extent of the polygon, such as:
if (feature && feature.get('type') == 'Polygon') {
var ext = feature.getGeometry().getExtent();
let coordinate = [ext[0], (ext[3]-ext[1])/2];
content.innerHTML = feature.get('desc');
popup.setPosition(coordinate);
}
Then you can play with the CSS to display the overlay the way you want.

How do i show a country map and make cities separate by changing color of mouseover

How do i show a country map and make cities separate by changing color of mouseover
I need an Idea how to do it like www.mudah.my site.
Basically how they (http://www.mudah.my/) do is by having 1 normal map image with no country highlighted (actually it looks like they use a couple images but make it like 1 image by placing a transparent div over the top of them).
They have a standard image map applied to this '1' image to define the separate areas and when the user mouses over a relevant part of the map they display a specify section of the highlight image (http://www.mudah.my/img/map_highlight.png) in a specific place on top the the existing image, but behind the 1 main transparent div. Presumably so the links associated with the image map) continues to work.
Hope this helps.

Is there an inverse to the CSS "Clip" property; hide the clipped area?

The CSS clip syntax gets you to define a rectangular area of a larger image that you wish to be visible. Is there a way to specify the inverse? Specify the rectangular area of the image that you wish to become invisible. Like punching a rectangular hole through the page to see what's underneath?
Reason (if you have any other ideas): I want to create a 3 layer image in a CMS template. Layer 1 (at the bottom) is a background image. Layer 2 sits over a portion of layer 1 and is a rectangular screengrab image of an A4 document. Layer 3 (on the top) is a transparent PNG (in its centre and at its edges) that adds a border, drop shadow, doc type logo and a page curl effect to the top right of the layer 2 document.
Layers 1 and 2 will be uploaded separately in the CMS and the CSS should combine them together with the layer 3 image to create the effect. The problem is for the page curl effect to work, the top right corner of layer 2 needs to be masked so that you can see all the way through from layer 3 to layer 1. I was hoping that the clip property would allow me to specify a small square in the top right corner of layer 2 that should be invisible.
Alternative: Is to use a graphics program to combine layers 1 and 3 together and leave a transparent area for layer 2. Then with the correct positioning you could place the new combined image on top of layer 2 to achieve the same effect. However, I was hoping to avoid graphics preparation like this because you may as well create the entire image that way.
Simple Answer:
CSS clip will not work for that.
I see two options:
Try to fake the 'hole' by drawing Layer3 with Layer1 as a background image. This will make the transparent areas of Layer3 be filled with Layer1. You can see this solution in action here: http://cssfilter.saschaseewald.com/
Use the HMTL Canvas Element and its composite actions to combine the layers as you like. Overview: http://www.html5canvastutorials.com/advanced/html5-canvas-global-composite-operations-tutorial/

How can i set size of openInfoWindowHtml in google Map

Please help me to change size of openInfoWindowHtml in google map and plez tell me can i make it popup out of map area also..? i mean my map area is very small but i want that when user click on Marker this openInfoWindowHtml should show popup and if its crossing size of map than its should show beyond the boundary of google map. ( i am working in asp.net)
There are 2 ways that you can influence the size of the InfoWindow. First, you can pass a GInfoWindowOptions object when you call openInfoWindowHtml (see: http://code.google.com/apis/maps/documentation/reference.html#GInfoWindowOptions) Second, you can wrap the contents of the InfoWindow in a div and use CSS to set the size of that div.
Regardless of which method you use to set the size of the InfoWindow, it can never exceed the bounds of the map canvas (area).

Resources