-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathVirtualSpatialData.html
More file actions
472 lines (425 loc) · 28.7 KB
/
VirtualSpatialData.html
File metadata and controls
472 lines (425 loc) · 28.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
<!DOCTYPE html>
<html lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Virtual Spatial Data — MapServer 8.6.1 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="../../_static/sphinx.css?v=48f05237" />
<link rel="stylesheet" type="text/css" href="../../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../../_static/custom.css?v=dd298242" />
<link rel="stylesheet" type="text/css" href="../../_static/ribbon.css?v=ea091bf4" />
<script src="../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../_static/documentation_options.js?v=ad95d4c4"></script>
<script src="../../_static/doctools.js?v=fd6eb6e6"></script>
<script src="../../_static/sphinx_highlight.js?v=6ffebe34"></script>
<script src="../../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../../_static/copybutton.js?v=f281be69"></script>
<link rel="icon" href="../../_static/mapserver.ico"/>
<link rel="author" title="About these documents" href="../../about.html" />
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="copyright" title="Copyright" href="../../copyright.html" />
<link rel="next" title="WFS" href="wfs.html" />
<link rel="prev" title="Vector field rendering - UVraster" href="vector_field.html" />
</head><body>
<!-- for main branch only, do not backport this -->
<table width="100%" style="width: 100%; background-color: white;">
<tr>
<td rowspan="2" style="padding: 10px 0px 10px 10px;">
<a href="../../index.html" title="Home"><img src="../../_static/banner.png" alt="MapServer banner" border="0" /></a>
</td>
<td style="padding: 10px 10px 0px 0px; text-align: right; vertical-align: top;">
<a href="../../index.html" title="Home">Home</a> |
<a href="../../products.html" title="Products (MapServer core, MapCache, TinyOWS">Products</a> |
<a href="https://github.com/mapserver/mapserver/issues/" title="Issue Tracker (MapServer core)">Issue Tracker</a> |
<a href="../../community/service_providers.html" title="Professional Service Providers">Service Providers</a> |
<a href="../../faq.html" title="Frequently Asked Questions">FAQ</a> |
<a href="https://fosstodon.org/@mapserver" title="Mastodon" target="_blank">Mastodon</a> |
<a href="../../download.html" title="Download Source or Binaries">Download </a> |
<a class="badge" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KRJ2X44N3HA6U&source=url" target="_blank">
<img src="https://img.shields.io/badge/donate-%E2%9D%A4%C2%A0-ff69b4.svg?style=flat" alt="Donate to MapServer">
</a>
</td>
</tr>
<tr>
<td style="padding: 0px 10px 0px 0px; text-align: right; vertical-align: bottom;">
<img src="../../_static/flagicons/en.png" alt="en" title="en" border="0" width="18px" height="13px"/>
<a href="../../ar/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/ar.png" alt="ar" title="ar" border="0" /></a>
<a href="../../de/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/de.png" alt="de" title="de" border="0" /></a>
<a href="../../el/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/el.png" alt="el" title="el" border="0" /></a>
<a href="../../es/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/es.png" alt="es" title="es" border="0" /></a>
<a href="../../fr/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/fr.png" alt="fr" title="fr" border="0" /></a>
<a href="../../id/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/id.png" alt="id" title="id" border="0" /></a>
<a href="../../it/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/it.png" alt="it" title="it" border="0" /></a>
<a href="../../ja/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/ja.png" alt="ja" title="ja" border="0" /></a>
<a href="../../nl_NL/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/nl_NL.png" alt="nl_NL" title="nl_NL" border="0" /></a>
<a href="../../pl/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/pl.png" alt="pl" title="pl" border="0" /></a>
<a href="../../ru/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/ru.png" alt="ru" title="ru" border="0" /></a>
<a href="../../sq/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/sq.png" alt="sq" title="sq" border="0" /></a>
<a href="../../tr/input/vector/VirtualSpatialData.html"><img src="../../_static/flagicons/tr.png" alt="tr" title="tr" border="0" /></a>
</td>
</tr>
</table>
<div class="related" role="navigation" aria-label="Related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="wfs.html" title="WFS"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="vector_field.html" title="Vector field rendering - UVraster"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../../index.html">Home</a> »</li>
<li class="nav-item nav-item-1"><a href="../../documentation.html" >MapServer 8.6.1 Documentation</a> »</li>
<li class="nav-item nav-item-2"><a href="../index.html" >Data Input</a> »</li>
<li class="nav-item nav-item-3"><a href="index.html" accesskey="U">Vector Data</a> »</li>
<li class="nav-item nav-item-this"><a href="">Virtual Spatial Data</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="virtual-spatial-data">
<span id="virtual-vector"></span><h1><a class="toc-backref" href="#table-of-contents" role="doc-backlink">Virtual Spatial Data</a><a class="headerlink" href="#virtual-spatial-data" title="Link to this heading">¶</a></h1>
<dl class="field-list simple">
<dt class="field-odd">Author<span class="colon">:</span></dt>
<dd class="field-odd"><p>Jeff McKenna</p>
</dd>
<dt class="field-even">Contact<span class="colon">:</span></dt>
<dd class="field-even"><p>jmckenna at gatewaygeomatics.com</p>
</dd>
<dt class="field-odd">Last Updated<span class="colon">:</span></dt>
<dd class="field-odd"><p>2021-05-05</p>
</dd>
</dl>
<nav class="contents" id="table-of-contents">
<p class="topic-title">Table of Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#virtual-spatial-data" id="id1">Virtual Spatial Data</a></p>
<ul>
<li><p><a class="reference internal" href="#types-of-databases" id="id2">Types of Databases</a></p></li>
<li><p><a class="reference internal" href="#types-of-flat-files" id="id3">Types of Flat Files</a></p></li>
<li><p><a class="reference internal" href="#steps-for-display" id="id4">Steps for Display</a></p></li>
</ul>
</li>
</ul>
</nav>
<p>OGR’s <a class="reference external" href="https://gdal.org/drivers/vector/vrt.html">VRT driver</a> allows you to
connect to databases in MapServer that do not explicitly hold spatial data,
as well as flat text files. Your data must have an X and a Y column, and the data
may be accessed through an ODBC connection or a direct pointer to a text file.</p>
<p>The original <a class="reference external" href="https://github.com/MapServer/MapServer/wiki/VirtualSpatialData">VirtualSpatialData</a> wiki page may contain additional information.</p>
<section id="types-of-databases">
<h2><a class="toc-backref" href="#table-of-contents" role="doc-backlink">Types of Databases</a><a class="headerlink" href="#types-of-databases" title="Link to this heading">¶</a></h2>
<p>The VirtualSpatialData OGR extension has been tested with the
following databases and should, in theory, support all ODBC
data sources.</p>
<ul class="simple">
<li><p>Oracle</p></li>
<li><p>MySQL</p></li>
<li><p>SQL Server</p></li>
<li><p>Access</p></li>
<li><p>PostgreSQL</p></li>
</ul>
</section>
<section id="types-of-flat-files">
<h2><a class="toc-backref" href="#table-of-contents" role="doc-backlink">Types of Flat Files</a><a class="headerlink" href="#types-of-flat-files" title="Link to this heading">¶</a></h2>
<p>Comma, tab or custom delimited text/flat files work with VirtualSpatialData.</p>
</section>
<section id="steps-for-display">
<h2><a class="toc-backref" href="#table-of-contents" role="doc-backlink">Steps for Display</a><a class="headerlink" href="#steps-for-display" title="Link to this heading">¶</a></h2>
<section id="create-the-datasource-name-dsn">
<h3>1. Create the Datasource Name (DSN)<a class="headerlink" href="#create-the-datasource-name-dsn" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Specific notes about creating a DSN on Windows and Linux can be found by
searching the MapServer reference documents site</p></li>
<li><p>On some Windows systems you must create a SYSTEM DSN.</p></li>
</ul>
</section>
<section id="test-your-connection">
<h3>2. Test your Connection<a class="headerlink" href="#test-your-connection" title="Link to this heading">¶</a></h3>
<p>Test your connection with ogrinfo. The syntax for this command is:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">></span> <span class="n">ogrinfo</span> <span class="n">ODBC</span><span class="p">:</span><span class="n">user</span><span class="o">/</span><span class="k">pass</span><span class="nd">@DSN</span> <span class="n">table</span>
</pre></div>
</div>
<p>Windows users may not be required to specify a user/password, so the syntax would be:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">></span> <span class="n">ogrinfo</span> <span class="n">ODBC</span><span class="p">:</span><span class="nd">@DSN</span> <span class="n">table</span>
</pre></div>
</div>
<p>Example: Accessing a comma separated text file through ODBC using ogrinfo</p>
<p>The following is a snippet of the flat text file coal_dep.txt containing lat/long points:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">unknown</span><span class="p">,</span><span class="n">na</span><span class="p">,</span><span class="nb">id</span><span class="p">,</span><span class="n">id2</span><span class="p">,</span><span class="n">mark</span><span class="p">,</span><span class="n">coalkey</span><span class="p">,</span><span class="n">coalkey2</span><span class="p">,</span><span class="n">long</span><span class="p">,</span><span class="n">lat</span>
<span class="mf">0.000</span><span class="p">,</span><span class="mf">0.000</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">7</span><span class="p">,</span><span class="mi">87</span><span class="p">,</span><span class="mi">87</span><span class="p">,</span><span class="mf">76.90238</span><span class="p">,</span><span class="mf">51.07161</span>
<span class="mf">0.000</span><span class="p">,</span><span class="mf">0.000</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">7</span><span class="p">,</span><span class="mi">110</span><span class="p">,</span><span class="mi">110</span><span class="p">,</span><span class="mf">78.53851</span><span class="p">,</span><span class="mf">50.69403</span>
<span class="mf">0.000</span><span class="p">,</span><span class="mf">0.000</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">112</span><span class="p">,</span><span class="mi">112</span><span class="p">,</span><span class="mf">83.22586</span><span class="p">,</span><span class="mf">71.24420</span>
<span class="mf">0.000</span><span class="p">,</span><span class="mf">0.000</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">114</span><span class="p">,</span><span class="mi">114</span><span class="p">,</span><span class="mf">80.79896</span><span class="p">,</span><span class="mf">73.41175</span>
</pre></div>
</div>
<p>If the DSN name is Data_txt, the ogrinfo command to see a list of applicable files in the directory is:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>> ogrinfo ODBC:jeff/test@Data_txt
INFO: Open of `ODBC:jeff/test@Data_txt'
using driver `ODBC' successful.
1: coal_dep.csv
2: coal_dep.txt
3: coal_dep_nf.txt
4: coal_dep_trim.txt
5: Copy of coal_dep.txt
6: deposit.csv
7: maruia.asc
8: oahuGISbathy.csv
9: oahuGISbathy.txt
10: on_pts.txt
11: on_pts_utm.txt
12: test.txt
13: utm_test.txt
</pre></div>
</div>
<p>Username and password may be optional, so the following may also be valid:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">></span> <span class="n">ogrinfo</span> <span class="n">ODBC</span><span class="p">:</span><span class="nd">@Data_txt</span>
</pre></div>
</div>
<p>Therefore, the command to see more information about one of the specific layers is:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>> ogrinfo ODBC:@Data_txt coal_dep.txt
INFO: Open of `ODBC:@Data_txt'
using driver `ODBC' successful.
Layer name: coal_dep.txt
Geometry: Unknown (any)
Feature Count: 266
Layer SRS WKT:
(unknown)
UNKNOWN: String (255.0)
NA: String (255.0)
ID: String (255.0)
ID2: String (255.0)
MARK: String (255.0)
COALKEY: String (255.0)
COALKEY2: String (255.0)
LONG: String (255.0)
LAT: String (255.0)
OGRFeature(coal_dep.txt):0
UNKNOWN (String) = 0.000
....
</pre></div>
</div>
</section>
<section id="create-a-virtual-data-file">
<h3>3. Create a Virtual Data File<a class="headerlink" href="#create-a-virtual-data-file" title="Link to this heading">¶</a></h3>
<p>This is a file with an ovf extension and looks like the following:</p>
<div class="highlight-xml notranslate"><div class="highlight"><pre><span></span><span class="nt"><OGRVRTDataSource></span>
<span class="w"> </span><span class="nt"><OGRVRTLayer</span><span class="w"> </span><span class="na">name=</span><span class="s">"mylayer"</span><span class="nt">></span>
<span class="w"> </span><span class="nt"><SrcDataSource></span>ODBC:user/pass@DSN<span class="nt"></SrcDataSource></span>
<span class="w"> </span><span class="nt"><SrcLayer></span>tablename<span class="nt"></SrcLayer></span>
<span class="w"> </span><span class="nt"><GeometryType></span>wkbPoint<span class="nt"></GeometryType></span>
<span class="w"> </span><span class="nt"><LayerSRS></span>WGS84<span class="nt"></LayerSRS></span>
<span class="w"> </span><span class="nt"><GeometryField</span><span class="w"> </span><span class="na">encoding=</span><span class="s">"PointFromColumns"</span><span class="w"> </span><span class="na">x=</span><span class="s">"x"</span><span class="w"> </span><span class="na">y=</span><span class="s">"y"</span><span class="nt">/></span>
<span class="w"> </span><span class="nt"></OGRVRTLayer></span>
<span class="nt"></OGRVRTDataSource></span>
</pre></div>
</div>
<p>More information on ovf files can be found at: <a class="reference external" href="https://gdal.org/drivers/vector/vrt.html">https://gdal.org/drivers/vector/vrt.html</a></p>
<p>Example ovf file for coal_dep.txt:</p>
<div class="highlight-xml notranslate"><div class="highlight"><pre><span></span><span class="nt"><OGRVRTDataSource></span>
<span class="w"> </span><span class="nt"><OGRVRTLayer</span><span class="w"> </span><span class="na">name=</span><span class="s">"coal-test"</span><span class="nt">></span>
<span class="w"> </span><span class="nt"><SrcDataSource></span>ODBC:Data_txt<span class="nt"></SrcDataSource></span>
<span class="w"> </span><span class="nt"><SrcLayer></span>coal_dep.txt<span class="nt"></SrcLayer></span>
<span class="w"> </span><span class="nt"><GeometryField</span><span class="w"> </span><span class="na">encoding=</span><span class="s">"PointFromColumns"</span><span class="w"> </span><span class="na">x=</span><span class="s">"Long"</span><span class="w"> </span><span class="na">y=</span><span class="s">"Lat"</span><span class="nt">/></span>
<span class="w"> </span><span class="nt"><GeometryType></span>wkbPoint<span class="nt"></GeometryType></span>
<span class="w"> </span><span class="nt"></OGRVRTLayer></span>
<span class="nt"></OGRVRTDataSource></span>
</pre></div>
</div>
</section>
<section id="test-virtual-data-file-with-ogrinfo">
<h3>4. Test Virtual Data File with ogrinfo<a class="headerlink" href="#test-virtual-data-file-with-ogrinfo" title="Link to this heading">¶</a></h3>
<p>Use ogrinfo to test your new ovf file, such as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>> ogrinfo coal.ovf coal-test
ERROR 4: Update access not supported for VRT datasources.
Had to open data source read-only.
INFO: Open of `myfile.ovf'
using driver `VRT' successful.
Layer name: coal_dep.txt
Geometry: Unknown (any)
Feature Count: 266
Layer SRS WKT:
(unknown)
UNKNOWN: String (255.0)
NA: String (255.0)
ID: String (255.0)
ID2: String (255.0)
MARK: String (255.0)
...
</pre></div>
</div>
</section>
<section id="mapfile-layer">
<h3>5. Mapfile Layer<a class="headerlink" href="#mapfile-layer" title="Link to this heading">¶</a></h3>
<p>Using an ovf file your layer may look like:</p>
<div class="highlight-mapfile notranslate"><div class="highlight"><pre><span></span><span class="k">LAYER</span>
<span class="k">CONNECTION</span> <span class="s">"coal.ovf"</span>
<span class="k">CONNECTIONTYPE</span> <span class="nb">OGR</span>
<span class="k">DATA</span> <span class="s">"coal-test"</span>
<span class="k">METADATA</span>
<span class="s">"wms_srs"</span> <span class="s">"4326"</span>
<span class="s">"wms_title"</span> <span class="s">"coal-test"</span>
<span class="k">END</span>
<span class="k">NAME</span> <span class="s">"coal-test"</span>
<span class="k">SIZEUNITS</span> <span class="nb">PIXELS</span>
<span class="k">STATUS</span> <span class="nb">ON</span>
<span class="k">TOLERANCE</span> <span class="mi">0</span>
<span class="k">TOLERANCEUNITS</span> <span class="nb">PIXELS</span>
<span class="k">TYPE</span> <span class="nb">POINT</span>
<span class="k">UNITS</span> <span class="nb">METERS</span>
<span class="k">CLASS</span>
<span class="k">STYLE</span>
<span class="k">COLOR</span> <span class="mi">255</span> <span class="mi">0</span> <span class="mi">0</span>
<span class="k">MAXSIZE</span> <span class="mi">100</span>
<span class="k">MINSIZE</span> <span class="mi">1</span>
<span class="k">SIZE</span> <span class="mi">6</span>
<span class="k">SYMBOL</span> <span class="s">"star"</span>
<span class="k">END</span>
<span class="k">END</span>
<span class="k">END</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>For the CONNECTION, you can specify an absolute path, or a relative path. Relative paths
are interpreted relative to the SHAPEPATH first, if not found then MapServer will try again
relative to the .map location. For more information about connection rules please read
the MapServer <a class="reference internal" href="ogr.html#ogrmapfile"><span class="std std-ref">OGR</span></a> document.</p>
</div>
<p>Or you may specify the ovf contents inline such as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">LAYER</span>
<span class="n">CONNECTION</span> <span class="s2">"<OGRVRTDataSource></span>
<span class="o"><</span><span class="n">OGRVRTLayer</span> <span class="n">name</span><span class="o">=</span><span class="s1">'coal-test'</span><span class="o">></span>
<span class="o"><</span><span class="n">SrcDataSource</span><span class="o">></span><span class="n">ODBC</span><span class="p">:</span><span class="nd">@Data_txt</span><span class="o"></</span><span class="n">SrcDataSource</span><span class="o">></span>
<span class="o"><</span><span class="n">SrcLayer</span><span class="o">></span><span class="n">coal_dep</span><span class="o">.</span><span class="n">txt</span><span class="o"></</span><span class="n">SrcLayer</span><span class="o">></span>
<span class="o"><</span><span class="n">GeometryField</span> <span class="n">encoding</span><span class="o">=</span><span class="s1">'PointFromColumns'</span> <span class="n">x</span><span class="o">=</span><span class="s1">'Long'</span> <span class="n">y</span><span class="o">=</span><span class="s1">'Lat'</span><span class="o">/></span>
<span class="o"><</span><span class="n">GeometryType</span><span class="o">></span><span class="n">wkbPoint</span><span class="o"></</span><span class="n">GeometryType</span><span class="o">></span>
<span class="o"></</span><span class="n">OGRVRTLayer</span><span class="o">></span>
<span class="o"></</span><span class="n">OGRVRTDataSource</span><span class="o">></span><span class="s2">"</span>
<span class="n">CONNECTIONTYPE</span> <span class="n">OGR</span>
<span class="n">DATA</span> <span class="s2">"coal-test"</span>
<span class="n">METADATA</span>
<span class="s2">"wms_srs"</span> <span class="s2">"4326"</span>
<span class="s2">"wms_title"</span> <span class="s2">"coal-test"</span>
<span class="n">END</span>
<span class="n">NAME</span> <span class="s2">"coal-test"</span>
<span class="n">SIZEUNITS</span> <span class="n">PIXELS</span>
<span class="n">STATUS</span> <span class="n">ON</span>
<span class="n">TOLERANCE</span> <span class="mi">0</span>
<span class="n">TOLERANCEUNITS</span> <span class="n">PIXELS</span>
<span class="n">TYPE</span> <span class="n">POINT</span>
<span class="n">UNITS</span> <span class="n">METERS</span>
<span class="n">CLASS</span>
<span class="n">STYLE</span>
<span class="n">COLOR</span> <span class="mi">255</span> <span class="mi">0</span> <span class="mi">0</span>
<span class="n">MAXSIZE</span> <span class="mi">100</span>
<span class="n">MINSIZE</span> <span class="mi">1</span>
<span class="n">SIZE</span> <span class="mi">6</span>
<span class="n">SYMBOL</span> <span class="s2">"star"</span>
<span class="n">END</span>
<span class="n">END</span>
<span class="n">END</span>
</pre></div>
</div>
</section>
<section id="test-your-mapfile">
<h3>6. Test your Mapfile<a class="headerlink" href="#test-your-mapfile" title="Link to this heading">¶</a></h3>
<p>The first thing you should try is to use the <a class="reference internal" href="../../utilities/map2img.html#map2img"><span class="std std-ref">map2img</span></a> utility:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">map2img</span> <span class="o">-</span><span class="n">m</span> <span class="n">mymapfile</span><span class="o">.</span><span class="n">map</span> <span class="o">-</span><span class="n">o</span> <span class="n">test</span><span class="o">.</span><span class="n">png</span>
</pre></div>
</div>
<p>Once you successfully created a map image, then try your application. Note
Windows users may come across a problem where map2img works but their
application throws an error similar to this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>Warning: [MapServer Error]: msOGRFileOpen(): Open failed for OGR connection `coal.ovf'.
Unable to initialize ODBC connection to DSN for jeff/test@Data_txt,
[Microsoft][ODBC Driver Manager] Data source name not found
and no default driver specified in D:\ms4w\Apache\htdocs\quickmap.php on line 40
</pre></div>
</div>
<p>If that happens you should make sure you have created a System DSN.</p>
</section>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script><h3>Navigation</h3>
<p>
<a href="../../about.html" title="About">About</a><br>
<a href="../../products.html" title="Products">Products</a><br>
<a href="../../community/index.html" title="Community">Community</a><br>
<a href="../../development/index.html" title="Development">Development</a><br>
<a href="../../download.html" title="Downloads">Downloads</a><br>
<a href="../../documentation.html" title="Documentation">Documentation</a><br>
<a href="../../faq.html" title="FAQ">FAQ</a><br>
<a href="../../psc.html" title="PSC">PSC</a><br>
<a href="https://fosstodon.org/@mapserver" title="Mastodon">Mastodon</a>
</p>
<h3>Current Table Of Contents</h3>
<ul>
<li><a class="reference internal" href="#">Virtual Spatial Data</a><ul>
<li><a class="reference internal" href="#types-of-databases">Types of Databases</a></li>
<li><a class="reference internal" href="#types-of-flat-files">Types of Flat Files</a></li>
<li><a class="reference internal" href="#steps-for-display">Steps for Display</a><ul>
<li><a class="reference internal" href="#create-the-datasource-name-dsn">1. Create the Datasource Name (DSN)</a></li>
<li><a class="reference internal" href="#test-your-connection">2. Test your Connection</a></li>
<li><a class="reference internal" href="#create-a-virtual-data-file">3. Create a Virtual Data File</a></li>
<li><a class="reference internal" href="#test-virtual-data-file-with-ogrinfo">4. Test Virtual Data File with ogrinfo</a></li>
<li><a class="reference internal" href="#mapfile-layer">5. Mapfile Layer</a></li>
<li><a class="reference internal" href="#test-your-mapfile">6. Test your Mapfile</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="Related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="wfs.html" title="WFS"
>next</a> |</li>
<li class="right" >
<a href="vector_field.html" title="Vector field rendering - UVraster"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../../index.html">Home</a> »</li>
<li class="nav-item nav-item-1"><a href="../../documentation.html" >MapServer 8.6.1 Documentation</a> »</li>
<li class="nav-item nav-item-2"><a href="../index.html" >Data Input</a> »</li>
<li class="nav-item nav-item-3"><a href="index.html" >Vector Data</a> »</li>
<li class="nav-item nav-item-this"><a href="">Virtual Spatial Data</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© <a href="../../copyright.html">Copyright</a> 2026, Open Source Geospatial Foundation.
Last updated on 2026-03-30.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 9.1.0.
</div>
</body>
</html>