I'm looking for the best way(s) of getting the position of a point I touched on an image and get it's coordinates relative to the image size.
For example, I get, as the parent image, the map of a building floor. And the user need to be able to zoom in and point on the map a point that will be registered in a database in order to be retreived later.
I never really had to work with images and canvases on Android so I'm a bit confused. What might be the best approach. I already found a lot of document but couldn't find one that would fit the idea I need to develop.
Thanks in advance for you help,
Matthieu
Related
Im making an android project where I want to show to the user a map of a place (the place doesnt have any detail in google maps, just a vague outline). I have some physical architectual sketches of the place, that I scanned and cut a bit. Unfortunetly they still have a wide gap between the edges of the image and the actual lines of the sketch, as well as having potential distortions mainly from trimming it.
The main problem is that i can only get accurate locations (longitude and latitude) of some parts in the middle of the image (the lines themselves), and not the edges of it or the middle. When i come to put the image as a ground overlay, it only lets me input a center, a width (and maybe length) and a bearing. However, I have no idea how to transform those 4 co-ordinates into a center, width and bearing. can anyone from here help me with this?
I tried measuring the physical copies of the image with a ruler and doing some algebra but its very slow, prone to mistakes and i dont know if its that accurate. I thought to maybe put the cords manualy and showing the image to check if its allined and mess with it until it works, but when it tried implementing it i realirzed i dont know how to calculate the arguments needed (center width and bearing) from the cords.
i now think of maybe manually inputting the Anchor, Bearing and Width and checking that manually but It will be slow and tedius and very inaccurate, so hopefuly i can get help before too long.
some more info: i have a bird's eye view and GIS of the area but its a building with some floors so i can only know some locations on the outside. I dont know the locations of the bounderies since they are arbitrary on the sketch. I also have no real idea on what the orientation is, i really only have some Longitude Latitude pairs. They are also not rectangle, its just that i can ascosiate between them and certain points on the image.
I have been trying to achieve this for a long time. But not being able to. So I did really need some help here with this.
Current method - refer the below image
like you see above, , marker image is an ImageView and is properly placed so that the tip of the marker is pointing to the center of the screen. And fetch a latlon I will be reading maps idle or move state and will use the below methods to get the latlons.
googleMap.getCameraPositionLatitude();
googleMap.getCameraPositionLongitude();
But, the real problem is with the below format which I want to achieve. because this would improve UI/UX as the view is placed in a place where user can view the location clearly to which he is pointing to clearly(of-course the bottom part of the screen would be filled up with suggestions or any further changes that I think of).
Please refer the below image -
Here I am stuck. i dont find any methods that provide me latlon from that portion of the screen. I really need help from you guys to solve this. i want to pull the location from where the tip of the view is pointing w.r.t the second image (above image). if I use googleMap.getCameraPositionLatitude();
googleMap.getCameraPositionLongitude(); Which is in appropriate as it will get me latlons from center of the screen.
kindly help me out with this !
Thanks in advance :)
You can use Map Padding for that. With .setPadding() method you can move map center to position what you need. Also take a look at this question of David.
I'm looking for tips or a lib that can help me with this challenge: I need to build a widget that is similar to a Map View. I mean, I have a huge image that will be used as background and a list of coordinates that should be used as pins over the image.
I need to achieve an experience similar to a Map View (pan, zoom and pinch gestures) and treat pin clicks. Once placed over the image, a pin should note move its position considering the background image.
The problem is not really new, but I couldn't solve it yet. I've tried a WebView with some html but the image is rendered really blurry.
Any tip? Any Github project? I've googled a lot and found no answer.
I'm working on creating a mobile app which overlays images on top of a google map.
I have a large number of image overlays ('GroundOverlay' objects in KML-speak). I'm running into several issues (mainly performance) when the map is scrolled or zoomed
Having tried several options, I think my next approach will be to combine all the image overlays into one image beforehand, and then simply display that image as a single overlay on the map. Problem is, I'm not sure where to start.
Does anyone have any experience in combining overlay images?
I think there are two problems that need to be solved
1) Calculate the larger 'bounding box' that will contain the final image. I have the bounding box for each overlay ('LatLngBox' in KML-speak), and I think the final box can be calculated by simply examining the values of each LatLngBox and generating the final box based on the min/max values. Anyone have any insight as to whether this will work?
2) Merge all the overlay images into a single final image. I have no idea where to start here such here. Generating the actual image isn't the problem, but rather where to place each overlay (ie pixel level) so that the resulting image is accurate.
Any tips/hints would be greatly appreciated.
Thanks
the static overlay images can be combined and drawn. but the moving(regularly updated) overlay images would be an issue if you still want to combine them and post as one. the best option i believe would be to combine the static overlay resources and keep them in one set and other moving images drawn separately.
Managed to figure this out on my own.
Answer to (1): The technique I outlined in my question works perfectly
Answer to (2): You can convert between lat/lng and x/y pixels of an image as described here: Convert Lat/Longs to X/Y Co-ordinates
I'm loading floor plans into an Android application. I need the user to be able to identify problem areas on the floor plan with a single click. My thought process is to identify the click action, reload the html of the webview adding my marker asset to it at the specified location.
I've loaded the image into a webview to take advantage of zoom capabilities. I can get the X,Y coordinates of the webview where the click occurred, but I can't figure out how to get the current zoom level. Also, I'm not sure what math will be required to translate the X,Y,scale to actual pixel coordinates.
Is the webview the right view for me to use?
EDIT:
Using the link suggested below, I got the zoom functionality working. I still can't figure out how to place a drawable marker on top of the TouchImageView, much less get the coordinates that were actually touched on the image.
For your zoom question as well as coor, How can I get zoom functionality for images? should help you
The accepted answer does use a WebView, but the other answer uses a better approach for enabling zoom. It also provides the necessary math required for translating your X and Y coordinates into usable points.