Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

We Value Your Feedback!
Could you please spare a few minutes to share your thoughts on Cloud Connected vs On-Premise Services. Your feedback can help us shape the future of services.
Learn more about the survey or Click here to Launch the survey
Schneider Electric Services Innovation Team!

Designing Queries for GIS Map Markers

Geo SCADA Knowledge Base

Access vast amounts of technical know-how and pro tips from our community of Geo SCADA experts.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • Knowledge Center
  • Geo SCADA Knowledge Base
  • Designing Queries for GIS Map Markers
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Labels
Top Labels
  • Alphabetical
  • database 32
  • Web Server and Client 31
  • WebX 19
  • Request Form 18
  • Lists, Events & Alarms 16
  • ViewX 15
  • Application Programming 12
  • Setup 12
  • Telemetry 8
  • Events & Alarms 7
  • Lists 7
  • Mimic Graphics 7
  • Downloads 6
  • Support 5
  • IoT 5
  • SCADA 5
  • Geo SCADA Expert 5
  • Drivers and Communications 4
  • Security 4
  • DNP 3 3
  • IEC 61131-3 Logic 3
  • Trends and Historian 2
  • Virtual ViewX 2
  • Geo Scada 1
  • ClearSCADA 1
  • Templates and Instances 1
  • Releases 1
  • Maps and GIS 1
  • Mobile 1
  • Architectures 1
  • Tools & Resources 1
  • Privacy Policy 1
  • OPC-UA 1
  • Previous
  • 1 of 4
  • Next
Latest Blog Posts
  • OPC UA - Driver and Server
  • Requirements for Generating a Valid OPC UA Server Certificate
  • Load Events Using LoadRecord and LoadRecords
  • Geo SCADA Embedded Component Licenses
  • Geo SCADA 2023 Known Issues
Related Products
product field
Schneider Electric
EcoStruxure™ Geo SCADA Expert

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Anonymous user
Not applicable
‎2021-06-09 02:52 PM
0 Likes
0
1181
  • Bookmark
  • Subscribe
  • Email to a Friend
  • Printer Friendly Page
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-06-09 02:52 PM

Designing Queries for GIS Map Markers

Originally published on Geo SCADA Knowledge Base by Anonymous user | June 09, 2021 11:52 PM

📖 Home  Back  
As a simpler alternative to specifying the Query SQL within the Map Set Hyperlink, a User Query object can be used to hold a configured database query of ClearSCADA objects to be displayed on maps. When configured, a 'Display Query Results' context menu on the User Query object will display the query results in a list, which is useful for testing the SQL query. Each individual entry within the SQL query list should translate to a Map Marker when shown on a map, although entries with the same location will appear superimposed over each other, obscuring view of some markers. Data referred to by the SQL query will be updated when the map moves or once per minute only.

