-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GroundOverlay not working fine #273
Comments
Please provide your code sample calling the standard GroundOverlay, so that we can try to see if there is an issue. |
Hi. Thanks for your quick response.
This is the code sample calling the standard GroundOverlay.
groundOverlay = new GroundOverlay();
groundOverlay.setImage(ResourcesCompat.getDrawable(ctx.getResources(),
R.drawable.mapserv3857, null));
groundOverlay.setPosition(new GeoPoint(-35, -55.729193));
groundOverlay.setDimensions(2124236.699f, 1362392.436f);
//groundOverlay.setPosition(new GeoPoint(-34.9999999983557,
-55.7291930006203));
/* groundOverlay.setSouthOest(new GeoPoint(-39.9999999994056,
-65.2703644680108));
groundOverlay.setNorthEast(new GeoPoint(-29.9999999973059,
-46.1880215332298));*/
groundOverlay.setEnabled(true);
Utils.map.getOverlays().add(1, groundOverlay);
Thank you.
David E. Eduardo
2016-12-12 15:10 GMT-03:00 MKer <notifications@github.com>:
… Please provide your code sample calling the standard GroundOverlay, so
that we can try to see if there is an issue.
Note that GroundOverlay can be seen in action with the OSMBonusPack
tutorial project.
Note that osmdroid only supports WGS84 projection (as far as I know).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#273 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AXY9TcgeM9cEn2inyfJuJfMR2HY_Kiuzks5rHY4sgaJpZM4LKp7T>
.
|
And what is the issue? |
Hi. I was testing the following code to load a GroundOverlay, and the result is the one shown in the attached image. What could be the problem? **Location SO = new Location(LocationManager.GPS_PROVIDER);
|
Interesting one. I found 1 issue on your side, and one issue on mine. Your bug: your position longitude -55.729193 is not correct. The correct center between your east and west is: -55,7359447705546 My bug was inside GroundOverlay, about width/height computation, which was really weird. I just commited the fix. Now, once both issues fixed, it's better, but still not good. I still don't understand why. Putting some corrective coefficients on width and height can help:
|
I have the same problem my image is moved to the right. i tried with your corrective coefficients but it doesn't work. the center of the map is the same that the point i use in .setPosition. |
@be4r0 please provide relevant data/screen copy/code. |
Finally I did not use GroundOverlay. Sorry for not being able to help you.
2017-05-31 14:27 GMT-03:00 MKer <notifications@github.com>:
… @be4r0 <https://github.com/be4r0> please provide relevant data/screen
copy/code.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#273 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AXY9TRqruBwMtMautdjIKYTwDgMCBy3kks5r_aMKgaJpZM4LKp7T>
.
--
<http://www.r2software.net>
*David E. **Eduardo*
*Developer - r2 software*
*david.eduardo@r2software.net <david.eduardo@r2software.net>
**www.r2software.net
<http://www.r2software.net>*
|
Hi. I'm trying to load an image like GroundOverlay, but I can not get it to be located correctly. I tried to load both the 4326 and 3857 projections. Then create my own class that extends from GroundOverlay and reimplented the draw () method as follows:
Public class MyGroundOverlay extends GroundOverlay {
Private Point southOestPoint;
Private Point northEastPoint;
Private GeoPoint southOest;
Private GeoPoint northEast;
Public MyGroundOverlay () {
super();
SouthOestPoint = new Point ();
NorthEastPoint = new Point ();
}
Public void setSouthOest (GeoPoint southOest) {
This.southOest = southOest;
}
Public void setNorthEast (GeoPoint northEast) {
This.northEast = northEast;
}
@OverRide
Protected void draw (Canvas canvas, MapView mapView, boolean shadow) {
If (shadow)
Return;
If (mImage == null)
Return;
If (mHeight == NO_DIMENSION) {
MHeight = mWidth * mImage.getIntrinsicHeight () / mImage.getIntrinsicWidth ();
}
/ * GeoPoint NE = new GeoPoint (-29.9999999973059, -46.1880215332298);
GeoPoint SO = new GeoPoint (-39.9999999994056, -65.2703644680108); * /
Final Projection pj = mapView.getProjection ();
Pj.toPixels (northEast, northEastPoint);
Pj.toPixels (southOest, southOestPoint);
Point Average = new Point ();
Average.set ((southOestPoint.x + northEastPoint.x) / 2, (southOestPoint.y + northEastPoint.y) / 2);
/*pj.toPixels(mPosition, mPositionPixels);
GeoPoint pEast = mPosition.destinationPoint (mWidth / 2, 90f);
GeoPoint pSouthEast = new GeoPoint (-39.9999999994056, -46.1880215332298); // pEast.destinationPoint (mHeight / 2, -180.0f);
Pj.toPixels (pSouthEast, mSouthEastPixels);
* /
Int width = northEastPoint.x - Average.x;
Int height = southOestPoint.y - Average.y;
MImage.setBounds (-width, -height, width, height);
MImage.setAlpha (255 - (int) (mTransparency * 255));
DrawAt (canvas, mImage, Average.x, Average.y, false, -mBearing);
}
But still does not look good. Both images are loaded correctly in other programs like QGis.
I attach the images I am using.
These are the data used:
Center: -55.729193 Lng, -35 Lat
Width: 2124236.699 mtrs
High: 1362392.436 mtrs
NW Point: -29.9999999973059 Lat, -65.2703644680108 Lng
NE Point: -29.9999999973059 Lat, -46.1880215332298 Lng
SW Point: -39.9999999994056 Lat, -65.2703644680108 Lng
SE Point: -39.9999999994056 Lat, -46.1880215332298 Lng
Thank you!
Best regards
![mapserv3857](https://cloud.githubusercontent.com/assets/24526157/21104279/aeabe594-c064-11e6-8715-844e07919054.png)
![mapserv4326](https://cloud.githubusercontent.com/assets/24526157/21104280/aeb1cbe4-c064-11e6-8f32-4487b780e52b.png)
The text was updated successfully, but these errors were encountered: