GeoServer is an open-source server that facilitates geospatial data sharing, processing, and editing. When dealing with a large set of geospatial data, we generally use WMS service to get the image of the features at a lower zoom level. This reduces the load on the browser to render millions of data. Then after a specific zoom level, we use the WFS service to fetch the features and attributes that can be used to plot the geospatial data on the map.
When the WMS service is called, GeoServer uses the SQL query defined in the layer and fetches the data from the database. This data is converted into an image tile by GeoServer, which is then sent as a response to the client. In the WFS service, data is fetched using the same SQL query and then transformed into an object of features with projection metadata.
With the increase in the data set, the processing time of GeoServer also increases to transform the data into an object or a buffer image. On the client side, Leaflet also takes time to render each feature (geospatial points) on the map. Also, the entire process is repeated when the map is moved, or any zoom operations are performed on it.
To tackle this, vector grids were used. A vector grid calls GeoServer to get the object of features only once. Then it caches all the grids generated for the map. This reduces the processing time when the map is moved or zoomed. Then again, the cache storage starts affecting the browser’s performance as the data increases.
We faced this when we tried to render a layer with 5.4 million data. The vector grid tried to process and cache 5.4 million data when zoomed out to the max. This process took a heavy toll on the browser, forcing it to crash. This limitation forced us to render the layer only at a zoom level of 10 miles and not above 10 miles.
We tried to render image tiles for the zoom level above 10 miles using GeoServer. But when we tried calling the WMS service to fetch a buffer image of 5.4 million data, it took around 2-3 minutes to get fully rendered buffer images, which is not an efficient response time for a WMS request.
Now, what is the solution to this problem?
Solution: ArcGIS Online
ArcGIS Online is the tool that can be used to tackle this problem. ArcGIS Online is a cloud-based mapping and analysis solution used to make maps, analyze data, share, and collaborate. We are going to use the data-sharing feature of ArcGIS Online.
ArcGIS Online allows us to create hosted image tile layers using hosted feature layer. It creates prebuilt image tiles at different zoom levels using the data in the hosted feature layer. Here, image tiles are built at the time of layer creation, and all the tiles are hosted on imagine service. Whenever a request is sent, ArcGIS Online will fetch the prebuilt image tile for the current level and sends it for the client to render.
How does it solve the problem
When a user tries to toggle the layer with 5.4 million data, it doesn’t show anything on the map if the zoom level is above 10 miles. The user must zoom 10 miles or lower to render the data. This was done to reduce the load on the browser when the vector grid starts caching the tiles. And if we use the image tiles of GeoServer, it takes around 2-3 minutes to transform fetched data from the database to image tiles.
Image tiles in ArcGIS are prebuilt tiles, which means the ArcGIS server already transforms data into image tiles at the time of layer creation. Using ArcGIS image tiles, the layer network call will quickly fetch and render all the prebuilt tiles. This process takes around 3-5 seconds.
How to use hosted image tile layer service
Here, we’ll take an example of Global Plant plotting using latitude and longitude.
Create one .csv file containing the latitude and longitude of each Global Plant.
In the case of Postgres, using the following query to generate the data for export
Here “surface location” is a geometry column containing latitude and longitude.
Once data is generated, click on the export icon at the bottom and export it as a .csv file.
Sign in to your ArcGIS organizational account.
3. On the ribbon, click Content.
Click New Item.
Drag your downloaded .csv file into the New Item window from your computer and then update the details.
Make sure that Add .csv file and Create a hosted feature layer or table options are selected, then click Next.
On the Fields page, leave all the fields on and click Next.
select the columns representing Latitude and Longitude on the Location settings page and click Next.
In the New Item page, fill all required fields and click Save.
Wait for the feature to get published, and you’ll be redirected to the Feature Overview page.
Click on the Visualization tab and change the style of the symbols as per your requirement. This is required because the image layer that is created by the feature layer uses the style options of the feature layer. Later you cannot change the style of your image tiles.
On the Feature Overview page, on the right of the screen, click on Publish, then Tile Layer. This will start creating an image layer using a feature layer.
In Create a tile layer page, leave all the fields as they are and click on Next.
Then fill in the required details like tile, Folder, Tags, and Summary and click on Save.
Wait for the image layer to get published, and you’ll be redirected to the overview page.
On the Image layer overview page, click on the Settings ribbon.
In the Settings page, scroll down to Tile Layer (hosted) section and adjust the Visible Range to make the image layers visible on those zoom ranges.