Display Image over map layer in GeoServer - image

I am newbie when it comes to GeoServer and trying to figure out if there is an easy way to display images on top of map layer.
A background: In my application, based on a search criteria, some polygons are drawn on the map. Each polygon has a corresponding image (in TIFF format) that is stored somewhere. I want to load the image on top of the map when the user zooms in to a certain zoom level.
I know this can be done using openLayers but since my images are in TIFF format, (openLayers is not able to render TIFF images as far as i know) i have to convert them to .PNG first which would be very slow considering the number of images i have.
Hence I was wondering whether it would be possible to create a image layer that would retrieve an image of a certain polygon at a certain zoom level. If so, could anyone point me to an example or give me an idea on whether this is possible.
I am using spring 2.5, tomcat 5, java 1.6 and geoserver 2.0
Thanks.

GeoServer's styling language, SLD, supports using an image file to provide the fill texture when rendering polygons. If the number of polygons that you want to handle is small, you could just set up a style rule for each polygon with its own image URL for the fill. Otherwise, I'd recommend establishing a formulaic mapping from data attributes to image URLs, and using GeoServer's dynamic symbolizer feature to reference the images.

Related

Add a masking overlay to highlight certain areas on an interactive mapboxgl map

I am building a website where users can search for specific places or areas on a map with some filters like "park", "supermarket", "cafe", etc. For example, a user should be able to find all suitable areas in a city that are near a park but also are at least 1 km away from a highway (for some reason). To do so, after the user has specified some filters, I want to add an overlay that masks all areas that don't satisfy these filters while still allowing the user to zoom and pan freely. I am using MapboxGL for building the map.
My first attempt was to use Turf on my geojson data to perform the necessary operations, i.e. converting the current viewport to a bounding box polygon, union all needed geojson features to one polygon and mask the difference between them and then simply add the result as a Fill-Layer on the mapbox map as seen in the image below.
While this approach does work for simple overlays it doesn't scale and needs a lot of time to perform the necessary operations on the data when used with a lot of geojson data and more filters.
Instead of working with the geojson directly I thought it might be better to use a canvas overlay and render the mask layer with webgl to improve the performance. I found a mapbox example for overlaying a custom style layer on a map, but unfortunately, I have never used webgl before and I'm not really sure how I would render such an overlay with this custom layer.
Is using a custom overlay with webgl the right approach to solve my problem? Or is there an obvious option (or another library) for this task I haven't considered yet?

Tensorflow Object Detection Issue

I am trying Tensorflow faster_rcnn_resnet101 model to detect multiple objects in a 642*481 image. I tried two ways but none got satisfactory results.
1) In this way, I cropped the objects (50*160 rectangle) from training images (training images might be at a different dim size than 642*481 test image). I use those cropped images to train the faster_rcnn_resnet101. Looks like it has good result if the test set is also a cropped image on the same size. But for the 642*481 test image, it could not detect multiple objects there with good results.
Then I think about maybe the model rescaled the test image to match the 50*160 so the details got lost. In this thought, I tried another way
2) I copied each cropped images into a 642*481 white background respectively (padding basically). So each training image has the same dim size as the test image. The location of the cropped images copied on the background is purposely set as random. However, it still does not have good detection on the test image.
To try its performance, I use GIMP to make windows that contain objects and replace other parts outside the windows with white pixels. The result is much better.
If we only keep one object window in the image and make other parts as white, the result is super.
So my question is what is happening behind those? How could I make it work to detect multiple objects in the test images successfully? Thanks.
The idea is that you should use training images containing multiple instances of objects during training. In other words, you don't have to crop ! Especially that your images are not very big.
However, you DO have to identify (label) the objects. This means to know the bounding box of each object in an image. Furthermore, this data should be assembled together with the original image in a tfrecord file. There is a good guide here with the whole process. In your case, you would label all objects in the source image (642x481), instead of just the "raccoon". If your objects have multiple classes, make sure you label them as so !
If you train with these images, which contain the objects in their contexts, then the network will learn to recognize similar images, which have objects in context.

