JetkeySmartMap Send comments on this topic.
Using Map Values as Input Parameters
See Also

Glossary Item Box

You can insert the following Smart Map values into your queries as input parameters:

centerlat Center Latitude. Latitude of the center point at runtime.
centerlng Center Longitude. Longitude of the center point at runtime.
zoomlevel Zoom Level. Zoom level of map at runtime.
minlat Minimum Latitude.  The latitude of the southwest corner of map.
minlng Minimum Longitude. The longitude of the southwest corner of map.
maxlat Maximum Latitude. The latitude of the northeast corner of map.
maxlng Maximum Longitude. The longitude of the northeast corner of map.

 

 You do not need to pass any of these parameters through the querystring.  Smart Map will automatically pass fresh map values to any query that needs them as input parameters.

 

Example

The following query finds all countries within a given radius of the map's current center point. 

SELECT Country, Latitude, Longitude
FROM JetkeyCountry
WHERE dbo.distance({centerlng}, {centerlat},Longitude,Latitude) <= {radius}

 Smart Map installed a function called dbo.distance() that allows you to find the distance between two points.  We use this function here to help us find all points in a table that are within a certain radius of the map's center point.
 The distance() function is only installed in the DotNetNuke database where SmartMap is installed.  If you want to use this function in another database then you'll need to add the function there.
Countries within a given radius
EnlargeClick to enlarge
In this example, two required values must pass through the querystring to the query: the QID (queryID) and radius in miles.  The lat/lng values are optional because they are supplied to the query by the centerlat and centerlng map properties.  I added lat/lng values to the querystring in this case only because I wanted to first center the map on Paris and then display all countries within a 500 mile radius of Paris.

http://smartmap.jetkey.com/Example/tabid/54/Default.aspx?lat=48.85&lng=2.347&qid=2&radius=500

Here is the same example with a circle of 500 miles radius added as an overlay:

http://smartmap.jetkey.com/Example/tabid/54/Default.aspx?lat=48.85&lng=2.347&qid=2&radius=500&geometry=circle&radius=500&bordercolor=green&borderwidth=2&fillcolor=blue&fillopacity=.25

See Also

Geometry
Drawing Circles