Trying to eliminate duplicate markers in GMaps V3 sidebar - google-maps-api-3

I'm using google maps v3 API to display markers from an XML document, and I'm utilizing marker manager to specify the number of markers to show per zoom level.
Here's the link: http://www.wrh.noaa.gov/mfr/rec/v2/index_sidebar_zoom.php
And here's the problem. It seems that upon loading, the script loads all the markers for each zoom level together, so even though I only have ~200 markers, my marker array, named "batch", contains 507 markers. When I display "batch" on the sidebar, it thus displays some duplicate markers.
So to troubleshoot this, I tried to eliminate duplicates using a jquery script I found. However, when I alert the length of the "batch" array and then alert the length of the new array (supposed to be free of duplicates), it shows 507 as well.
So, any suggestions on how to eliminate the duplicate markers, and sort them alphabetically to display on the sidebar?
Lastly, I seem to have lost my functionality of displaying more markers as I zoom in while I've been working on the sidebar. Any ideas on what happened to that functionality?
Thanks for any help,
S

The MarkerManager is diplaying the first 48 markers 4 times, the first 98 markers 3 times, the first 150 markers twice. Is that what you want?
mgr.addMarkers(createMarker(48), 6);
mgr.addMarkers(createMarker(98), 7);
mgr.addMarkers(createMarker(150), 8);
mgr.addMarkers(createMarker(211), 9);
I think what you want is this:
mgr.addMarkers(createMarker(0,48), 6);
mgr.addMarkers(createMarker(48,98), 7);
mgr.addMarkers(createMarker(98,150), 8);
mgr.addMarkers(createMarker(150,211), 9);
And change your createMarker function to take a start and end number.
Like this

Related

Google App Maker not reocognising some of its own widgets

In Google App Maker, I have several widgets on a page.
One of these widgets is called Label12 (shown in Screenshot 1).
It definitely exists and is also shown in the breadcrumb trail at the top of my screen.
However, when I attempt to reference Label12 in my code, it does not seem to exist.
If I use the ctrl+space code completion helper, the Label12 widget is not shown as an option (shown in screenshot 2).
When I attempt to code it manually (e.g. app.pages.Reconciliation_Details.descendants.Label12.visible) it returns the error "Cannot set property 'visible' of undefined".
Why can App Maker not see Label12?
Screenshot 1 showing Label12 on page:
Screenshot 2 showing absence of Label12 when coding:
App Maker can see Label12. The point is that the label is inside a table widget, hence according to the documentation:
Because a table is a collection of other widgets, you can't use the Widget API to interact with a table. However, you can use scripts to manipulate the individual widgets that make up a table.
The above statement makes sense because the amount of rows a table will display depends on the datasource items; i.e., the rows are dynamically created when the widget datasource is loaded in the ui. Therefore, in order to access the label you need to first access the children of the Table1Body, which is a collection of named values known as PropertyMap.
I believe you are trying to hide/show that specific label based on some logic. The correct way of doing it would be something like this:
var rows = app.pages.Reconciliation_Details.descendants.Table1Body.children._values;
for(var i=0; i<rows.length; i++){
var row = rows[i];
var label = row.descendants.Label12;
label.visible = true; // or false
}

How to use cursors for navigating to previous pages using GQL and the new gcloud-java API?

