glob3mobile / g3m

The multiplatform advanced visualization framework
http://www.glob3mobile.com/
Other
117 stars 56 forks source link

Does MarksRenderer have a max capacity ? #141

Open octavianiLocator opened 9 years ago

octavianiLocator commented 9 years ago

Hi

I have json file containing a dataset with ~50K points in a city, which I try to draw as Markers in my G3M Android app using MarksRenderer. The application is a simplified version of the G3MShowMarkersActivity example from G3MAndroidDemo.

// Initialize G3M basic params
final G3MBuilder_Android builder = new G3MBuilder_Android(getApplicationContext()); 
// Initialize MarksRenderer
private MarksRenderer _assetMarkerRenderer = new MarksRenderer(false, false, false );
// Parse JSON file, construct Marker objects and add to MarksRenderer
builder.setInitializationTask(getAssetMarkerLayersTask());
// Display Marks
builder.addRenderer(_assetMarkerRenderer0);
// Fill LayerSet with the layers and assign
...

The performance impact when I assign all the points to a single MarksRenderer isn't big, but only around 2K of the points get rendered in the course of several minutes. Why does it do so?

The Marks renderer is populated as follows:

/*Excerpt from the "getAssetMarkerLayersTask()" initialization task*/

// Having parsed the JSON file, construct the Mark and add to MarksRenderer
for (int i = 0; i < assetList.getSize(); i++) {
        Asset a = assetList.get(i);
        // Initialize Mark
        Mark markM = new Mark(".", new Geodetic3D( Angle.fromDegrees(a.getLatitude()), Angle.fromDegrees(a.getLongitude()), 0 ), AltitudeMode.RELATIVE_TO_GROUND);
        // Add Mark to MarksRenderer
        _assetMarkerRenderer.addMark(markM);
}

I also tried rendering the 50K points with several MarksRenderers. Although, after waiting several minutes, a good portion of the assetList points get rendered. A higher number of MarksRenderers has a stronger performance impact.

Am I doing something wrong?

Side note: The app was tested on a Samsung Galaxy Note 10.1 (2013)

DiegoGomezDeck commented 9 years ago

Hi @octavianiLocator

It's not easy to talk about limits of Marks (or other things) as the capabilities of the mobile devices varies a lot.

Said that: I'm quiet sure 50K marks is a lot.

Can you explain me the type of data you want to render? Based on it, we can evaluate the options (like Vector Tiles, the new Vector Streaming stuff, etc).

octavianiLocator commented 9 years ago

Hi @DiegoGomezDeck

Thank you for your reply!

I want the data to represent mainly the location of objects in the real world, maybe also some characteristics of theirs - and Marks look like a good fit for this purpose. Thus, I can view their distribution on the map, zoom in to a specific one and see info about it at touch. Yes, 50K points are a lot, but can't I perform some sort of Mark-clustering based on zoom level ? Can g3m be applied to obtain anything like this?

For example, I would like to display in my app all of the building entries in my city and store their location and brief info about characteristics. It does not make sense to render all building entries at a city overview (thus the need for clustering of marks).

What are Vector Tiles applied for? How? What about Vector Streaming?

DiegoGomezDeck commented 9 years ago

Hi @octavianiLocator

For VectorTiles, please take a look to issue #70

Related to Vector Streaming, you can take a look to those videos that shows this functionality in G3M

https://www.youtube.com/watch?v=zwDAmlni7h0 Using "Clustering" politic https://www.youtube.com/watch?v=CyQElFD_9-4 Using "Sorting" politic

All the needed pieces are in this repository, let me know which approach do you want to take and I'll give some help to go into.

DiegoGomezDeck commented 9 years ago

@octavianiLocator

Here you can see the slides used to present the Vector-Streaming stuff in the last FOSS4G at Korea:

http://www.slideshare.net/manueldalonso/foss4-g-seoul-g3m-presentation

octavianiLocator commented 9 years ago

Hello there @DiegoGomezDeck. Thank you for your insight. I would very much like to try both the Vector Tiles and Vector Streaming options that you have presented above. As I see it, the static nature of the vector tiles option would require me to re-generate the tiles whenever:

I am setting up a GeoServer with a PostgreSQL database (+ PostGIS extension) I manually mapped and georeferenced an ortho-image to create my vector layers - containing polygons, lines and points. Additionally, I created the raster tiles. As soon as the data upload to the server is complete, I will explore the options in more detail.

1. For the vector tiles - if a polygon is split into multiple tiles, but it is still entirely visible in the view, could I still select it entirely by touching inside the rendered polygon? Does it still act as a whole? 2. How can I use VectorStreaming capabilities with my server? - the sample code uses MapBoo 3. Can I still use caching with any of these options? Is it possible to render the data from local storage? (say I copy all the necessary raster tiles and vector data, or tiles, on the mobile devices' storage - for cases when there is no internet connection)

Wish you and your team all the best.

EDIT: I am thinking of using both Vector Tiles (for static vector data) and Streaming (for features that I would like to modify the attributes) in the same g3m-based activity. Would you say this is possible? How would it impact the performance when compared to each option individually?