Subscribe to this thread
Home - General / All posts - Optimizing queries
sitesatlas59 post(s)
#12-Nov-20 18:47

I'm working on a project to automatically determine whether or not a town should be labeled on a reference map based on its population and proximity to larger places. Large cities should be displayed while most small towns should be hidden so as not to clutter the map, unless they are in a sparsely populated area. When I started a thread on this back in 2007 (, I got a lot of useful input and now I'm back at it again with a slightly different approach.

The script and queries I have do exactly what I need, but they're a bit slow. On my machine using 64-bit Manifold 8, it takes about 90 seconds to handle 1,755 records. The problem is that I need to perform this task on some 800,000 records, which could take 12 hours or more. Could anyone take a look at the queries and see if there's a way to speed them up in M8? It might run faster in Manifold 9, but I have no idea how to change the script for that environment.

A sample .map file is attached. A summary of what the script is supposed to do is included as a comment. The map is made to be viewed at 1:1 million. Before rerunning the script, set all the DISPLAY values in the Cities Table to 0.

Filtering Cities 2020


528 post(s)
#13-Nov-20 12:47


Why not make use of the capabilities of M8? In the attached map file I have created 5 separate layers based on the cities drawing (using queries and file link drawing). Then I created a label component for easch of these drawings. The label at the top of the map gets priority over the lower ones. M8 takes care of resolving overlaps.

Filtering Cities 2020

sitesatlas59 post(s)
#13-Nov-20 15:26

Thanks for your response and the effort you put into it! Dividing the cities layer by population gives me control over the symbol and label styles, and I wasn't aware that the layer order affects the automatic labeling priority -- thanks for that tip. But I see a couple of issues. For one thing, when Manifold hides a label, it doesn't hide its symbol, but that is what I need in this case: one label for every point, with no unmatched points or labels (like what you'd see on a road or reference map). If I try to select the displayed labels to transfer the selection to the towns they are related to (and set the display attribute that way), the labels sometimes move around. And I can't get much control over the spacing between labels this way, either.

Let me provide a little more background into what I'm looking for: I want to create display attributes in the cities layer so when you make a map at specific scales, the attribute will tell you whether the city symbol and its label should be hidden or displayed (this will be repeated for various map scales). I'm going to be distributing the data with those display attributes, not the actual map. I want to control which cities are displayed by population and geographic distribution, so no parts of the map are cluttered or empty, and there's a fair amount of space between the labels.

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.