{"id":291,"date":"2009-01-05T13:01:11","date_gmt":"2009-01-05T12:01:11","guid":{"rendered":"http:\/\/sickel.net\/blogg\/?p=291"},"modified":"2009-01-13T13:52:46","modified_gmt":"2009-01-13T12:52:46","slug":"mapserver-virtual-data-sources","status":"publish","type":"post","link":"https:\/\/sickel.net\/blogg\/?p=291","title":{"rendered":"Mapserver &#8211; virtual data sources"},"content":{"rendered":"<p>Following gdal org&#8217;s <a href=\"http:\/\/www.gdal.org\/ogr\/drv_vrt.html\">Virtual data source description<\/a> and mapserver.org&#8217;s documentation on <a href=\"http:\/\/mapserver.org\/input\/vector\/VirtualSpatialData.html\">Virtual Spatial Data<\/a>, I tried to set up a data source using the ODBC-textual data driver, but even if using ogrinfo with the driver and table name seemed to work well, using the ovf-file and thereby reading it in through the .map-file just didn&#8217;t work. <\/p>\n<p>The mapserver application came out with a few error messages, where <\/p>\n<blockquote><p>Warning: [MapServer Error]: msOGRFileOpen(): Open failed for OGR connection in layer `test&#8217;. Failed to find layer &#8216;test.txt&#8217; on datasource &#8216;ODBC:mapserver&#8217;. in C:\\ms4w\\apps\\tutorial\\htdocs\\test1.php on line 52<\/p><\/blockquote>\n<p> was the one that pointed to the problem. Ogrinfo test.ovf told me that <\/p>\n<blockquote><p>\nERROR 4: Update access not supported for VRT datasources.<br \/>\nERROR 1: Unable to identify source X or Y field for PointFromColumns encoding.<br \/>\nFAILURE:<br \/>\nUnable to open datasource `test.ovf&#8217; with the following drivers.<br \/>\n  -> ESRI Shapefile<br \/>\n  -> MapInfo File (&#8230;)&#8221;\n<\/p><\/blockquote>\n<p>whereas ogrinfo ODBC:mapserver test.txt worked fine. the ovf-file was as simple as<\/p>\n<pre>\r\n&lt;ogrvrtdatasource>\r\n\t&lt;ogrvrtlayer name=\"test\">\r\n\t\t&lt;srcdatasource>ODBC:mapserver&lt;\/srcdatasource>\r\n\t\t&lt;srclayer>test.txt&lt;\/srclayer>\r\n\t\t&lt;geometryfield encoding=\"PointFromColumns\" x=\"x\" y=\"y\"\/>\r\n\t\t&lt;geometrytype>wkbPoint&lt;\/geometrytype>\r\n\t&lt;\/ogrvrtlayer>\r\n&lt;\/ogrvrtdatasource>\r\n<\/pre>\n<p>so this caused quite a few grey hairs. <\/p>\n<p>At last it occured to me, I had put the text files with data into the same directory where I had the other data files for the project. A few of this files also had the .txt extention, after I had once looked into the &#8220;Define format&#8221; dialog in the odbc setup, the odbc driver tried to also make sense of those files, as they were not well-defined tables, it erred out, not even trying to read the table file I wanted it to read&#8230; Moving the data files into their own directory and adjusting the ODBC-source saved my day.<\/p>\n<p>Addendum:<br \/>\nLooking back into the directory, I found the schema.ini file, by removing or editing  that, I could probably have kept the text-table files in the old directory.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Following gdal org&#8217;s Virtual data source description and mapserver.org&#8217;s documentation on Virtual Spatial Data, I tried to set up a data source using the ODBC-textual data driver, but even if using ogrinfo with the driver and table name seemed to &hellip; <a href=\"https:\/\/sickel.net\/blogg\/?p=291\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[17],"class_list":["post-291","post","type-post","status-publish","format-standard","hentry","category-data","tag-englishposts"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pnVtD-4H","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/sickel.net\/blogg\/index.php?rest_route=\/wp\/v2\/posts\/291","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickel.net\/blogg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickel.net\/blogg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickel.net\/blogg\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickel.net\/blogg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=291"}],"version-history":[{"count":18,"href":"https:\/\/sickel.net\/blogg\/index.php?rest_route=\/wp\/v2\/posts\/291\/revisions"}],"predecessor-version":[{"id":338,"href":"https:\/\/sickel.net\/blogg\/index.php?rest_route=\/wp\/v2\/posts\/291\/revisions\/338"}],"wp:attachment":[{"href":"https:\/\/sickel.net\/blogg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickel.net\/blogg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickel.net\/blogg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}