SuperMap iClient for MapboxGL
This guide will quickly get you started on SuperMap iClient for MapboxGL. You can get detailed interface parameters on the API page.
Preparing your page
Get MapboxGL v1 and SuperMap iClient for MapboxGL
MapboxGL v1 and SuperMap iClient for MapboxGL are needed for development. Among them, MapboxGL v1 includes CSS files and JS files. You can get these documents in the following way:
MapboxGL v1
- Download CSS file from MapboxGL Official Website
- Download JS file from MapboxGL Official Website
SuperMap iClient for MapboxGL
- Download the latest version from SuperMap iClient JavaScript Official Website
- Download the release version from SuperMap iClient for MapboxGL GitHub
Import
Import files
The following is detailed account of how to import MapboxGL v1 files online via CDN, and how to import SuperMap iClient for MapboxGL through online sites.
Create a new HTML file, import MapboxGL v1 CSS file and JS file in < head> tag, and fill in BootCDN's hosting address, as follows:
Introduce the iclient-mapboxgl CSS file and JS file, and fill in the SuperMap iClient for MapboxGL online site address:
npm
Before using this method, please check if the application Node.js is installed on your computer. If it is not installed, you can install it by downloading the installer . Then install SuperMap iClient for MapboxGL by entering the following command on the command line:
If you need to use v11.1.1 or earlier versions, please install @supermap/iclient-mapboxgl.
Import the CSS files
Create a new HTML file and import the MapboxGL v1 CSS file and the iclient-mapboxgl CSS file into the <head> tag as follows:
Modular Development
ES6
You need to use npm to install dependencies before development, and then import the corresponding modules through ES6's import module loading syntax.
On demand
First, install @supermapgis/babel-plugin-import:
Then edit .babelrc:
Next, if you need QueryByBoundsParameters, QueryService, edit:
Note: import { SuperMap } from 'iclient-mapboxgl' will be deprecated
Import all modules
CommonJS
CommonJS is a JavaScript modular specification based on the Node.js environment. Use npm to install dependencies before development, and then introduce the corresponding modules via the require method.
Import partial modules
Import all modules
AMD
The following example uses the RequireJS library to implement; Download mapbox-gl.js and iclient-mapboxgl.js through " Get MapboxGL v1 and SuperMap iClient for MapboxGL " and place them in the directory where the entry master file specified by RequireJS is located.
Import all modules
CMD
The following example uses the SeaJS library to implement; Download mapbox-gl.js and iclient-mapboxgl.js through " Get MapboxGL v1 and SuperMap iClient for MapboxGL " and place them in the directory where the entry master file specified by SeaJS is located.
Import all modules
Package configuration
Because iClient uses ES6, to be compatible with browsers that do not support ES6 syntax, some configuration, including syntax conversion, needs to be done during the packaging process.
The packaged configuration here is for ES6 and CommonJS modular development, and for projects developed for AMD and CMD modules, there is no need to utilize packaging tools.
Take webpack4 as an example. Since the different package managers will cause the structure of the installation package to be different, the following examples describe the npm and cnpm configurations:
If you use npm install
or cnpm install --by=npm
to install
dependencies, you need to add the following configuration items
in the webpack.config.js.
If you use cnpm install
to install dependencies, you need to add the
following configuration items
in the webpack.config.js.
Creating a map
Map published by SuperMap iServer
In the Preparing Your Page section, a new HTML page has been created, and continue to add code to create maps in the page, as follows:
Taking the world map published in SuperMap iServer as an example, add code to <script>, initialize map information:
Enjoy the result.
Adding controls
By adding controls to the map, you can achieve interactive operations such as zooming in and zooming out. Commonly used controls:
Control | Class name | Introduction |
---|---|---|
Navigation | mapboxgl.NavigationControl | The default is in the top left corner of the map |
Scale | mapboxgl.ScaleControl | The default is at the bottom left corner of the map |
Fullscreen | mapboxgl.FullscreenControl | The default is in the top left corner of the map |
Locate | mapboxgl.GeolocateControl | The default is in the top left corner of the map |
Copyright | mapboxgl.AttributionControl | The default is in the lower right corner of the map |
Swipe | mapboxgl.Compare | Swipe appears in the center of the map by default |
When adding a control, you should initialize the map first, and then add the control to the map via the addControl() method, for example:
Navigation control
Enjoy the result.
Scale control
Enjoy the result.
Using vector tiles
Vector tiles organize and define vector data through different description files, analyze data in real time and complete rendering on the client. SuperMap iServer provides vector tile layers
Enjoy the result.
Drawing symbols and graphics
Basic drawing
For the MapboxGL v1 itself does not support the drawing of point, line and polygon, the plugin mapbox-gl-draw.js needs to be imported.
Online introduction can import the required plugins via the CDN into the <script> tag:
When imported the plugin, the point, line and polygon drawing function is implemented by the following code:
Enjoy the result.
Area and distance measurement
SuperMap iClient for MapboxGL supports area and distance measurement.
The following examples need to import
Distance measurement
Here are the steps to create distance measurement function:
1.Construct service parameter class
The measurement service parameter class provides the information required by the service request, which provides the query parameter encapsulation of the measurement. Parameters provided include geometry and unit, which are used to define the geometric objects and units of the measurement, with the code as follows:
2.Construct the service class and send the request
The measurement service class is responsible for sending requests to the server and getting the query results returned. The service class needs to specify service parameters such as URL, send request information to the server, and then request the complete event via the listener service. The results can be obtained from the event service data class, and handled according to the requirements. Please refer to the following code:
Enjoy the result.
Area measurement
1.Instantiate the measurement service constructor. The code is as follows:
2.Call the measurement function
Call the measurement function and get the return result, the code is as follows:
Enjoy the result.
Feature query
The feature query functions supported by SuperMap iClient for MapboxGL mainly include:
- Query by specifying ID
- Query by specifying SQL conditions
- Query by specifying rectangle bounds
- Query by specifying arbitrary geometric range
- Distance query
- Buffer query
- Query grid information
- Query field information
Query by specifying ID
Query geographic features with specified IDs in a dataset and display the results on the client. This example queries geographic features with specified IDs in the World dataset.
Using the interface mapboxgl.supermap.FeatureService to query geospatial features with ID 234 in the dataset "World:Countries".
Enjoy the result.
Query by specifing SQL conditions
Specify SQL query queries geographic vector features satisfying a specified SQL conditions in a dataset and display the results on the client. This example queries geographic features with specified SMID in the World dataset.
Use the interface mapboxgl.supermap.FeatureService to query the vector elements of "SMID=234" in the dataset "World:Countries".
Enjoy the result.
Query by specifying rectangle bounds
Rectangle bounds query is to find vector feature that fits the rectangle bounds in specified dataset collection and displays results in the client. This example is: Querying features in the World Data Service for a specified scope of rectangles.
Use the interface mapboxgl.supermap.FeatureService to find the vector features in the dataset "World:Capitals" that match the scope of this rectangle.
Enjoy the result.
Query by specifying arbitrary geometric range
Geometric range query is to find vector features in the specified dataset collection that match the geometric scope and displays the result in the client. This example is: Querying features of arbitrary geometric range in the World Data Service.
The interface mapboxgl.supermap.FeatureService uses intersected spatial query patterns in the "World:Countries" dataset to query vector elements that conform to the geometric range.
Enjoy the result.
Distance query
Distance query, which finds a vector feature that meets the certain distance requirement in specified layer in the map service, and displays results in the client. This example is: Querying vector features that match distances requirement in the World Maps service.
Use the interface mapboxgl.supermap.QueryService to find the vector feature in the layer "Capitals@World.1" whose distance from the specified point is 10 degrees (map coordinate units).
Enjoy the result.
Buffer query
Buffer query is to find vector elements that match the buffer requirement in a specified set of datasets in the data service, displays it in the client. This example is: Querying the features of the specified buffer in the World Data Service.
Use the interface mapboxgl.supermap.FeatureService to find the vector elements whose buffer range is 10 degrees (map coordinate units) in the dataset "World:Capitals".
Enjoy the result.
Query grid information
Query grid information is find the pixel value information corresponding to a geographical location in the specified dataset and display it in the client.
Use the interface mapboxgl.supermap.GridCellInfosService to to query grid information in the dataset "WorldEarth". The sample code is as follows:
Enjoy the result.
Query field information
Query field information is find the vector elements with specified information in the specified dataset collection, and display them in the client. This example is: Querying the features of the specified field in the World Data Service.
Use the interface mapboxgl.supermap.FieldService to query the field information of the field "SmID" in the dataset "continent_T". And count SmID in the dataset to find the average, maximum, minimum and so on.
Enjoy the result.
Feature editing
Feature editing, including the editing of points, lines, polygon, etc., such as line type, color, line width, etc. If you don't have a custom style set, the interactive controls would drawn with the default style.
Use the interface mapboxgl.supermap.FeatureService to add feature information to the dataset "Capitals".
Enjoy the result.
Thematic map
In cartography, those map that highten one or more elements or phenomena, and concentrates on representing one theme is called a thematic map. In SuperMap, the thematic map is a symbolic display of the map layer which graphically represents a certain aspect of the feature element using various graphic rendering styles (size, color, line type, fill, etc.). The thematic map can be created directly based on the API of the GIS client, or it can be created by the GIS server by invoking the back end map service. The way of making thematic map by the server side has relatively higher performance and higher efficiency of drawing; the thematic maps produced by the client can introduce the latest front-end technology to achieve more intuitive and beautiful display effects and interactive effects.
Server thematic map
The server thematic map is made by the server is the client sends the parameters to the server, such as the name of the dataset, the style and so on. The server makes the theme map according to the parameters, returns the map to the client, and displays it by the client.
Taking the dot density thematic map as an example.
The dot density thematic map uses the same point of certain size and shape to represent the distribution of the phenomenon, the quantitative characteristics and the distribution density. The number of points and the meaning they represent are determined by the content of the map. The dot density thematic map uses the number or intensity of points to reflect the theme values corresponding to a region or range.
Enjoy the result.
Client thematic map
The client thematic map is performing corresponding calculations on the client based on the shape and attribute of the data, and assigns different drawing styles through the feature layer or any layer and displays the thematic map on the client.
The thematic map supported by SuperMap iClient for MapboxGL include:
- Unique thematic map
- Range thematic map
- Graduated symbols thematic map
- Label thematic map
- Chart thematic map
Unique thematic map
Projects the factors with the same theme value as a category, sets a rendering style for each category, such as color or symbol, the factors with the same theme value are in the same rendering style, to distinguish between different categories.
The following codes shows how SuperMap iClient for MapboxGL build a unique thematic map object:
The code of Unique thematic map type and color configuration is as follows:
Enjoy the result.
Range thematic map
In the range thematic map, theme values are divided into multiple range items in accordance with a range mode, and factors are assigned to one of the range items according to their theme value, the factors in the same range item use the same color, filling, symbol style etc, to display. The theme variable based by range thematic map must be numeric, range thematic map is commonly used to reflect the amount or degree characteristics of continuous distribution phenomenon, such as the distribution of precipitation, the distribution of soil erosion intensity, etc.
SuperMap iClient for MapboxGL implements the range thematic map by the following code:
Enjoy the result.
Graduated symbols thematic map
The graduated symbols thematic map is represented on the map by a set of grade symbols according to a certain number of characteristics of each element based on certain classification method, so as to present the quantity relative relationship between the elements.
SuperMap iClient for MapboxGL implements the graduated symbols thematic map by the following code:
Enjoy the result.
Label thematic map
Some marking is essential to the map, not only to help users to better distinguish the features, but also to show some important attributes of the features, such as administrative divisions, rivers, organs, names of tourist attractions, elevation of the contour lines, etc. In SuperMap, users can easily implement map annotation by making label thematic map.
The mainly code that SuperMap iClient for MapboxGL used to implement the label thematic map is as follows:
Enjoy the result.
Statistics thematic map
Statistics thematic map reflect the size of their corresponding theme values by drawing statistics graphs for each factor or record. The statistics thematic map can be based on multiple variables, reflecting multiple attributes is the values of multiple thematic variables can be plotted on a statistics graph. Statistics thematic maps can be used to form horizontal and vertical comparisons between regions themselves and each region. It is usually used in maps with relevant quantitative characteristics, such as grain output, GDP and population of different regions for many years, and passenger volume and subway flow at different times.
In a statistics thematic map, each region has a statistical graph showing the value of each theme in the region. There are many forms of representation. Currently available types are: histogram, line chart, 3D column chart, dot chart, pie chart, ring chart.
The mainly code that SuperMap iClient for MapboxGL used to implement the statistics thematic map is as follows:
Enjoy the result.
3D thematic map
The thematic map is based on a common map and focuses on a map of one or several natural or socio-economic phenomena in the map area. The thematic elements that are the subject of the diagram are detailed and the geographic basis of the content varies from topic to topic.
SuperMap iClient for MapboxGL supports for 3D thematic map
The following takes the population density of the Beijing-Tianjin region as an example to display the data in three dimensions.
Specify the configuration items and data for the layer:
Enjoy the result.
Spatial analysis
Spatial analysis is a spatial data analysis technology based on the location and morphological features of geographic objects. The purpose of spatial analysis is to extract and transmit spatial information. The spatial analysis functions supported by SuperMap iClient for MapboxGL include:
- Buffer analysis
- Thiessen polygon
- Overlay analysis
- Min distance calculation
- Surface analysis
- Route calculate measure
- Route locator point
- Route locator line
- Grid algebraic calculation
- Terrain slope calculation
- Terrain aspect calculation
- Terrain curvature calculation
- Terrain cut and fill calculation
Buffer analysis
Buffer analysis is an analytical method that automatically establishes a range of regions of a certain width based on the specified distance around the point, line, and polygon features. For example, in environmental governance, a certain width is often drawn around polluted rivers to indicate contaminated areas. At airports, a range of areas are often zoned around a non residential area due to health needs.
Here we create a round buffer with the buffer radius of 10 meters around a road for Changchun data.
Set parameters for buffer analysis, set buffer analysis common parameters
Set the buffer analysis service object, which is used to pass parameters specified at the client side to the server side and receive the data from returned from the server. When a request has been sent to the server and the server has returned the result successfully, the user can handle the results of buffer analysis from the server.
Enjoy the result.
Thiessen polygon
Dutch meteorologist A.H.Thiessen proposed a method of calculating average precipitation based on the precipitation measurements at discretely distributed meteorological stations. In the method, all the neighboring stations are connected to form a series of triangles. Then the perpendicular bisectors of the triangle sides can be drawn. For each station, the bisectors surrounding it form a polygon. The precipitation in the polygon region can then be represented by the precipitation measured at that station, which is also the only station within the polygon. This polygon is named Thiessen polygon. The Thiessen polygon, also known as the Voronoi diagram, consists of a set of continuous polygons that form a vertical bisector that connects the lines of two adjacent points.
The characteristics of Thiessen polygons:
- Every Thiessen polygon contains only one discrete point;
- For any location in a Thiessen polygon, the discrete point associated with that polygon is the closest one among all the discrete points;
- The points located on a side of a Thiessen polygon have equal distance to the two discrete points defining that side.
The interface of the Thiessen polygon is used as follows:
Taking the dataset Thiessen polygon as an example, the Thiessen polygon service object is set up to pass the client's Thiessen polygon service parameters to the server, and receive the result data of the Thiessen polygon analysis returned by the server.
Enjoy the result.
Overlay analysis
Overlay analysis is a very important spatial analysis function in GIS. It refers to the process of generating new datasets through a series of set operations on two datasets under the unified spatial Reference system, which aims to extract the new spatial geometry information needed by the user via processing or analyzing spatial data. At the same time, the various attribute information of the data will be processed by the overlay analysis.
At present, overlay analysis is widely used in resource management, urban construction assessment, land management, agriculture, forestry, animal husbandry, statistics and other fields. The role of overlay analysis in various fields:
- Resource management is mainly used in the fields of agriculture and forestry to solve the problems of distribution, change and statistics of various resources.
- Urban construction assessment should be used to analyze the development and change of urban population, economy and construction, and the trend and law of the change.
- Land and cadastre management involves the change of land use nature, the change of plot boundary and the change of cadastral ownership, which can be accomplished efficiently with high quality under the help of GIS overlay analysis.
- Ecological and environmental management evaluation is used for regional ecological planning evaluation, environmental status assessment, environmental impact assessment, pollutant reduction and allocation of decision-making support, etc.
- Geoscience research and application is used for topographic analysis, watershed analysis, land use research, economic geography research, spatial statistical analysis, cartography, etc.
Here we overlay the administrative boundary of Beijing and Tianjin area and that of neighboring areas.
Set overlay analysis parameters
Set the overlay analysis service object, which is used to pass parameters specified at the client side to the server side and receive the data from returned from the server. When a request has been sent to the server and the server has returned the result successfully, the user can handle the results of overlay analysis from the server.
Enjoy the result.
Min distance calculation
The calculation of min distance is calculating the min distance between features in the calculated dataset to features within the query bounds of the reference dataset. Currently, only 2D point dataset is supported for calculated dataset. The reference dataset can be 2D point, line, region or 2D network dataset.
Here we find the closest geometric object to a point in Changchun data.
Enjoy the result.
Extract isolines/isoregions
Surface analysis includes extracting isolines and extracting isoregions. Isolines are lines connected with adjacent points with same values, commonly used for contour lines for height, depth, temperature, precipitation, etc. The distribution of isolines reflects the change of the value on the grid surface, and the denser the contour lines are, the more drastic the change of the grid surface values. At places where the contour distribution is sparse, the change of grid surface values is smaller. By extracting isolines, we can find places where the elevation, temperature or precipitation is the same. Meanwhile, the distribution of isolines can also reflect where the value change is steep or gentle. The isoregions is composed by closing adjacent contour lines. The change of the isoregions can intuitively indicate the change between adjacent isolines, such as elevation, precipitation, temperature or atmospheric pressure. Places where the elevation, precipitation or temperature is equivalent can be obtained by extracting the isoregions.
This section will introduce the usage of surface analysis interface by extracting contour lines based on temperature resample points of China.
Set surface analysis parameters
Set the surface analysis service object, which is used to pass parameters specified at the client side to the server side and receive the data from returned from the server. When a request has been sent to the server and the server has returned the result successfully, the user can handle the results of surface analysis from the server.
Enjoy the result.
Route calculate measure
Route Calculate Measure calculates the M-value of a point to the starting point of the route. For example, a user may want to know where an accident occurred to determine the distance of the point from a certain intersection.
Here we calculate the distance from an accident point to the road intersection (route ID 1690). The sample data used is Changchun data.
The usage for the interface of Route Calculate Measure Service is as follows:
After the map loading is completed, we will perform the Route Calculate Measure operation. First, we need to get the route object according to the RouteID, and then proceed to subsequent operation.
Enjoy the result.
Route locator point
Route Locator Point determines the point according to the M value. The application scenario is opposite to Route Calculate Measure. It will be used to determine the precise coordinates of an accidient position on the premise of the M value from the point to the road intersection.
Here we will determine the precise coordinates of an accidient position on the premise of the M value from the point to the road intersection is 6753 meters on the route with the ID of 1690. The sample data used here is Changchun data, the usage of Route Locator Point interface:
After the map loading is completed, we will perform the Route Locator Point operation. First, we need to get the route object according to the RouteID, and then proceed to subsequent operation.
Enjoy the result.
Route locator line
Route Locator Line determines the line object on the route according to the specified range. For example, you need to know the precise position of a line segment when we know there is a line segment blocked.
Here we introduce how to determine precise position of a line segment on the premise of the measure values of the line segment to the road intersection are 1123 meters to 4489 meters.
After the map loading is completed, we will perform the Route Locator Line operation. First, we need to get the route object according to the RouteID, and then proceed to subsequent operation. The usage for the interface of Route Locator Line Services is as follows:
Enjoy the result.
Grid algebraic operation
Grid algebraic operation idea is to use algebra view of characteristics of geographical phenomena and spatial analysis. Essentially, it conducts the mathematical operation and functional operation for multiple raster datasets. The pixel value of the result raster data is obtained by algebraic operation from the pixel value of the same position of one or more input raster data.
In order to better implement the function of raster algebra, SuperMap provides a wealth of operators, functions and operation expressions, in addition to commonly used arithmetic operations (such as plus, minus, multiply, divide, toInt and toFloat), also supports users-defined expressions for raster arithmetic, conditional operations, logic operations, function operations (including common functions, trigonometric functions, etc.) and compound operations, users can achieve a variety of raster analysis needs through raster algebra operations.
The interface of grid algebraic operation is used as follows
Enjoy the result.
Terrain slope calculation
Slope is one of the important terrain factors, in which slope denotes the measurement of the ratio of height change of a certain location on the earth surface. Terrain slope calculation is used to calculate the slope value of each pixel in the raster dataset. The bigger the slope value, the steeper the terrain; on the contrary, the smaller the slope value, the flatter the terrain.
In SuperMap, slope calculation provides three ways to denote, including degrees, radians and percentages. Because there is no practical significance to calculate the slope and aspect of point, the method calculates the mean value of the slope of each pixel in a raster dataset.
Here we calculate the slope value of each pixel in Jingjin data. The map needs to be initialized before the terrain calculation process. The terrain slope calculation analysis is performed after the map is loaded.
Enjoy the result.
Terrain aspect calculation
Aspect is one of the important terrain factors, in which aspect denote the measurement of slope direction variation of a certain location on the earth surface. Terrain aspect calculation is used to calculate the aspect of each pixel in the raster dataset. Aspect is represented in degrees, the range of aspect analysis result is 0° to 360°. Starts form due north 0° and moves clockwise and ends at 360°. flat slope has no direction and the value is -1.
Here we calculate the aspect value of each pixel in Jingjin data. The map needs to be initialized before the terrain calculation process. The terrain aspect calculation analysis is performed after the map is loaded.
Enjoy the result.
Terrain curvature calculation
Terrain curvature calculation is used to calculate the curvature of the surface of the raster data. Curvature is the second derivative of the surface, or it can be called the slope of the slope, which is one of the main parameters to express topographic surface structure. The output is the surface curvature of each cell of the terrain raster, which is obtained by fitting the cell to eight adjacent cells. The resulting output is a raster dataset with output curvature types: mean curvature, profile curvature, and plane curvature, the mean curvature is the necessary output, and the profile curvature and plane curvature are selectable outputs. Wherein, the curvature of the profile refers to the curvature along the direction of the maximum slope, and the curvature of the plane refers to the curvature perpendicular to the direction of the maximum slope.
Elevation scaling factor: when calculating curvature, the unit that requires the grid value of the terrain (the elevation value) is the same as that of the X, Y coordinates, and usually requires the elevation value multiplied by a height scaling coefficient, which makes the three units consistent. For example, the units in the direction of X and Y are meters, while the units in Z direction are feet. As 1 feet are equal to 0.3048 meters, the scaling factor is 0.3048. If set to 1, the representation is not zoomed.
The map needs to be initialized before the terrain curvature calculation process.
The terrain curvature calculation analysis service is performed after the map is loaded.
Enjoy the result.
Terrain cut and fill calculation
The objects on a surface may move because of deposition and erosion, the result is the increasing of surface objects at some region and the reducing of surface objects at other region. In project, the reducing of surface objects is called Cut and the increasing of surface objects is called Fill. We can calculate the area and volume of cut and fill when one situation change to another.
Here we calculate the area and volume of cut and fill in Jingjin data.
Enjoy the result.
Traffic transfer analysis
The use of traffic transfer analysis is as follows:
- Define the query function for the start site and end site;
- Add traffic transfer query funciton. It is necessary to set a traffic transfer parameter for sending to the server on the client, and define a traffic transfer service for sending a request to the server and obtaining the traffic transfer result data from the server. Finally the returned results are displayed on the client.
Taking the bus route data simulated by Changchun traffic data as an example. The example is from "省汽修" to "中安大厦", the transfer method is the least time. Users can choose the most suitable travel route according to his own needs.
1. Query traffic transfer plan
This method returns all the ride plans, and users can obtain a specific ride route according to the introduction information in the plan. Firstly, set the traffic transfer parameters, including solutionCount, transferTactic, walkingRatio, points. Define the traffic transfer service function, send a request to the server, and wait for the server to successfully process and return the result.
2. Query driving route
Get detailed information about a particular route based on the ride plan obtained from the transfer results(transfersolution).
Network analysis
SuperMap iClient for MapboxGL supports:
- Service area analysis
- Closest facility analysis
- Location-allocation analysis
- Multi-traveler analysis / logistics distribution
- Best route analysis
- Connected edges analysis
- TraceUp and traceDown analysis
Service area analysis
The service area analysis is to find the service scope for the designated service center point on the network. For instance, the 30-minute service area for a certain point on a network, the time from any point in the service area to that point will not exceed 30 minutes.
Taking Changchun data as an example, select the service center point to be analyzed in the map (support multi-center), perform buffer analysis according to the incremented values of 400, 500, 600... as the service radius according to the order of selected service center points. That is, the service radius of the first service center point is 400, the service radius of the second service center point is 500, and so on.
Service area analysis interface usage:
Set the parameter findServiceAreasParams, including network analysis common parameters, route sites, and so on.
Define the service area analysis service object. The service area analysis object is used to pass the service area analysis parameters(findServiceAreasParams) set by client to server, and receive the dynamic segmentation analysis result data returned by the server. When the request is sent to server and the server successfully returns the result, users can process the obtained service area analysis result accordingly.
Closest facility analysis
Closest facility analysis is to give an incident and a set of facilities on a network, to find one or several facilities that can be reached with minimum cost for incident, and the results show the best path, cost, and direction of travel from the incident to the facility or from the facility to the incident. For instance, you can set up a closest facility problem to search for hospitals within a 20-minute drive of the site of an accident. Any hospitals that take longer than 20 minutes to reach are not included in the results. In this case, the accident is the incident and surrounding hospitals are facilities. Closest facilities analysis is actually a path analysis. Therefore, it is also possible to apply the settings of the obstacle side and the obstacle point. These obstacles will not be traversed on the road and will be considered in the path analysis.
Taking Changchun data as an example, mark the incident on the map, and then perform closest facilities analysis for the three hospitals.
Set the parameters, including network analysis general parameters, incident, facilities, search radius, etc.
Defines closest facility analysis object, which is used to pass the latest facility lookup analysis service parameters set by the client to the server, and receives the latest facility analysis result returned by the server. When the request is sent to the server and the server successfully returns the result, the user can process the obtained closest facility analysis result accordingly.
Location-allocation analysis
Location-allocation analysis is to determine the optimal location of one or more facilities to be built so that the facility can provide services or goods to the demanding party in the most cost-effective manner. The location-allocation analysis is not only a site selection process, but also the demand point needs to be allocated to the service area of the corresponding new facility, so it is called site selection and allocation.
Set location-allocation analysis parameters, including traffic network analysis common parameters, route sites, etc.
Define the location-allocation analysis service object, which is used to pass the location zoning analysis service parameter set by the client to the server, and receive the dynamic segmentation analysis result data returned by the server. When the request is sent to the server and the server successfully returns the result, the user can process the obtained closest facility analysis result accordingly.
Multi-traveler analysis / logistics distribution
Multi-traveler analysis, also known as logistics distribution, is to find M distribution center points and N delivery destinations (M, N is an integer greater than zero) in the network dataset, find a cost-effective delivery path, and give The corresponding walking route. The multi-traveler analysis function is to solve how to properly distribute the delivery order and delivery route, to minimize the total cost of distribution or to minimize the cost per distribution center.
The results of the multi-traveler analysis will give the delivery destinations that each distribution center is responsible for, and when a distribution center delivers the goods to its responsible delivery destination, It also gives the order through the various delivery destinations, and the corresponding walking routes, thereby minimizing the distribution cost of the distribution center or minimizing the total cost of all distribution centers.
Taking Changchun data as an example, you can analyze the distribution routes of various warehouse distribution centers of food factories to user-designated retail stations through multi-traveler analysis and traveler analysis, and get the shortest route that taken by quality inspectors when check the goods at each retail station.
Set the parameter findMTSPPathsParams, including network analysis common parameters, distribution center point collection, distribution target point collection, distribution mode, etc.
Submit the request parameters of the logistics distribution analysis to the server. After the server successfully processes and returns the results, the user can obtain the best route for the goods to be delivered to the respective delivery destinations by the distribution center in turn.
Best path analysis
The best path analysis is to solve the path with the least impedance between the two points in a network, and the nodes in the network must be accessed according to the order of selection of the nodes. There are many understandings of “minimum impedance”, such as the shortest time, the lowest cost, the best scenery, the best road conditions, the least bridges, the least toll stations, and the most rural areas based on single factor considerations, etc.
Let's take the Changchun data as an example to calculate the best path between the places in the map that will walk.
Set the parameter findPathParams, including network common parameters, route sites, etc.
Submit the request for the best path analysis to the server. After the server to successfully process and return the best path analysis result, the serviceResult will parse it, and display the driving route in the map and give the driving guidance information.
Conneted edges analysis
The network may not be fully connected in the real world. You can use connected edges analysis to determine which points/edges are connected with some others. Connected edges analysis does not need to consider the network impedance, and the difference between the network elements is the state of connectivity (connected or disconnected).
Here we query the connected or disconnected roads in Changchun data.
Set the connected edges analyst parameters, including whether to query the connected or disconnected arcs, analyze the return result, and so on.
Send a tracing analyst request to the server and recieve the returned analysis result.
TraceUp and traceDown analysis
TraceUp and traceDown analysis starts from a node according to a specified rule, and then search all the arcs connected by this node. For instance, if some area of water is polluted, tracing upstream analysis can be used to find where the contaminants may come from, and tracing downstream analysis can be used to trace the range polluted by the pollution source. Tracing data must have a flow direction.
Here we trace the upstream arcs of a node for Changchun data.
Set the tracing analysis parameters,including tracing type, the arc or node ID of query, the validation of uncertain flow direction, and so on.
Send a tracing analyst request to the server and recieve the returned analysis result.
Address match
SuperMap iClient for MapboxGL supports for address match service. Address match service is the process of establishing a correspondence between a literal description address and its geographic location coordinates, which includes geocoding and geodecoding. That is, the user can find the address location by location name or the location at the specified location.
Geocoding
Geocoding returns the corresponding geographical coordinates and structured address details according to the location description, city range, and supports Chinese fuzzy matching.
Enjoy the result.
Geodecoding
Geodecoding is the process of back (reverse) coding of a point location (latitude, longitude) to a readable address or place name.
Enjoy the result.
Big data analysis
The SuperMap iClient for MapboxGL is connected to the distributed analysis service of SuperMap iServer to provide users with big data analysis functions, including:
- Density analysis
- Point aggregation analysis
- Single object spatial query analysis
- Regional summary analysis
- Vector clip analysis
- Summary attributes analysis
- Topology validator analysis
Density analysis
Density analysis includes simple dot density analysis and kernel density anlysis.
- Simple dot density analysis is used to calculate the magnitude per unit area within the specified neighborhood shape for each point. The calculation method is that measured value of the point is divided by the specified neighborhood area. Where the neighborhood of the point is superimposed, the density values are also added. The density of each output raster is the sum of all neighborhood density values superimposed on the grid. The unit of the result raster value is the reciprocal of the square of the original dataset unit is if the original dataset unit is meter, the unit of the result raster value is per square meter.
- Kernel density analysis is used to calculate the unit density of point and the line feature measurements over a specified neighborhood. It can intuitively reflect the distribution of discrete measurements in a continuous region. The result is a smooth surface with a large median value and a small peripheral value. The raster value is the unit density and falls to zero at the neighborhood boundary. Kernel density analysis can be used to calculate population density, building density, access to crime reports, population density monitoring in tourist areas, analysis of chain store operations, and more.
Here are the basic steps to implement a simple density analysis function, and the mesh type is quadrilateral.
Set the parameter kernelDensityJobParam, includes dataset, analysis method, analysis type, mesh size, etc.
Send a request to the server for density anlysis and get the returned result.
Enjoy the result.
Point aggregation analysis
Point aggregation analysis is a spatial analysis job for making aggregate graphs of point-to-point datasets. The map point features are divided by mesh region or polygons, and then the number of point features in each polygon object is calculated, and as the statistical value of the polygon object. The weight information of the points can also be introduced, and the weighted value of the points in the polygon object is used as the statistical value of the region object. Finally, based on the statistical value of the region object, according to the result of sorting the statistical value, color filling is performed on the opposite object based on ribbon.
Point aggregation analysis types include mesh aggregation and polygon aggregation. The mesh polygon aggregation graph can be divided into quadrilateral mesh and hexagon mesh according to mesh type.
Here are the basic steps to implement a point aggregation analysis function, and the aggregation type is quadrilateral.
Set the point aggregation analysis parameter summaryMeshJobParam, includes dataset, aggregation type, statistical mode, mesh size, etc.
Send a request to the server for point aggregation anlysis and get the returned result. After the server successfully processes and returns the result, it is parsed.
Enjoy the result.
Single object spatial query analysis
Spatial query is a way to construct a filter condition by spatial positional relationship between geometric objects. For example, Spatial queries can be used to find spatial objects contained in polygons, separated or adjacent spatial objects, etc.
Single object spatial query analysis in distribute analysis service from SuperMap iServer refers to a single object in the query object dataset to do spatial query on the dataset being queried. If there are multiple objects in the query object dataset, the space query with the queryed dataset is done by default with the object with the smallest SmID.
This example needs to import
Here are the basic steps to implement a single object query analysis function, and the query mode is intersect.
Set the single object spatial query analysis parameters SingleObjectQueryJobsParam, includes dataset, query object dataset, query mode.
Send a request to the server for point aggregation anlysis and get the returned result. After the server successfully processes and returns the result, it is parsed.
Enjoy the result.
Regional summary analysis
Regional summary analysis is a spatial analysis job that creates aggregated graphs for line datasets and polygon datasets. The map line or polygon feature is divided by a mesh surface or a polygon, and then each grid unit inner line or polygon feature is counted by a standard attribute field or a weight field, and the statistical result is used as a statistical value of the grid unit. Finally, the grid cells are sorted according to the size of the grid cells, and the grid cells are color-filled by the ribbon.
The concept of regional summary analysis is similar to the concept of point aggregation analysis. The difference is that point aggregation analysis is a statistical calculation of point datasets, while regional summary analysis is a statistical calculation of line datasets and polygon datasets. There are two statistical of grid unit statistics methods in regional summary analysis, includes statistics by standard attribute fields and statistics by weight fields.
Here are the basic steps to implement a regional summary analysis function, and the summary type is mesh summary, the mesh type is quadrilateral.
Set the parameter summaryRegionJobParam, includes dataset, summary type, mesh type, etc.
Send a request to the server for regional summary anlysis and get the returned result. After the server successfully processes and returns the result, it is parsed.
Enjoy the result.
Vector clip analysis
Vector clip includes inside clip and outside clip. For inside cliping, the portion of the clipped vector within the clipping region is retained in the result dataset. For outside cipping, the portion of the data that is not within the clipping region is preserved the result dataset.
For vector clip in distributed anlysis services, it is supported to clip the source dataset with one object from the clip dataset. If there are multiple objects in the clip datasets, by default, the object with the smallest SmID value will be used to clip the source dataset.
This example needs to import
Here are the steps to implement a vector clip analysis function, and the clip mode is inside clip.
Set the parameter vectorClipJobsParam, includes source dataset, clip dataset, clip analysis mode, etc.
Send a request to the server for vector clip analysis and get the returned result. After the server successfully processes and returns the result, it is parsed.
Enjoy the result.
Summary attributes analysis
Summary attributes analysis refers to summarize the specified fields of the input dataset and calculate statistics on the specified attribute field. By setting the group field, attribute field and which kind of statistics, it can calculate the summary results.
Summary attributes analysis in distribute analysis service from SuperMap iServer will calculate the statistics on all the objects by default. You can also set multi-field with "," to separate each other and summarize attributes in each group fields. Supported statistic mode: max, min, average, sum, variance, stdDeviation.
Here are the basic steps to implement a summary attributes analysis function, and the statistic mode is sum.
Set the summary attributes analysis parameters summaryAttributesJobsParameter, includes summary attributes dataset , group field, attribute field and statistic modes.
Send a request to the server for summary attributes analysis and get the returned result. After the server successfully processes and returns the result, it is parsed.
Enjoy the result.
Topology validator analysis
Topology validator analysis is used to check whether the given point, line or region data meets the specific topology rule, if not, it will return the objects that don't meet the rule.
Topology validator analysis in distribute analysis service from SuperMap iServer supports the following 7 topology rules: RegionNoOverlap, RegionNoOverlapWith, RegionCoveredByRegion, RegionContainedByRegion, LineNoOverlap, LineNoOverlapwith, PointNoIdentical.
Here are the basic steps to implement a topology validator analysis function, and the topology rule is RegionCoveredByRegion.
Set the topology validator analysis parameters topologyValidatorJobsParameter, including topology validator dataset, topology rule and tolerance.
Send a request to the server for topology validator analysis and get the returned result. After the server successfully processes and returns the result, it is parsed.
Enjoy the result.
Data Flow
SuperMap iServer provides data flow service which realizes low latency and real-time data transfer between client and server. Data flow service uses WebSocket protocol to support full-duplex, two-way communication. The server can broadcast the result of real-time data analysis to the clients. Once the connection established between clients and data flow service, the clients can automatically receive broadcast data from the server.
Enjoy the result.
Data visualization
This guide will show you how to create data visualization with SuperMap iClient for MapboxGL.
Heat map
A heat map is a two-dimensional representation of data in which values are represented by colors. A simple heat map provides an immediate visual summary of information. There are three items to draw a heat map with SuperMap iClient for MapboxGL:
- Data. A heat map is created from point GIS data. Each data needs to have a geographical location and a weight value (can clearly represent the frequency of an event and the density of things distributed in a certain location, such as temperature, population density, etc.)
- Heat attenuation gradient fill color set. This set is used to render a gradient of each hot spot as it decays from the center outward
- Raduis. Each hotspot needs to be calculated for the attenuation from the center of the outer point according to the radius, and the color value that needs to be rendered for each pixel in the heat attenuation zone, then rendered in client.
Since the attenuation of the heat map is based on pixel, the visual effect is excellent, but it cannot be in one-to-one correspondence with the specific data. It can only indicate the difference between the weights, so it can be used for some precision requirements that are not high and need to be emphasized. In the gradual industry, for example, it is possible to make a weather effect comparison dynamic effect map, a seismic point intensity map, and the like.
Example code.
Enjoy the result.
GraphicLayer
GraphicLayer mainly for point rendering of large data volumes on the web front-end. GraphicLayer supports the selection of object events.
This example needs to import
Let's take the New York taxi pick-up point as an example for visual display.
Import papaparse.min.js
Enjoy the result.
ECharts
ECharts is an open source visualization library based on JavaScript. It runs smoothly on PCs and mobile devices. It is compatible with most browsers (IE8/9/10/11, Chrome, Firefox, Safari, etc.). Echarts relies on ZRender, a lightweight vector graphics library that provides intuitive, interactive rich, highly customizable data visualization charts.
ECharts provides general line charts, histograms, scatter plots, pie charts, K-line charts, box plots for statistics, maps for geographic data visualization, heat maps, line graphs, for relational data visualization. Diagrams, treemaps, sunbursts, parallel coordinates for multidimensional visualization, funnel plots for BI, dashboards, and support for mashups between graphs and graphs.
This example needs to import
Taking the special effect map of Changchun bus route as an example, the data of the bus route is visualized:
Enjoy the result.
EChartsGL
ECharts GL is a WebGL extension of ECharts, which provides 3D scatter plots, flying lines, histograms, surface maps, and other 3D visualization methods. And by adding scatterGL, the graphGL series types are used for two-dimensional scatter plots, accelerated drawing and layout of diagrams.
This example needs to import
The following is an example of global wind energy, which visualizes wind energy data:
Enjoy the result.
DeckGL
DeckGL is a WebGL-based large data volume visualization framework developed and open sourced by Uber.
It features different types of visual layers, high performance for GPU rendering, React and Mapbox GL integration, combined with geographic information data (GPS) features.
This example needs to import
The following example shows the honeycomb layer display of the data.
Enjoy the result.
MapV
Mapv is an open source geographic data visualization library that can be used to display a large amount of geographic data, point, line, and surface data. Each type of data also has different display types, such as direct dot, heat map, grid, and aggregation.
MapV can display a large number of point data, which can be in the form of heat map, grid, honeycomb, point aggregation, color interval, radius, and so on. MapV can display a large number of line data, such as ordinary line drawing, highlighting overlay, heat line data display, etc., as well as various animation effects, suitable for scenes with a large number of tracks. A large number of custom surface data can also be displayed, which is displayed by color interval. The administrative area is also one of the application scenarios and can be used directly.
This example needs to import
SuperMap iClient for MapboxGL supports for using MapV visualization layer
Taking the MapV strong boundary map as an example to visualize the data.
Specify configuration items and data for the chart.
Enjoy the result.
threejs
Three.js is an open source mainstream 3D drawing JS library (the name Three is the meaning of 3D), the original author is Mr.Doob, the project address is: https://github.com/mrdoob/three.js/. We know that WebGL is a web 3D drawing standard. Just as jQuery simplifies HTML DOM operations, Three.js simplifies WebGL programming.
This example needs to import
SuperMap iClient for MapboxGL supports for using three.js visualization layer.
Enjoy the result.
Web symbol
Web symbols cover SuperMap iDesktop, SuperMap iDesktopX part of the point line polygon symbols, users can quickly add symbols to the map by Web Symbol ID . At the same time, you can also customize the symbols according to the symbol specification. This section mainly introduces the introductory usage of Web symbols, please refer to the API page for detailed interface.
Import
Import files
First, import MapboxGL v1 and SuperMap iClient for MapboxGL .
Then, set the basePath to the absolute or relative path to the resources folder, depending on the following two scenarios.
-
Default resources folder path
If the resources folder is placed in the same level as the entry HTML file, you do not need to configure the basePath and can just use the default value.
-
Customize the resources folder path
First, download the SuperMap iClient for MapboxGL package, move the resources folder to any location in the project.
Then, set basePath to the resources folder absolute or relative to the entry HTML path.
npm
First, npm install @supermapgis/iclient-mapboxgl .
Then, move the resources folder under the @supermapgis/iclient-mapboxgl installation package to any folder in the project root directory.
Next, set basePath to the absolute or relative root path to the resources folder.
Get started wuickly
Symbol Specification
Web symbols are symbol objects consisting of paint , layout (except visibility property) in Mapbox Layers.
Using Web Symbols
First, get Web Symbol ID.
Then, initialize the Web symbol with new mapboxgl.supermap.WebSymbol().init, specify the symbol resource path.
And then, use the interface loadSymbol to load Web symbols.
Next, use the interface addSymbol to add symbols to the map.
Finally, the layer is added using the interface addLayer while the layer sets the Web symbol.
Example code.
Enjoy the result.
Using Custom Web Symbols
First, use the new mapboxgl.supermap.WebSymbol().init to initial Web symbol.
Then, use the interface addSymbol to add symbols to the map.
Next, use the interface addLayer to add the layer and set the Web symbol for the layer.
Example code.
Enjoy the result.