The following SQL column names are used to define the behavior of the marker:

  • FullName (used as the Object Reference for the Pick Menu)
  • Foreground
  • Background
  • Blink, and
  • Tooltip (an optional extension to override the text shown in the hover tooltip).
  • MarkerShape
  • MarkerText (displayed adjacent to the marker, you can include emoji, e.g. CHAR(127981)
  • MarkerTextColor
  • MarkerTextOutline (color)
  • MarkerTextSize 
  • MarkerTextOffset (vertical)
  • DefaultAction (causes a specific menu action on left-select, e.g. 'mimic.alarm'
  • MarkerSize (0 to 100, default 10)


SQL queries within hyperlinks to display assets on a map need to contain the following columns as a minimum:

  • FullName (object name -- used to generate the default tooltip and context menu)
  • GISLocation->Latitude (Latitude)
  • GISLocation->Longitude (Longitude)


The above columns are parsed based on Name rather than Attribute, allowing for color animations to be customized as required. The tooltip can contain HTML formatting codes.

As an example, the following map hyperlink uses the AlarmSetCount, AlarmAcceptedCount and AlarmClearedCount variables on CGroup to manipulate the Foreground color, adjusting the color used to display the associated map icon for each Group. The ordering of the result set will display the assets with active alarms on top of those without, if there is any overlap:

SELECT 
FULLNAME,
FULLNAME || 'Highest_Severity:_' || AlarmSeverityDesc as "TOOLTIP",
GISLOCATION->LATITUDE, GISLOCATION->LONGITUDE,
CASE WHEN AlarmSetCount > 0 THEN 255  
WHEN AlarmAcceptedCount > 0 THEN 255
   WHEN AlarmClearedCount > 0 THEN 150*256
ELSE 0 END AS "Foreground",
Background,
CASE WHEN AlarmSetCount > 0 THEN 1 ELSE 0 END AS "Blink",
AlarmSetCount,
AlarmAcceptedCount,
AlarmClearedCount
FROM CGROUP
ORDER BY AlarmSetCount, AlarmAcceptedCount, AlarmClearedCount

Query column names are not case-sensitive, and should not contain the table name or alias; therefore, a column alias should be used if more than one table is referenced in the query. The following example will display a smooth range of colors as the symbol foreground based on the value of a point associated with a group's location:

SELECT g.Id as "Id", g.FullName as "FullName",g.FullName || '
Value: ' || FormatValue (r.Walk Using '0.00') as "Tooltip",g.GISLOCATION->LATITUDE as "GISLOCATION->LATITUDE", g.GISLOCATION->LONGITUDE as "GISLOCATION->LONGITUDE",casewhen r.Walk < 50 then (cast(r.Walk/100*2*255 as INT) + 255*256)when r.Walk > 50 then (255 + cast( (100-r.Walk)/100*2*255 as INT)*256)end as "Foreground",255+256*255+256*256*255 as "Background", 0 as "Blink"FROM CGROUP AS g left join CRandom as r on r.ParentGroupId = g.IdWHERE g.FULLNAME LIKE 'Sites.%'


Note - Aliases
If you are using table alias names for (e.g. FROM CGROUP AS g) then you must alias the column too, i.e. g.GISLOCATION->LATITUDE as "GISLOCATION->LATITUDE". It is important that you use the AS keyword for table and column aliases. While it can be omitted and the query will work, the keyword must be present for the map to parse the query.

Note -- Spacing
Take care with spacing between the SELECT keyword and column name, and between the WHERE keyword and column names. You can check the database server log to see how the query has been interpreted and modified.

Note -- Linked Tables and nested SELECTs
The query used by the map display is altered automatically by the map code. This is to limit the data retrieved by the query because the markers are outside the bounds of the display. The following additional WHERE clause is added, and if there is an existing WHERE clause it is added with an additional AND keyword:

WHERE (GEOPOSITION WITHIN REGION '5.05811437435571,-95.017822265625' TO '-5.05811437435572,-60.982177734375' )


When using data from external databases, and that database is a Geo SCADA or ClearSCADA server, you may need to use a nested SELECT may be needed as in the following:

SELECT * FROM ( SELECT TOP (5000)                 A.FULLNAME, B.LATITUDE AS "GISLOCATION->LATITUDE", B.LONGITUDE AS "GISLOCATION->LONGITUDE"                 FROM                          ODBC_GROUP AS A JOIN ODBC_TEST AS B ON A.ID = B.ID                 WHERE (A.GISLOCATIONSOURCE = True)         ))


If the external database is not Geo SCADA or ClearSCADA, the SQL of that external database will not support the 'WITHIN REGION' clause. If this is the case, then you may alter the query to prevent the additional WHERE clause from being added by including an additional WHERE clause within a nested SELECT, though this will affect performance because the map will query all rows. Do this by including There is a limit of 5000 records in map queries which will apply in this case.

Note -- Sorting
Map markers will be drawn from the start of the results to the end. By using an ORDER BY clause you can control which markers appear on top. You may wish to take advantage of this to display significant locations last, such as those indicating alarm states.


Go: Home Back

Labels:
  • database

  • Maps and GIS

Author

Biography

Anonymous user

Link copied. Please paste this link to share this article on your social media post.

  • Back to Blog
  • Newer Article
  • Older Article
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of