Get values from geospatial image - geospatial

I have a Geoserver which serves WMS layers. I have a requirement where I select a location which has latitude and longitude and corresponding to the latitude and longitude I have to fetch the value from WMS layer. I am not able to find a solution to this requirement. Any help is highly appreciated.

The WMS spec provides a GetFeatureInfo request that allows you to query a point on the map, however it uses image coordinates rather than map coordinates (lat/lon). Provided that your image is reasonably small you should be able to get away with assuming a linear relationship between the two coordinate systems so by using the bounds of the map (which you know from the WMS request bbox param) and the size of the image (also part of the WMS request) you should be able to convert a lat/lon pair to an image coordinate (remember to flip the Y-axis though, as the image origin is top left).

Related

How to get Revit export image coordinates or reference point?

I want to have a reference point or to know the coordinates of any point on an exported Image (from any view) from Revit.
For example in the attached image exported from Revit, I'd like to know the bounding box of the picture or the middle point of the picture (in X,Y coordinates) or any other reference point.
Plan image
Is there a way to extract the bounding box coordinates of the picture?
I would suggest defining two diagonally opposite points in your image file that you can identify precisely in your Revit model. Determine their image pixel coordinates, export their Revit model coordinates, and use this information to determine the appropriate scaling and translation.
The RoomEditorApp Revit add-in and its corresponding roomedit CouchDb web interface demonstrate exporting an SVG image from Revit, scaling it for display in a web browser, and transformation and calculation of exact coordinates back and forth between two environments.

Convert geographic coordinates into svg coordinates

I want to build a Node JS application that generates an SVG image from geographic coordinates it fetches from overpass.
I tried to implement that by just using the geographic coordinates as coordinates for SVG paths, but the result looks distorted (it should look like this):
I assume the problem is that the earth is actually a sphere and there needs to be done some math in order to get a correct map projection.
What is the actual problem here? Are there any existing algorithms or libraries to cope with that?
The math behind this is called map projection.
Many online maps use the Mercator projection. The OSM Wiki has example code in various languages. I'm sure you will find more libraries on the Internet.

How to rotate an Image with nearest neighbor and bilinear interpolations without using any OpenCv library?

I want to know any basic mathematics based algorithm to rotate an image using the nearest neighbor and bilinear interpolation without using OpenCV library and imrotate.
The image won't be cropped after rotation and full image must be displayed.
A rotation corresponds to an affine transformation of the coordinates and is easily described using matrix/vectors. It is no great deal to find the formulas on the Web.
Now the important thing to know, is that rather than taking the pixels of the original image an mapping them to the transformed image, you must work backwards.
Scan every pixel of the transformed image and by applying the inverse transform, find the corresponding coordinates in the original image. You need to do this using real coordinates.
Then
for the nearest-neighbor method, round the coordinates and just copy the source pixel value to the destination;
for the bilinear method, consider the four pixels around the obtained coordinates (you will perform a truncation to integer). Finally, compute the destination pixel as a bilinear combination of the four source pixels, using the fractional part of the coordinates as the weights to perform the interpolation.
Check the figures here: http://wtlab.iis.u-tokyo.ac.jp/wataru/lecture/rsgis/rsnote/cp9/cp9-7.htm

Android- use image view as map and put marker at given x,y coord

I am a newbie in Android UI stuff. I tried looking for approach for going forward with this problem but could not get success, my apologies if this has been answered already.
I have a png image of a map, whose corner's points latitude and longitudes are known. Now given a lat long which lies inside the map, I want to put a marker on map for the given location say pointx. this requires two steps:
1. converting lat long to x,y for the pointx based on known point's x,y coordinates
2. drawing an image view for map and then putting the marker at the given x,y location
I can not use google maps here as the T&C doesn't allow. any pointers will be really helpful.

Converting from Latitude/Longitude to Cartesian Coordinates with a World File and map image

I have a java applet that allows users to import a jpeg and world file from the local system. The user can then "click" draw lines on the image that was imported. Each endpoint of each line contains a set of X/Y and Lat/Long values. The XY is standard java coordinate space, the applet uses an affine transform calculation with the world file to determine the lat/long for every point on the canvas.
I have a requirement that allows a user to type a distance into a text field and use the arrow key to draw a line in a certain direction (Up, Down, Left, Right) from a single selected point on the screen. I know how to determine the lat/long of a point given a source lat/long, distance, and bearing.
So a user types "100" in the text field and presses the Right arrow key a line should be drawn 100 feet to the right from the currently selected point.
My issue is I don't know how to convert the distance( which is in feet ) into the distance in pixels. This would then tell my where to plot the point.
tcarobruce,
You are correct. The inverse transform algorithm is what I needed. Since I use java I was able to replace my "home made" transform algorithm with the java.awt.AffineTransform object which has an inverse transform function.
This seems to have solved my issue.
Thanks.
I guess you are certain your users are always uploading a raster image that is in the lat/lon wgs84 projection? Because in that case you can set a fixed coordinate transformation.
If you consider ever digitizing images from other sources with other projections, you might want to take a look at the open source geotools library: http://www.geotools.org/

Resources