Prepares GSX files needed to cover the MBR.
Syntax
GsFunStat GsPrepareIndexMbr(GsId gs,long lon1,long
lat1,long lon2,long lat2,const char *outDir, void
*progressData, spatialQueryProgress progress);
Arguments
gs ID returned by GsInitWithProps() for the current instance of GeoStan. Input.
lon1 Minimum longitude. One of four values that make up the MBR. Input.
lat1 Minimum latitude. One of four values that make up the MBR. Input.
lon2 Maximum longitude. One of four values that make up the MBR. Input.
lat2 Maximum latitude. One of four values that make up the MBR. Input.
*outDir Directory to write .gsx files.
*progressData Data to pass to progress. Input.
progress Callback function for progress meter. If NULL GeoStan does not call progress. Input.
Return Values
GS_SUCCESS
GS_ERROR
GS_CANCEL Progress function received a cancel request from user.
Prerequisites
GsInitWithProps()
MBR Representation by Lat/Lon
See GsFindFirstSegmentByMbr for an MBR representation by latitude and longitude.
Notes
Prepares the reverse geocoding system for each Finance Area needed to cover the MBR specified by the four lat/lon parameters.
Call before GsFindFirstSegmentByMbr().
- GS_INIT_OPTIONS_ADDR_CODE
- GS_INIT_OPTIONS_SPATIAL_QUERY
- GS_INIT_OPTIONS_Z9_CODE
In addition, when using GsInitWithProps() include the outDir directory in the search path. For example, C:\data;C:\gsxout, where C:\data contains the primary data files and C:\gsxout is the output directory for .gsx files. Include finmbr.dat in the GsInitWithProps() search path when creating .gsx files.
Example
See GsFindFirstSegmentByMbr for an example.
Progress Function
You can use the progress function as a progress counter and to cancel spatial queries interactively. The progress function is defined in geostan.h as follows:
intl (*spatialQueryProgress)(void *param, intl mode, intl
value);
*param Points at the progressData argument passed to the GsPrepareIndexMbr() function.
mode One of three values in the table below. Value contents vary depending on mode.
0 |
Initialize progress meter.value is estimated total number of steps. |
Return GS_PROGRESS_CONTINUE or GS_PROGRESS_CANCEL. |
1 |
value contains current step number. |
Return GS_PROGRESS_CONTINUE or GS_PROGRESS_CANCEL. |
2 |
Terminate progress meter.value is unused. |
Return value ignored. |