Google Maps Android API v2 very slow when adding lots of Markers - android-mapview

I am updating an existing Android app to use the new Google Maps Android API v2. I have about 2500 markers that I want to add to the map. With the older version of the API I found the responsiveness of the maps to be horrendous when there are 2500 markers, so I had to work around it by only adding markers that are in the current visible region of the map.
I was hoping 2500 markers would be faster with the new API, but it's still awful, even on a Nexus 4, and I'm not seeing any sort of option to do clustering.
So my question: how can I determine if a certain lat/lng point is contained within the visible region of the map?
I have looked at VisibleRegion in the documentation, but I've not had any luck with it so far. Any help is greatly appreciated.
*Side note: 2500 markers on an iOS MKMapView (google maps or Apple maps) is very smooth and responsive even with an iPhone 3gs. I still can't understand why it's so slow on Android, even with the latest and greatest hardware.

Alright, after trying a couple more things I figured out how to determine if a given point is in the visible region, and it's pretty simple:
//Note: this.mMap is an instance of GoogleMap
LatLngBounds bounds = this.mMap.getProjection().getVisibleRegion().latLngBounds;
LatLng markerPoint = new LatLng(item.getLatitude(), item.getLongitude());
if(bounds.contains(markerPoint))
{
this.mMap.addMarker(new MarkerOptions(...));
}
*Note that getting the projection of the GoogleMap is an expensive operation, so if you're looping through a long list of items to create Markers and adding them to the map like I am, only grab the projection once before you loop.
Update
I decided to write up a blog post detailing how to show Markers that are in the visible region of the map and hide Markers as they are moved off the screen. It's not a perfect solution, but if you are showing thousands of Markers and know that your users don't need to see all of them at the same time (unless they zoom way out), it's a pretty good work-around.
Hiding and Showing on screen Markers with Google Maps Android API V2

For a clustering solution on Android you may want to try Android Maps Extensions:
https://github.com/mg6maciej/android-maps-extensions

Related

Mapbox, create area, label that area, then search for the label

Total newbi here. I have played with studio for a few h but can not get over the next hurdle.
I would like to draw wine growing areas on the map.
Managed to draw areas. Tick.
I would like to give these areas a unique name.
Managed to create labels.
But I don't understand how the text is associated with the area.
I then want to search for this label, so that the map zooms in on that area.
Just like when I search for "Coburg, Victoria, Australia".
I have managed to publish my maps including the areas in my WordPress website.
So my access token and my style does the right thing.
Need some hints how to get the labelling and searching happening.
Thank you for any help.
Regards
Romano
and welcome to using Mapbox.
I would like to give these areas a unique name. Managed to create labels. But I don't understand how the text is associated with the area.
Have you tried creating a Symbol layer, and setting the Text field to the appropriate field in your data source?
I then want to search for this label, so that the map zooms in on that area. Just like when I search for "Coburg, Victoria, Australia".
This goes beyond using Studio, and into building web maps with mapbox-gl-js. One starting point would be to use the Finder Impact Tool.
This might involve processing the data twice -- once for your base map, and another time in a spreadsheet to make available to the Finder template. It's possible to just do once, but would involve some modifying the Finder template.
https://labs.mapbox.com/education/impact-tools/finder-with-filters/

ArangoDB Graph shows different result every time

I'm new to ArangoDB and currently trying to display the "Game of Thrones" and "debian_dependency_graph" from the Example Datasets.
In the GoT case I'm able to get the full view by using "Fetch full Graph". Yet there doesn't seem to be a way to add "Traits" in a useful way.
Even stranger is the behavior of the debian_dependency_graph which gives a random, but useful result at first, but changes to nodes only with no added edges after displaying everything.
I'm aware we're starting with a random graph in the beginning, but why isn't there a useful way to switch between the possibilities? Also how comes in the Debian-packages the edges are gone after displaying everything?
From looking through the web I see that in previous versions there seemed to be a way for adding filters and doing changes, in my version (3.4.1, rocksdb)
I can't make much sense of "Configure graph settings". Is there something I'm missing out?
For instance services or showing AQL-Queries as graphs. I'm still trying to figure out what's out.
Screenshot of the Debian dependency graph (Full graph):
The "Configure graph settings" option which you mentioned above is a right tool for you to use.
You can force graph to be rendered starting from a specific node if you change Startnode (the value should be equal to _id property value of a particular object within your graph)
The problem with the missing edges looks like a limitation of the graph viewer (you are trying to display too many object at the same time and it will be a complete mess if it would render all the edges)
You can play with Search Depth & Limit settings to limit the amount of nodes being rendered at the same time which will allow you to see edges

