Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Visualise the icon. The visdef used for geopoints is Symbol Plotting, and its default behaviour is to plot the actual numbers on the map. This can become cluttered, and text rendering can be slow. Drop the supplied colouredsymb_symbolscolours icon into the Display Window to get a better view of the data.

...

Computing some statistics in Macro

First, we will print some information about our geopoints data. Create a new Macro icon, type this code and run it:

...

Save the macro and see its result by right-clicking on its icon and choosing examine or visualise. We could also have put a write() command into the macro to write the result to a geopoints file.

Finding geopoints points within 100km of a given location

As a more complex example, we will combine two functions in order to find the locations of the points within a certain distance of a given location. We will use the same geopoints file as before.

The distance() function returns a new geopoints variable based on its input geopoint, where each point's value has been replaced by the distance of that point from the given location. The description of this function follows:

Panel

geopoints distance ( geopoints,number,number )
geopoints distance ( geopoints,list )

Returns geopoints with the value of each point being the distance in meters metres from the given geographical location. The location may be specified by supplying either two numbers (latitude and longitude respectively) or a 2-element list containing latitude and longitude in that order. The location should be specified in degrees.

...

Choose a location and use this function to compute the distances of the points from it. Assign the result to a variable called distances and return it to the user interface to examine the numbers. The distances are in metres.

Now we will see a boolean operator in action. The expression distances < 10000100000 will return a new geopoints variable where, for each point, if the input value was less than 10000100000, the resulting value will be 1; otherwise the resulting value will be zero. So the resulting geopoints will have a collection of ones and zeros. Confirm that this is the case.

...

Use this in combination with what you have already done to produce a geopoints variable consisting only of the points within 10km 100km of your chosen location. Plot the result to confirm it.

...