I'm using the new gcloud-java API (https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-datastore/src/main/java/com/google/cloud/datastore) for working with the Cloud Datastore. My specific question is on using GQL for pagination with cursors. I was able to page through the results one page at a time in the forward direction using cursors, but not having any luck with paging backwards.
Example Scenario:
Let's say I've 20 entities in a Kind with IDs 1 through 20. I have a page size of 5. Once I'm on the 3rd page (IDs 11 through 15), if I need to go one page back; i.e. retrieve IDs 6 through 10, what would be the correct GQL/sample code? Again, I prefer not to use offset with a number, but would like to use Cursors.
From what I can tell (actually tested), it looks like one needs to keep track of Start/End cursors for each page as they navigate in the forward direction, then use the saved cursors when there is a need to go back. I just want to make sure if this is the correct/only way or there is a simpler way to accomplish this.
Thanks in advance for your help.
If you add to your original query a sort by key (appended to the end of your "order by" clause), you should be able to reverse each property's sort order and use the latest cursor from your original query to get results in reverse.
Suppose you've iterated through some of the values from your forward query's QueryResults. You can call QueryResults's cursorAfter() method, which will return a cursor pointing right after the last result you saw from your original query. Now you can issue a new query (with the opposite sort order on each property, including the key property) using that cursor as the start cursor. You'll probably want to skip the first result, since it will be the last result you saw from the original query.

How can I add layers to Here Maps?

I am starting with here-api,I follow the examples and I add some markers in the map, but i nedd and a layer switcher, to select multiple layers with differents markers, and shown it in the map but i cant do it. The markers are, static and the map not reload the firt markers.
I try to put more than one maps, in tabs, but not work. Some idea about it?
Sorry for my english.
Regards.
As much as I know, Here JS API does not support this kind of layers out of the box, but you can implement is quite simply.
You can use something called a Group.
From the documentation:
Groups are logical containers which can hold a collection of child objects (markers or spatials, but
also sub-groups). Groups make it easy to add, remove, show or hide whole sets of map objects in
an atomic operation, without the need to manipulate each object individually. In addition, a group
allows you to calculate a bounding box enclosing all the objects it contains and to listen for events
dispatched by the group's child objects.
It means that you can add some objects (markers, polylines, polygons) into one group and some into another group. Then you can use addObject and removeObject methods on the map accordingly to add or remove this group (group extends Object class).
group = new H.map.Group();
group.addObject(marker1);
group.addObject(marker2);
// add to map
map.addObject(group);
// remove from map
map.removeObject(group);

Issue in Conditional hiding in cognos report ver 10

I already have a conditional block which controls 10 charts like chart 1 .....chart 10 based on block variable called 'Chart' now I have to conditionally hide chart 3 , bcoz the design of chart 3 differs based on prompt value = complex.
So I tried using style variable and render variables to hide chart 3, I noticed the conditions works only if click on the submit button second time. during the first run its not rendering properly.
case when paramvalue='complex'
then 'Y'
else 'N'
end
If I try to pull the data item from query it throws error as its not referenced in the layout.
I tried many combinations but not working. Quick help is appreciated.
it throws error as its not referenced in the layout.
Normally you use the 'properties' property of the rendering object (i.e. list, singleton) to define query items that aren't in your list but need to be referenced.
This works for lists but generally does not work for charts or crosstabs. If you can somehow squeeze your query item on to the chart then this error will go away.

Getting marker data from a google map v3

I have a google map v3 with a number of markers, which have a "category" attribute. I also have a left side menu bar, from which a user can select the desired category. When he/she clicks on the selected category, all the markers are cleared from the map, and only markers with the selected category are loaded.
Now, I need some sort of function which can search through the map and get the loaded markers and their data. The data will then be dynamically loaded in the right side menu bar. You can see the page I am talking about at this LINK
Please, any help will be highly appreciated...
I know this isn't the answer you are hoping for, but there is no good way to query the map and ask for all of the markers. As you load the map and create the markers, you want to keep an array of all of your markers or keep an array by category and track your markers in multiple arrays. Keeping an array for each marker type will make it much easier to turn them on/off; that's what I do. Hope this helps -
One solution:
1) Create an array of markers. Every time you create a marker, add it to the array. Also assign a property to the marker of 'category' or something.
marker.category='foo';
2) When user clicks on the button, look through your markers array and test if each marker matches the category. If it does not, set the map to null.
if (markers[iterator].category!='foo'){
markers[iterator].setMap(null);
} else {markers[iterator].setMap(map);}

Resources