|
|
| ENG/RUS Main :: RiSearch :: RiSearch Pro :: RiCoord :: RiMap :: RiSearch PHP :: RiLax :: Forum |
|
|
RiMapThis document describes general functionality and configuration settings for RiMap and RiCoord libraries. The main purpose of the scripts is to plot interactive street maps for USA cities. The system consists of several scripts and libraries with datafiles. InstallationRiMap is standart Perl script and installation procedure is similar to any other Perl script installation:
You will need GD module installed on your server for map creation. Any version starting from 1.27 and above should work. Probably script will work with older versions too, but older versions were not tested.
It is recommended to have libgd library (used by the Perl GD library) compiled
with TrueType support. This will allow to plot inclined street labels.
Script will work without TrueType support, but all text labels in this case
will be horizontal or vertical.
Datafiles:
Some of the above mentioned datafiles are text files and can be edited by hand.
The data for mapping function is based on Census Tiger/Line files, which is street block level database. Therefore RiMap is best suited for large scale maps. Small scale maps require more computational power because of large number of small segments, which should be plotted on map. To solve this problem, script plots different amount of data depending on map scale. Below is the list of all possible features: Data layersMap consists of different objects, combined into layers. Three types of objects exists: point, line and polygon objects. Point objectsTwo type of point objects are exists: cities and landmarks. City name is plotted in white box. Landmarks are point objects of different kind, which identify any specific geographycal feature (like lakes, parks) or buildings (schools, hospitals, churches, etc.). Landmarks are shown as green square with label in yellow box. Line objectsFeatures codes1 - Highway unseparated 2 - Highway separated 3 - US Highway unseparated 4 - US Highway separated 5 - Secondary road unseparated 6 - Secondary road separated 7 - Local road unseparated 8 - Local road separated 9 - Forest road (not included) 10 - Access ramp etc. 11 - Pedestrians road (not included) 12 - Main railroad 13 - Industrial railroad 14 - Railroad yard 15 - Water unknown (not included) 16 - Perennial shoreline 17 - Intermittent shoreline 18 - Perennial river 19 - Intermittent river (not included) 20 - Braided river (not included) 21 - Perennial ditch (not included) 22 - Intermittent ditch (not included) 23 - Lake 24 - Bay, Sea, Ocean shoreline 25 - State boundary 26 - County boundary Some of the minor features were not included into current set of data files in order to reduce size of database. For each feature minimal scale, at which script starts to plot this feature on map, should be defined. Map scale is the number, which means fraction of decimal degree plotted along vertical side of the map (look in the URL bar in your browser at parameter "s", for example plot.pl?long=-73.958292&lat=40.800581&s=0.02 - scale equal "0.02"): $min_code_scale[ 1] = 3; $min_code_scale[ 2] = 3; $min_code_scale[ 3] = 1.5; $min_code_scale[ 4] = 1.5; $min_code_scale[ 5] = 0.9; $min_code_scale[ 6] = 0.9; This example means that interstate highways will plotted for all scales up to 3 degrees scale, US highways will be plotted up to 1.5 degrees scale, secondary roads up to 0.9 degrees scale. Polygon (area) objectsFeatures codes1 - Golf course 2 - Cemetery 3 - National Park 4 - Natinal Forest 5 - State or Local Park 6 - Island 7 - Shoreline 8 - Lake 9 - River 10 - Sea, Ocean 11 - Unknown water feature As with line objects you can define at what scale area objects will be plotted, depending on area feature code: $poly_scale[ 1] = 0.3; $poly_scale[ 2] = 0.3; $poly_scale[ 3] = 0.5; $poly_scale[ 4] = 0.5; There are other area objects, not listed above. City boundaryCity boundary will not be plotted for small scale maps and for very large scale maps. This is controlled by two variables: $city_bound_min = 0.01; $city_bound_max = 0.5; Color of the polygones is controled by variable: $city_color = $color{lightbrown}; ZCTAZIP Code Tabulation Areas (ZCTAs) are approximate area representations of postal ZIP codes. ZCTAs were created by Bureau of Census. For more information about ZCTA and correlation between ZCTA and ZIP codes please refer to Census Website. RiMap is able to plot ZCTA polygons on the background of map under streets grid. Colors for ZCTAs are chosen randomly and script does not check if two adjacent ZCTAs have the same color (example: map_1 and map_2). To plot ZCTAs use corresponding checkbox below the map and press "Redraw map" button. CountiesCounty areas filled with different colors can be plotted (similar to above). LayersDifferent objects on the map are combined info layers. By default all layers are visible. User can turn layers OFF/ON using checkboxes below map (selected layer will not be plotted). Please note, that there is hardcoded scale limits for each layer, which can't be changed via webinterface. If some of the layers are not plotted at specific scale, you can't turn them "ON" unless you change these limits in source code. Query string parametersOnly parameters "lat", "long" and "s" are required, all other parameters are optional. General parameters (for "map.pl" and "plot.pl")
Parameters for "plot.pl"
Other parametersOther parameters are used to define at which scale script will plot different features:
Plot user defined dataThere is possibility to plot your own data over maps produced by RiMap. You can put own labels on the map or you can draw own primitives. Labels
In order to plot custom label on the map you have to
create text file with name "locations" in the directory "locations".
Each line of this file represents one specific landmark feature
you want to label. Format of the file:
Primitives
Also you can draw your own lines and polygons on the map.
Using this feature you can show exact positions of individual
buildings or other landmark features.
Primitives should be defined in the file "my_data/all_data". Format
of the file:
Available corol names can be found in function "create_image" in file "rimap.pm". You can add other colors there. Show image statistics
Some statistic information about map generation can be plotted over image.
Map generation time depends on many factors: scale, number
of objects, size of objects. By setting $show_generation_time
variable to "1" you can print map generation time in the left upper corner.
Then turn OFF one or several layers to see, which layer takes most time.
Set variable $show_object_stat to "1" to see number of objects processed and plotted. Statistics will be printed in such way: "Lines: 1000/10000; Polygons: 50/200". This means that 10000 line objects and 200 polygon objects were processed, and 1000 lines and 50 polygons were plotted on the map. FontsRiMap uses GD library to plot maps. GD has several built-in fonts, and string can be plotted either in normal horizontal orientation or rotated 90 degrees. However, if GD library was compiled with support of TrueType fonts, street names can be plotted along streets using any TrueType font installed on your computer. Set path to font in "$font_path" variable. Map datum and projection
TIGER database uses North American Datum 83 (NAD 83) for geographic coordinates.
Large scale maps are plotted in scaled Lat/Long projection, where meridians and parallels
are stright and intersect at right angles, but size of one degree arc along meridian
and paralel is not equal, so that distance is preserved at map center point. Let
L and F be longitude and latitude of point of interest and
L0 and F0 be longitude and latitude of map center respectively. Then
Small scale maps (over 5 degrees in vertical dimension) are plotted in sinusoidal
projection:
|
| http://risearch.org | S.Tarasov, © 2000-2005 |