At times, it is visually appealing to show a geographical map of a town/state/country in a report. For instance, consider a report showing facts (like area, population, etc) of states of a Country (grouped by the State). Adding the map of the state in the report will increase the visual appeal of the information to the end users. A map as an image can be shown on the report quite easily. Whenever an image has to be shown in a report, it has to be stored somewhere locally or on the server where the report will be rendered. This approach is showcased in one of the samples ( CountryFacts.rdlx) which is shipped with ActiveReports 7. In this report the image is fetched from a local folder. However, implementing some scenarios like getting the images from a live location, or storing all the images on the local folder may not be a feasible. If we consider the limitation of storing all the images of a location on the server, fetching the maps (image) from some service provider on demand is the best alternative solution. Google Maps provides the necessary API's to fetch a map of a location on the fly. For example, image map of London city can be fetched using the URL: maps.googleapis.com/maps/api/staticmap?center=London&zoom=14&size=400x400&sensor=false . This returns a 400x400 pixel image which can be further used inside a report. The Source property of an Image ReportItem is set to External, and the Value property set to the Google Maps URL. This will show the map of London city inside the report. This solution is explained in Google Maps sample RDLX file which available from the link below. In this sample, there are three values for the report parameter City and on the basis of the parameter, map (as image) of the city is fetched from Google Maps and displayed in the report. GoogleImage.rdlx
← Back to all blogs
What's new in the latest releases
For more information, contact Amy Reese at firstname.lastname@example.org.