What is Geospatial Data?

Data-driven businesses now have access to more types of information than ever before, including geospatial data that describes the world around us. So what is geospatial data exactly, and how can you best make use of geospatial data?

What is geospatial data?

Geospatial data is data that describes the geography of the Earth, including physical features, events, and weather. Every time you plan a route on Google Maps, or tag your location on Instagram or Snapchat, you're using geospatial data.

To be most effective, geospatial data usually needs multiple facets or components. Suppose that you want to use a weather app to find out more information about an approaching thunderstorm. The app will rely on geospatial data containing:

  • Location information about a geographic position (e.g. a building, road, mountain, lake, or other geographic entity). Location information is often expressed in latitude and longitude coordinates.
  • Attribute information about the characteristics of the feature, object, or phenomena at that location (e.g. the estimated strength and direction of the storm).
  • Temporal information about the time and/or lifespan of the location and attributes (e.g. the estimated length of time the storm will last).

What are the types of geospatial data?

Along with these different components, geospatial data may also come in several different formats. The types of geospatial data include: 

  • Vector geospatial data: Vector geospatial data is composed of various points and directions. These vectors can be treated as individual points and lines, or they can be grouped into polygons or 3D geometries that denote physical or political boundaries.
  • Raster geospatial data: Raster geospatial data is composed of pixels or grids. The types of raster geospatial data include maps, topographical charts, photographs, and satellite images.
  • Tabular geospatial data: Tabular geospatial data is organized into tables, and is often used to enhance other types of geospatial data. Examples of tabular geospatial data include weather records, addresses, and agricultural patterns.

How is geospatial data used?

Geospatial data has a wide variety of applications.

  • Agriculture: Geospatial data is essential for weather and climate predictions, and can help inform forecasts about annual crop yields.
  • Healthcare: Epidemiology is one field of healthcare that can greatly benefit from geospatial data. By tracking the spread of disease within a particular geographic area, epidemiologists can better formulate prevention methods and understand which populations are most at risk.
  • Finance: Geospatial data can help enhance finance professionals' search for the best-performing investments. For example, geospatial data can be used to visualize real estate holdings and track demographic changes over time.
  • Transportation: Whether it's across the street or across the country, geospatial data helps you calculate the fastest or most efficient route. GPS systems, which are a crucial component of modern logistics and operations, rely on geospatial data to track vehicle locations.

Geospatial data in Redis

No matter which geospatial data you have, or how you choose to use it, you need a robust data storage method. Redis is an open-source, in-memory data structure store used to implement NoSQL key-value databases and caches.

Because Redis runs in-memory, it can handle millions of operations per second even on relatively modest hardware, which makes it an excellent choice for high-performance applications running geospatial data. Redis comes with some pre-built geospatial data commands for working with coordinate dataŚmore specifically, latitude and longitude pairs:

  • GEOADD: This command adds a new object (i.e. a latitude-longitude pair) to a geospatial index.
  • GEOPOS: This command returns the geographical position of the given object.
  • GEODIST: This command returns the geographical distance between two objects in the units of your choosing (feet, meters, miles, or kilometers).
  • GEORADIUS: Given an object and a radius around that object, this command returns the objects that are within that radius.
  • ZREM: This command deletes members from the index.

While Redis has many features to recommend it, including geospatial data, it isn't automatically compatible with programming languages such as Java out of the box. Many Java developers using Redis choose to install a third-party Redis Java client such as Redisson.

Redisson implements Redisson's geospatial data functionality with the RGeo interface. Below is an example of how to use the RGeo interface in Redisson. As you can see, RGeo includes methods that return a geographical position, return objects within a given radius, and calculate distance, just like the original Redis commands:

RGeo<String> geo = redisson.getGeo("test");
geo.add(new GeoEntry(13.361389, 38.115556, "Palermo"), 
        new GeoEntry(15.087269, 37.502669, "Catania"));
geo.addAsync(37.618423, 55.751244, "Moscow");

Double distance = geo.dist("Palermo", "Catania", GeoUnit.METERS);
geo.hashAsync("Palermo", "Catania");
Map<String, GeoPosition> positions = geo.pos("test2", "Palermo", "test3", "Catania", "test1");
List<String> cities = geo.radius(15, 37, 200, GeoUnit.KILOMETERS);
Map<String, GeoPosition> citiesWithPositions = geo.radiusWithPosition(15, 37, 200, GeoUnit.KILOMETERS);
Similar terms