THREE.js - Texture mapping requirements

Intro
I have a web service that returns a json result that contains an image path.
These images are not necessarily square images (e.g. 200px x 250px).
Problem
It seems non-square images are not supported for texture mapping. In order for the texture mapping to work I have to manually download the image, resize it, and use that image for the texture mapping (and it works).
Questions
A) Could there be a way to make three.js/webgl use non-square images for texture mapping?
B) Could there be a way to programmatically load & resize an image and subsequently load it for texture mapping?
Thanks all.
Possible Solution?
I found what could be a viable option. Let me know what you guys think of this.
Basically, I will load the remote image and draw to a Canvas element which is square in size. Then I can get the image from the canvas (.getImageData) and save it to my web server's image folder (if this cant be done then I can just keep the image on the canvas). Finally, load the image for texture mapping.
I know this is pretty vague and simplistic. But hey, simpler the better, right?
Will this work?
DON'T resize it in a non-conformal manner, just take a square section (e.g., if the image is 250 X 220, just chop out a 220 X 220 sub-image). The texture classification algorithm may very well depend upon angles and related features that your skew-by-resize may short-circuit.

How does conversion of a raster image to a vector image work, and could it be used in image processing

I am working on an image processing application, that uses pixel data to recognise digits in an image. I am thinking of an alternate approach wherein I convert the raster image to vector and then use the vector image. I am not familiar with vector graphics at all, and hence new to this, but just wondering the possibilities. Does anyone have any advice on this topic, or could direct me to some resources with similar approach ?
Also, could anybody tell me how does the conversion of a raster image to a vector image work, or provide me with related links ?

Create and layer pattern-filled, partially-transparent images; on-the-fly for a web page

The application has resemblances to this page, the best example being the "matrix hoop" tape style:
http://www.troohoops.com/products/decorator.php
The difference is that this example uses gif files that have already been manually drawn to represent each combination of tape style and swatch. My application requires the layers to be created on-the-fly because I will be dealing with many more of such tape styles rather than just five, and potentially more swatches; and because new tape styles will be added to the system ad hoc so the web operator should not have to draw dozens of images to represent style/swatch combination each time a style is added to the system.
Some ideas I have are:
using CSS and image masks and/or z-indexes... but this seems not able to handle transparency suitably
building a flash application... but this is an unknown as I do not have any flash programming experience, but I would be willing to learn if it is viable
defining polygonal image regions using XHTML image mapping as z-indexed layers and filled with repeated swatch thumbnails... but again this is beyond my understanding
using an image library that can process style layers as .svg files and fill vectored regions with swatches as .gif files
I have no evidence that any of these ideas works.
It is assumed that style layers can be created using software such as The Gimp, or other suitable image editing software.
My application also needs to produce a snapshot image of the selected style/swatches as a jpeg, gif or png; if another technology is required to do this then that's acceptable.
The final solution will also allow selection from a list of styles and swatches in the same fashion as the above link.
The solution will operate on a PHP/MySQL based web site, but the solution does not need to use PHP/MySQL.
Just to clarify the main question, the logic would go something like this:
Take square thumbnail of fixed dimension. I.e. a swatch.
Take outline of an irregular shape. I.e. one layer of a tape style.
Fill the irregular shape with the image of the thumbnail where the thumbnail is repeated vertically and horizontally without crossing the outline of the irregular shape and without leaving any of the irregular shape unfilled. I.e. fill the tape style layer with the swatch.
Repeat this process for five layers, but stack the layers on top of each other so that lower layers are visible where there is transparent unfilled regions of higher layers.
Produce a flattened snapshot of all the layers as a jpeg, gif or png file.
There is the equivalent of a carton of beer up for grabs for the outline of a solution, offered in the form of a PayPal payment; redeemable upon identifying a viable technology.

Resources