Is it possible to show a satellite map on Windows 10 UA app

I'm trying to make my first Windows 10 UA desktop app. I have a working map, but it shows the road type of map. The problem with this is, the detail isn't there, and may people won't be able to get enough info out of this.
Is there a way I can switch the map view from a road to a satellite map?
Edited for response
Sorry I miss understood, didn't realize you where using the MapControl class. Below is a link that explains how to use 3d aerial and street views (towards the bottom)
https://msdn.microsoft.com/en-us/library/windows/apps/mt219695.aspx
the code you are looking for is something like
MapControl1.Style = MapStyle.Aerial3DWithRoads;
Absolutely! You can use the Bing maps API. http://www.microsoft.com/maps/choose-your-bing-maps-API.aspx
Here is a link to a guide on getting started.
https://msdn.microsoft.com/en-us/library/ff428643.aspx
From the API you can then select the satellite map instead of the road.

Kivy MapView offline

I'm planning to write a Kivy app containing a (small) offline map. Kivy's Mapview widget seems to be a good choice to display maps but before I start diving into it further one question that I couldn't figure out: Is it possible to use Mapview offline, by using locally stored tiles?
I managed to do it, it turns out it is not that complicated to do but it took some research (at least for a beginner like me). Here is a rough outline:
1. MapView supports mbtiles as source as detailed in the documentation - mbtiles can be created in TileMill
2. I wanted a map in Openstreetmap style, so I downloaded openstreetmap-carto from github. The installation manual explains quite well what needs to be done in order to obtain a map in this style
4. There the biggest challenge was to set up and manipulate a PostGIS database. This link helped: http://www.bostongis.com/PrinterFriendly.aspx?content_name=loading_osm_postgis
There were some additional issues along the way but all could be solved by combing through the internet.

Which tools to build a complete interactive mapping application/web application?

I want too build a web application, and I am looking at the tools I will have to use.
I want to use a real time map
I'm a thinking about :
Tilemill to get .png in order to constitue the background of my maps
or get data from a webite in shp files to build layers for this in mapnik.
Mapnik Build layers with the data I want to add on my map.
Mapnik : Put layers together and generate a map.
TileStache : generate tiles for my application.
Openlayers : Display my map with tiles in a browser.
Once my map is displayed, I'd like to add interactivity. For example when you go over a line or a circle (a town/ an event), then it gives you the attributes of this object.
But the lines and circles will integrated dirctly to the mapnik map, so I need to add some javascript to make it dynamic and open a pop-up. How do I do this ? Using Openlayer javascript libraries or node.js.
What is your advice on the question/the way I want to use theese tools?
Thanks a lot!
I'm in a similar situation, so I don't know the answer, but from what I've been able to figure out I think you're on the right track.
I started off using the Mapbox approach, which simplifies things as long as your data is static. You use Tilemill not only to generate your PNG tiles (once you've used Carto to do some nice styling) but also to import your data sets.
TileMill can export your TileJSON and UTFGrid files with the PNG tiles all packaged up and ready to use. Mapbox will then host all that stuff for you, and you can use their mapbox.js library (an extension of Leaflet) to bring it all together in the browser, with full interactivity. Opening popups would be something you'd do in Javascript in the browser - and if you mean infoWindows (the overlay window that's associated with a map point) then that would be a call to the Leaflet API.
If you're happy to create your layers and import your data offline this approach seems to be really simple and powerful; Mapbox will even render out tiles using multiple layers overlaid - so for example you can see your circles on top of a satellite image, merged into a single PNG.
The problem really comes in when your data needs to be live and you can't therefore prepare it all ahead of time in TileMill. I'm still trying to figure this all out but it does seem as though a combination of TileStache and Mapnik would be able to serve you up the TileJSON, GeoJSON and UTFGrid files you'd need as well as the tiles themselves, in the way you've outlined in the question.
You might also want PostGIS and GeoDjango or similar behind the scenes in order to hold and manage your live data, respectively.
As I said, I'm still trying to actually get my full stack working so I can't vouch for this 100% but if your data is gathered upfront then I'd definitely recommend the TileMill route for simplicity's sake.
I hope that's a help!

Resources