I have a map of Brazil composed of about 5000 polygons that each represent it's cities.
Although they share points, they are each their own polygon.
The problem is, that when i draw them all, they form holes in between them, which i assume comes from rounding errors, since these holes disappear/move when zooming/moving the camera.
The problem is even worse when the map is zoomed out.
How do i solve this kind of problem in GLES2.0 (Android)?
Unfortunately i can't enlarge each polygon, and although i could fuse them all into a 'Brazil' polygon and draw it below them, i'd rather avoid doing so since the frame rate is already lower than what i need it to be.
I also tried to add 'precision highp float;' to the start of the shaders, but that didn't change a thing
Two images to illustrate the problem. The first is the zoomed in map, and the other is a zoomed out map, both images are cropped to show only the map
Related
For a project, I have to indicate, with colored arrows, in which direction are the markers that aren't shown in the visible region.
When the user scrolls, or zoom on the map, the arrows move accordingly to where the not visible markers are compared to the current center of the visible region.
Here is a picture that demonstrate what is needed :
I am using react-native-mapview and added regular views over the map to show the indicators.
I've started working on this by comparing the coordinates and calculating the point of intersection between lines (border lines and line made by the 2 coordinates) at each frame. It works fine on iOS but is pretty laggy on Android, especially chan there are a lot of markers involved.
What would be the best and optimized way to do this ?
Maybe you could try using Animated.View instead regular view. It may render more fluently?
pass tracksViewChanges={false} to Markers https://github.com/react-native-community/react-native-maps/blob/master/docs/marker.md
I have to draw a trail that contains more than 250.000 polylines with more than 500.000 coordinates. For my mobile deca core (10) and android 6.0 it takes more 1 minute to draw trail and the map become very slowly.
Is there a solution to draw it more quickly with a fast map ?
Note:
The same approach is executed in iOS speedly without problem, it takes 3 seconds to draw and the map is super fast.
The same question exists, but the proposed solutions do not work for me.
That is, perhaps, iOS doesn't draw all of them, obly approximated part, fitting current screen scale. You can do the same.
Take maximal area, fitting current zoom and suggest, that there should not be more than 100 lines. Add approximation algorithm, using fewer key points and calculate new lines
I have checked a lot of SO questions but none really answered it.
I am looking to add google map with animated markers. This means sprite display 3-4 frames while fixed at the location and while moving.
I thought about using AnimationDrawable but that didn't work. The other 2 solutions I have in mind are:
1-Use marker.setPosition and marker.setIcon in a "loopy handler". Inclined to use this but for some reason I feel it is an over kill especially that I may have 100 Markers
2-Add SurfaceView on the map and draw bitmaps using LocationToPixels functionality of the map. But that may be cumbersoms when gestures are moving.
Do you recommend any of the above or even a new solution? Please justify why so it is not an oppinionated answer.
Thank you
I'm completely new to OpenGL so my question might sound stupid but I'm trying to do one thing for more then week and I got completely stuck.
I'm trying to draw a globe that you can rotate and zoom and pick the country on Android. There are no problems with rotation but there are some with zooming (texture looks ugly if camera come closer) and I have no idea how to implement country picking. I have an arrays for each country with lat,log for each vertex of country border. But how can I draw it on the sphere ?
I've been trying to convert lat,long to zyx and draw lines but there is a triangulation issue to build polygons. Is it possible to draw texture on run-time with shaders? and is it possible to get a touch point on texture ? (I'd like to highlight selected country by filling it with another color)
I don't need a map, just a countries with one color, borders with another one and rest of the globe with third one.
I'm using Rajawali lib for this purpose. Although it is opensource but it has no comment and tiny doc is outdated so if you know better framework please suggest me.
I've been struggling for a couple of weeks now with google's android mapview.
I'm drawing a large amount of polygons with a large amount of points. on average 15 polygons and around 1000 points each.
The first issue I experienced was performance... No surprise. After doing some testing I realised the culprit is projection.ToPixel() which I successfully bypass when the users pans by simply moving all my points in the direction by x amount of pixels (the difference), however when zooming I have no choice but to make use of the toPixel method.
Is there possibly a more efficient way of modifying my points depending on the zoom level? after some research I've found examples on how to do this with circles and other shapes, but I have no clue where to begin with reshaping polygons, any ideas on this?
The second issue i'm having is that when I have the entire polygon in view all is grand, but when I pan over the map bounds (where the map is effectively starting again to the left and right) on any side the polygon lines seem to reach and stretch out across the map bounds causing crazy spaghetti lines all over the place! I take it what's happening is that the path.close() or path.LineTo() methods think the shortest path is flying halfway across the world to reach the next point which causes these lines. I have no idea how to address this. I simply can't ignore points that do not fall within the current lon/lat spans because that (obviously) causes the polygon to change shape al the time!
Has anyone experienced this issue and how can one go about solving it? I'm not even sure what I should be googling!?
UPDATE 1:
The problem can be easily solved by preventing the mapview from looping. Is there some way to prevent the mapview from looping the world!?!?