geohydra 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -1
  3. data/.travis.yml +1 -2
  4. data/Gemfile +1 -8
  5. data/Gemfile.lock +87 -102
  6. data/README.md +2 -2
  7. data/VERSION +1 -1
  8. data/bin/accession.rb +99 -89
  9. data/bin/assemble.rb +288 -247
  10. data/bin/assemble_data.rb +54 -51
  11. data/bin/assemble_placenames.rb +85 -85
  12. data/bin/build_stage_options.rb +24 -18
  13. data/bin/derive_wgs84.rb +65 -66
  14. data/bin/extract_thumbnail.rb +38 -37
  15. data/bin/geo2mods.rb +78 -0
  16. data/bin/geohydra +14 -5
  17. data/bin/ingest_arcgis.rb +80 -60
  18. data/bin/iso2geo.rb +64 -0
  19. data/bin/loader_postgis.rb +121 -227
  20. data/bin/run_task.rb +23 -0
  21. data/bin/sync_geoserver_metadata.rb +132 -127
  22. data/bin/xsltproc-saxon +6 -0
  23. data/geohydra.gemspec +6 -4
  24. data/lib/geohydra.rb +5 -0
  25. data/lib/geohydra/accession.rb +24 -13
  26. data/lib/geohydra/{arcgis_to_iso19139_fc.xsl → arcgis_to_iso19110.xsl} +0 -0
  27. data/lib/geohydra/gazetteer.csv +842 -36
  28. data/lib/geohydra/gazetteer.rb +48 -24
  29. data/lib/geohydra/mods2geoblacklight.xsl +248 -0
  30. data/lib/geohydra/mods2ogp.xsl +5 -8
  31. data/lib/geohydra/transform.rb +8 -2
  32. data/lib/geohydra/utils.rb +6 -0
  33. data/lib/geohydra/workflow/gisAssemblyWF.rb +109 -0
  34. data/lib/geohydra/workflow/gisAssemblyWF.xml +85 -0
  35. data/lib/geohydra/workflow/gisDeliveryWF.rb +33 -0
  36. data/lib/geohydra/workflow/gisDeliveryWF.xml +36 -0
  37. data/lib/geohydra/workflow/gisDiscoveryWF.rb +55 -0
  38. data/lib/geohydra/workflow/gisDiscoveryWF.xml +28 -0
  39. data/lib/geohydra/workflow/task.rb +82 -0
  40. data/ogp/README.md +350 -0
  41. data/ogp/download.rb +92 -0
  42. data/ogp/fgdc2mods.sh +9 -0
  43. data/ogp/fgdc2mods.xsl +884 -0
  44. data/ogp/ingest.rb +48 -0
  45. data/ogp/select.rb +20 -0
  46. data/ogp/transform.rb +354 -0
  47. data/ogp/validate.rb +182 -0
  48. data/{bin → scripts}/ingest_tufts.rb +0 -0
  49. data/scripts/iso2html/doit.sh +15 -0
  50. data/scripts/iso2html/main.css +66 -0
  51. data/scripts/iso2html/pacioos-iso-html.xsl +1749 -0
  52. data/scripts/iso2html/utils/replace-newlines.xsl +97 -0
  53. data/scripts/iso2html/utils/replace-string.xsl +80 -0
  54. data/scripts/iso2html/utils/strip-digits.xsl +60 -0
  55. data/{bin → scripts}/loader.rb +0 -0
  56. data/scripts/rename_shapefiles.rb +5 -0
  57. data/scripts/render_gazetteer.rb +36 -0
  58. data/{bin → scripts}/seed.rb +0 -0
  59. data/{bin → scripts}/solr_indexer.rb +0 -0
  60. data/scripts/status.csv +253 -0
  61. data/scripts/status.rb +32 -0
  62. data/{bin → scripts}/validate_data.rb +1 -1
  63. data/solr/kurma-app-dev/conf/lang/stopwords_en.txt +34 -0
  64. data/solr/kurma-app-dev/conf/protwords.txt +21 -0
  65. data/solr/kurma-app-dev/conf/schema.xml +156 -0
  66. data/solr/kurma-app-dev/conf/solrconfig.xml +161 -0
  67. data/solr/kurma-app-dev/conf/synonyms.txt +29 -0
  68. data/solr/kurma-app-dev/purge.sh +8 -0
  69. data/solr/kurma-app-test/conf/lang/stopwords_en.txt +34 -0
  70. data/solr/kurma-app-test/conf/protwords.txt +21 -0
  71. data/solr/kurma-app-test/conf/schema.xml +158 -0
  72. data/solr/kurma-app-test/conf/solrconfig.xml +161 -0
  73. data/solr/kurma-app-test/conf/synonyms.txt +29 -0
  74. data/solr/kurma-app-test/deploy.sh +15 -0
  75. data/solr/kurma-app-test/purge.sh +8 -0
  76. data/solr/ogp-dev/purge.sh +1 -2
  77. data/spec/fixtures/bw938nk9584/temp/{TRIPURA-iso19139-fc.xml → TRIPURA-iso19110.xml} +0 -0
  78. data/spec/fixtures/cc142xj8436/temp/{HARYANA-iso19139-fc.xml → HARYANA-iso19110.xml} +0 -0
  79. data/spec/fixtures/cg716wc7949/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  80. data/spec/fixtures/cm007pv9601/temp/{MEGHALAYA-iso19139-fc.xml → MEGHALAYA-iso19110.xml} +0 -0
  81. data/spec/fixtures/cp055nb0189/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  82. data/spec/fixtures/cs838pw3418/temp/{OIL_GAS_FIELDS-iso19139-fc.xml → OIL_GAS_FIELDS-iso19110.xml} +0 -0
  83. data/spec/fixtures/dd308sy5843/temp/{ORISSA-iso19139-fc.xml → ORISSA-iso19110.xml} +0 -0
  84. data/spec/fixtures/dd452vk1873/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  85. data/spec/fixtures/dg850pt1796/temp/{STATE1951-iso19139-fc.xml → STATE1951-iso19110.xml} +0 -0
  86. data/spec/fixtures/dn744tf5427/temp/{DISTRICT1991-iso19139-fc.xml → DISTRICT1991-iso19110.xml} +0 -0
  87. data/spec/fixtures/dq603nz8402/temp/{STATE2001-iso19139-fc.xml → STATE2001-iso19110.xml} +0 -0
  88. data/spec/fixtures/dv609zt4699/temp/{ASSAM-iso19139-fc.xml → ASSAM-iso19110.xml} +0 -0
  89. data/spec/fixtures/dz222hw0585/temp/{PUNJAB-iso19139-fc.xml → PUNJAB-iso19110.xml} +0 -0
  90. data/spec/fixtures/fd673qb9705/temp/{STATE1971-iso19139-fc.xml → STATE1971-iso19110.xml} +0 -0
  91. data/spec/fixtures/fg451wp8917/temp/{SIKKIM-iso19139-fc.xml → SIKKIM-iso19110.xml} +0 -0
  92. data/spec/fixtures/fh247yz0156/temp/{RAJASTHAN-iso19139-fc.xml → RAJASTHAN-iso19110.xml} +0 -0
  93. data/spec/fixtures/fs487vd1465/temp/{CHHATTISGARH-iso19139-fc.xml → CHHATTISGARH-iso19110.xml} +0 -0
  94. data/spec/fixtures/fs591bn3317/temp/{HIMACHAL_PRADESH-iso19139-fc.xml → HIMACHAL_PRADESH-iso19110.xml} +0 -0
  95. data/spec/fixtures/fw920bc5473/temp/{PLSS_TWN-iso19139-fc.xml → PLSS_TWN-iso19110.xml} +0 -0
  96. data/spec/fixtures/gj831wj3625/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  97. data/spec/fixtures/gp075nv3265/temp/{PONDICHERRY-iso19139-fc.xml → PONDICHERRY-iso19110.xml} +0 -0
  98. data/spec/fixtures/gv800hj8141/temp/{BIHAR-iso19139-fc.xml → BIHAR-iso19110.xml} +0 -0
  99. data/spec/fixtures/gw520gz6339/temp/{DADRA_NAGAR_HAVELI_PT-iso19139-fc.xml → DADRA_NAGAR_HAVELI_PT-iso19110.xml} +0 -0
  100. data/spec/fixtures/gy054hz1045/temp/{HARYANA-iso19139-fc.xml → HARYANA-iso19110.xml} +0 -0
  101. data/spec/fixtures/gz352mw6982/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  102. data/spec/fixtures/hb489vm9892/temp/{DISTRICT1981-iso19139-fc.xml → DISTRICT1981-iso19110.xml} +0 -0
  103. data/spec/fixtures/hw125dq0418/temp/{DELHI-iso19139-fc.xml → DELHI-iso19110.xml} +0 -0
  104. data/spec/fixtures/hw892mn4587/temp/{KERALA-iso19139-fc.xml → KERALA-iso19110.xml} +0 -0
  105. data/spec/fixtures/jb371hz3868/temp/{INCOME-iso19139-fc.xml → INCOME-iso19110.xml} +0 -0
  106. data/spec/fixtures/jc017yk9928/temp/{KARNATAKA-iso19139-fc.xml → KARNATAKA-iso19110.xml} +0 -0
  107. data/spec/fixtures/jf841ys4828/temp/{ANDHRA_PRADESH-iso19139-fc.xml → ANDHRA_PRADESH-iso19110.xml} +0 -0
  108. data/spec/fixtures/jh802mp2160/temp/{DELHI_PT-iso19139-fc.xml → DELHI_PT-iso19110.xml} +0 -0
  109. data/spec/fixtures/jj806fc3801/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  110. data/spec/fixtures/jq835yn7161/temp/{HIMACHAL_PRADESH-iso19139-fc.xml → HIMACHAL_PRADESH-iso19110.xml} +0 -0
  111. data/spec/fixtures/jr455pt6676/temp/{TAMILNADU-iso19139-fc.xml → TAMILNADU-iso19110.xml} +0 -0
  112. data/spec/fixtures/js637zp2537/temp/{BIHAR-iso19139-fc.xml → BIHAR-iso19110.xml} +0 -0
  113. data/spec/fixtures/jv502wg9611/temp/{GOA-iso19139-fc.xml → GOA-iso19110.xml} +0 -0
  114. data/spec/fixtures/jw462ck6560/temp/{JAMMU_KASHMIR-iso19139-fc.xml → JAMMU_KASHMIR-iso19110.xml} +0 -0
  115. data/spec/fixtures/kj800fb6273/temp/{STATE2011-iso19139-fc.xml → STATE2011-iso19110.xml} +0 -0
  116. data/spec/fixtures/km504zq3948/temp/{HIMACHAL_PRADESH-iso19139-fc.xml → HIMACHAL_PRADESH-iso19110.xml} +0 -0
  117. data/spec/fixtures/ks297fy1411/temp/{OFFSH_BLOCKS-iso19139-fc.xml → OFFSH_BLOCKS-iso19110.xml} +0 -0
  118. data/spec/fixtures/md358hy5049/temp/{MIZORAM-iso19139-fc.xml → MIZORAM-iso19110.xml} +0 -0
  119. data/spec/fixtures/mg745bq0193/temp/{MADHYA_PRADESH-iso19139-fc.xml → MADHYA_PRADESH-iso19110.xml} +0 -0
  120. data/spec/fixtures/mh187yx3536/temp/{WEST_BENGAL-iso19139-fc.xml → WEST_BENGAL-iso19110.xml} +0 -0
  121. data/spec/fixtures/mk488yn6694/temp/{GUJARAT-iso19139-fc.xml → GUJARAT-iso19110.xml} +0 -0
  122. data/spec/fixtures/my216kp3008/temp/{DELHI-iso19139-fc.xml → DELHI-iso19110.xml} +0 -0
  123. data/spec/fixtures/my504nz9827/temp/{JAMMU_KASHMIR-iso19139-fc.xml → JAMMU_KASHMIR-iso19110.xml} +0 -0
  124. data/spec/fixtures/ng819jm8700/temp/{MANIPUR-iso19139-fc.xml → MANIPUR-iso19110.xml} +0 -0
  125. data/spec/fixtures/np020jq2139/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  126. data/spec/fixtures/ns377mt1608/temp/{STATE1991-iso19139-fc.xml → STATE1991-iso19110.xml} +0 -0
  127. data/spec/fixtures/nw926np8508/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  128. data/spec/fixtures/ny358rm8559/temp/{TRIPURA-iso19139-fc.xml → TRIPURA-iso19110.xml} +0 -0
  129. data/spec/fixtures/nz176rm8192/temp/{DISTRICT2011-iso19139-fc.xml → DISTRICT2011-iso19110.xml} +0 -0
  130. data/spec/fixtures/nz252rq2252/temp/{UTTAR_PRADESH-iso19139-fc.xml → UTTAR_PRADESH-iso19110.xml} +0 -0
  131. data/spec/fixtures/pd902kb3348/temp/{MADHYA_PRADESH-iso19139-fc.xml → MADHYA_PRADESH-iso19110.xml} +0 -0
  132. data/spec/fixtures/pz792fz1776/temp/{MAHARASHTRA-iso19139-fc.xml → MAHARASHTRA-iso19110.xml} +0 -0
  133. data/spec/fixtures/qb767ss4042/temp/{UTTAR_PRADESH-iso19139-fc.xml → UTTAR_PRADESH-iso19110.xml} +0 -0
  134. data/spec/fixtures/qc091qw0570/temp/{GUJARAT-iso19139-fc.xml → GUJARAT-iso19110.xml} +0 -0
  135. data/spec/fixtures/qc652vr7204/temp/{ANDHRA_PRADESH_PT-iso19139-fc.xml → ANDHRA_PRADESH_PT-iso19110.xml} +0 -0
  136. data/spec/fixtures/qk786js7484/temp/{DISTRICT1961-iso19139-fc.xml → DISTRICT1961-iso19110.xml} +0 -0
  137. data/spec/fixtures/qn676pg6767/temp/{GOA-iso19139-fc.xml → GOA-iso19110.xml} +0 -0
  138. data/spec/fixtures/qr255jh4074/temp/{LOKSABHA_14-iso19139-fc.xml → LOKSABHA_14-iso19110.xml} +0 -0
  139. data/spec/fixtures/qr374kj4827/temp/{ASSAM-iso19139-fc.xml → ASSAM-iso19110.xml} +0 -0
  140. data/spec/fixtures/qy162js1748/temp/{CHHATTISGARH-iso19139-fc.xml → CHHATTISGARH-iso19110.xml} +0 -0
  141. data/spec/fixtures/rd446vf2633/temp/{NAGALAND-iso19139-fc.xml → NAGALAND-iso19110.xml} +0 -0
  142. data/spec/fixtures/rf389hf2983/temp/{CHHATTISGARH_PT-iso19139-fc.xml → CHHATTISGARH_PT-iso19110.xml} +0 -0
  143. data/spec/fixtures/rf859ff4582/temp/{JHARKHAND-iso19139-fc.xml → JHARKHAND-iso19110.xml} +0 -0
  144. data/spec/fixtures/rh343ds8931/temp/{BIHAR-iso19139-fc.xml → BIHAR-iso19110.xml} +0 -0
  145. data/spec/fixtures/rn815xk8157/temp/{SIKKIM-iso19139-fc.xml → SIKKIM-iso19110.xml} +0 -0
  146. data/spec/fixtures/rq653sz4470/temp/{CHHATTISGARH-iso19139-fc.xml → CHHATTISGARH-iso19110.xml} +0 -0
  147. data/spec/fixtures/rt625ws6022/temp/{GULF_FAIRWAYS-iso19139-fc.xml → GULF_FAIRWAYS-iso19110.xml} +0 -0
  148. data/spec/fixtures/sc330vf4259/temp/{JHARKHAND-iso19139-fc.xml → JHARKHAND-iso19110.xml} +0 -0
  149. data/spec/fixtures/sq479mx3086/temp/{OFFSH_PLATF-iso19139-fc.xml → OFFSH_PLATF-iso19110.xml} +0 -0
  150. data/spec/fixtures/sr686bm4098/temp/{DAMAN_DIU_PT-iso19139-fc.xml → DAMAN_DIU_PT-iso19110.xml} +0 -0
  151. data/spec/fixtures/sv303sh5583/temp/{ARUNACHAL_PRADESH-iso19139-fc.xml → ARUNACHAL_PRADESH-iso19110.xml} +0 -0
  152. data/spec/fixtures/sy319nh8520/temp/{GUJARAT-iso19139-fc.xml → GUJARAT-iso19110.xml} +0 -0
  153. data/spec/fixtures/td363vx2792/temp/{HIMACHAL_PRADESH_PT-iso19139-fc.xml → HIMACHAL_PRADESH_PT-iso19110.xml} +0 -0
  154. data/spec/fixtures/tf374bd2484/temp/{DISTRICT1951-iso19139-fc.xml → DISTRICT1951-iso19110.xml} +0 -0
  155. data/spec/fixtures/tj797mj7877/temp/{LOKSABHA_15-iso19139-fc.xml → LOKSABHA_15-iso19110.xml} +0 -0
  156. data/spec/fixtures/tv060wq5179/temp/{ASSAM-iso19139-fc.xml → ASSAM-iso19110.xml} +0 -0
  157. data/spec/fixtures/tv536bn1915/temp/{ARUNACHAL_PRADESH-iso19139-fc.xml → ARUNACHAL_PRADESH-iso19110.xml} +0 -0
  158. data/spec/fixtures/tz359cc2977/temp/{MANIPUR-iso19139-fc.xml → MANIPUR-iso19110.xml} +0 -0
  159. data/spec/fixtures/vb525my6511/temp/{UTTARAKHAND-iso19139-fc.xml → UTTARAKHAND-iso19110.xml} +0 -0
  160. data/spec/fixtures/vh802fs4240/temp/{PONDICHERRY-iso19139-fc.xml → PONDICHERRY-iso19110.xml} +0 -0
  161. data/spec/fixtures/vk120xn2474/temp/{PLSS_SEC-iso19139-fc.xml → PLSS_SEC-iso19110.xml} +0 -0
  162. data/spec/fixtures/vn439bc7316/temp/{KERALA-iso19139-fc.xml → KERALA-iso19110.xml} +0 -0
  163. data/spec/fixtures/vq745jk0695/temp/{MEGHALAYA-iso19139-fc.xml → MEGHALAYA-iso19110.xml} +0 -0
  164. data/spec/fixtures/vr593vj7147/temp/{ANDHRA_PRADESH-iso19139-fc.xml → ANDHRA_PRADESH-iso19110.xml} +0 -0
  165. data/spec/fixtures/vw911qb5271/temp/{DISTRICT2001-iso19139-fc.xml → DISTRICT2001-iso19110.xml} +0 -0
  166. data/spec/fixtures/wg680pz0365/temp/{ANDHRA_PRADESH-iso19139-fc.xml → ANDHRA_PRADESH-iso19110.xml} +0 -0
  167. data/spec/fixtures/wg761xn1926/temp/{HARYANA-iso19139-fc.xml → HARYANA-iso19110.xml} +0 -0
  168. data/spec/fixtures/wh870qw1934/temp/{PUNJAB-iso19139-fc.xml → PUNJAB-iso19110.xml} +0 -0
  169. data/spec/fixtures/wk775mm4673/temp/{MAHARASHTRA-iso19139-fc.xml → MAHARASHTRA-iso19110.xml} +0 -0
  170. data/spec/fixtures/ws171yz2165/temp/{ARUNACHAL_PRADESH_PT-iso19139-fc.xml → ARUNACHAL_PRADESH_PT-iso19110.xml} +0 -0
  171. data/spec/fixtures/wt473hz7153/temp/{CHANDIGARH_PT-iso19139-fc.xml → CHANDIGARH_PT-iso19110.xml} +0 -0
  172. data/spec/fixtures/ww217dj0457/temp/{CO2_PIPE-iso19139-fc.xml → CO2_PIPE-iso19110.xml} +0 -0
  173. data/spec/fixtures/wy875pk9849/temp/{STATE1961-iso19139-fc.xml → STATE1961-iso19110.xml} +0 -0
  174. data/spec/fixtures/xb018tk2042/temp/{STATE1981-iso19139-fc.xml → STATE1981-iso19110.xml} +0 -0
  175. data/spec/fixtures/xg539vw8586/temp/{ORISSA-iso19139-fc.xml → ORISSA-iso19110.xml} +0 -0
  176. data/spec/fixtures/xv475kp4644/temp/{ASSAM_PT-iso19139-fc.xml → ASSAM_PT-iso19110.xml} +0 -0
  177. data/spec/fixtures/xy096gc2959/temp/{GOA-iso19139-fc.xml → GOA-iso19110.xml} +0 -0
  178. data/spec/fixtures/xz518gz3362/temp/{UTTARAKHAND-iso19139-fc.xml → UTTARAKHAND-iso19110.xml} +0 -0
  179. data/spec/fixtures/yh986wy4737/temp/{NAGALAND-iso19139-fc.xml → NAGALAND-iso19110.xml} +0 -0
  180. data/spec/fixtures/yn187fq4474/temp/{KARNATAKA-iso19139-fc.xml → KARNATAKA-iso19110.xml} +0 -0
  181. data/spec/fixtures/yn236mw3250/temp/{TAMILNADU-iso19139-fc.xml → TAMILNADU-iso19110.xml} +0 -0
  182. data/spec/fixtures/yz596nz0112/temp/{WEST_BENGAL-iso19139-fc.xml → WEST_BENGAL-iso19110.xml} +0 -0
  183. data/spec/fixtures/zk596gy7380/temp/{DISTRICT1971-iso19139-fc.xml → DISTRICT1971-iso19110.xml} +0 -0
  184. data/spec/fixtures/zn452hh7431/temp/{RAJASTHAN-iso19139-fc.xml → RAJASTHAN-iso19110.xml} +0 -0
  185. data/spec/fixtures/zt093fw6519/temp/{MIZORAM-iso19139-fc.xml → MIZORAM-iso19110.xml} +0 -0
  186. data/spec/fixtures/zv925hd6723/temp/{OGWELLS-iso19139-fc.xml → OGWELLS-iso19110.xml} +0 -0
  187. data/spec/fixtures/zy658cr1728/temp/{ANDAMAAN_NICOBAR_PT-iso19139-fc.xml → ANDAMAAN_NICOBAR_PT-iso19110.xml} +0 -0
  188. data/spec/fixtures/zz943vx1492/temp/{BASINS-iso19139-fc.xml → BASINS-iso19110.xml} +0 -0
  189. data/spec/unit/gazetteer_spec.rb +100 -35
  190. data/spec/unit/task_spec.rb +68 -0
  191. data/spec/unit/transform_spec.rb +1 -1
  192. data/spec/unit/utils_spec.rb +17 -3
  193. data/workflow.rb +35 -0
  194. metadata +323 -316
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'open-uri'
4
+
5
+ class DownloadOgp
6
+ URL = {
7
+ 'tufts' => 'http://geodata.tufts.edu/solr/select',
8
+ 'stanford' => 'http://geoportal.stanford.edu/solr/ogp/select',
9
+ 'mit' => 'http://arrowsmith.mit.edu/solr/select',
10
+ 'berkeley' => 'http://gis.lib.berkeley.edu:9081/solr4/select',
11
+ 'harvard' => 'http://geodata.tufts.edu/solr/select' # Harvard uses Tufts solr index
12
+ }
13
+
14
+ FIELDS = %w{
15
+ Abstract
16
+ Access
17
+ Area
18
+ Availability
19
+ CenterX
20
+ CenterY
21
+ ContentDate
22
+ DataType
23
+ ExternalLayerId
24
+ FgdcText
25
+ GeoReferenced
26
+ HalfHeight
27
+ HalfWidth
28
+ Institution
29
+ LayerDisplayName
30
+ LayerId
31
+ Location
32
+ MaxX
33
+ MaxY
34
+ MinX
35
+ MinY
36
+ Name
37
+ PlaceKeywords
38
+ Publisher
39
+ SrsProjectionCode
40
+ ThemeKeywords
41
+ WorkspaceName
42
+ }.join(',')
43
+
44
+ def download(src, i, n, w=50)
45
+ start = 0
46
+ i = src if i.nil?
47
+ while start < n do
48
+ fetch(src, i, start, w)
49
+ start += w
50
+ end
51
+ end
52
+
53
+ # fetch a set of Solr records from the src provider about the target institution
54
+ #
55
+ # @param [String] src The source provider of the Solr records
56
+ # @param [String] target the target institution
57
+ # @param [Integer] start
58
+ # @param [Integer] rows
59
+ def fetch(src, target, start, rows, datadir = 'data')
60
+ fn = File.join(datadir, "#{src.downcase}_#{target.downcase}_#{sprintf('%05i', start)}_#{rows}.json")
61
+ unless File.exist?(fn)
62
+ raise "Unknown URL for #{src}" unless URL.include?(src.downcase)
63
+ puts "Downloading #{target} #{start} to #{start+rows}"
64
+ url = "#{URL[src.downcase]}?" + URI::encode_www_form(
65
+ 'q' => '*:*',
66
+ 'fq' => "Institution:#{target}",
67
+ 'start' => start,
68
+ 'rows' => rows,
69
+ 'wt' => 'json',
70
+ 'indent' => 'on',
71
+ 'fl' => FIELDS
72
+ )
73
+ puts " #{url}" if $DEBUG
74
+ open(url) do |res|
75
+ File.open(fn, 'wb') do |f|
76
+ f.write(res.read())
77
+ end
78
+ end
79
+ else
80
+ puts "Using cache for #{target} #{start} to #{start+rows}"
81
+ end
82
+ end
83
+ end
84
+
85
+ # __MAIN__
86
+ ogp = DownloadOgp.new
87
+ ogp.download('Stanford', 'Stanford', 269)
88
+ ogp.download('Berkeley', 'Berkeley', 407)
89
+ ogp.download('Tufts', 'MassGIS', 596)
90
+ ogp.download('Tufts', 'Tufts', 2598)
91
+ ogp.download('Tufts', 'Harvard', 8936)
92
+ ogp.download('MIT', 'MIT', 14742)
@@ -0,0 +1,9 @@
1
+ export PATH=../bin:$PATH
2
+ test -d mods || mkdir mods
3
+ set -x
4
+ for fn in fgdc/*.xml; do
5
+ if [ ! -r mods/`basename $fn` ]; then
6
+ xsltproc-saxon $fn fgdc2mods.xsl mods/`basename $fn`
7
+ #xsltproc fgdc2mods.xsl $fn > mods/`basename $fn`
8
+ fi
9
+ done
@@ -0,0 +1,884 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ fgdc2mods.xsl - Transformation from FGDC into MODS v3
4
+
5
+
6
+ Copyright 2013-2014, The Board of Trustees of the Leland Stanford Junior University
7
+
8
+ Licensed under the Apache License, Version 2.0 (the "License");
9
+ you may not use this file except in compliance with the License.
10
+ You may obtain a copy of the License at
11
+
12
+ http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing, software
15
+ distributed under the License is distributed on an "AS IS" BASIS,
16
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ See the License for the specific language governing permissions and
18
+ limitations under the License.
19
+
20
+
21
+ Created by Kim Durante and Darren Hardy, Stanford University Libraries
22
+
23
+ Requires parameters:
24
+ * geometryType: One of Point, LineString, Polygon, Curve, or Grid (Raster).
25
+ see
26
+ http://www.schemacentral.com/sc/niem21/t-gml32_GeometryPropertyType.html
27
+ * purl - e.g., http://purl.stanford.edu/aa111bb2222 or another UUID/URN
28
+ * format - e.g., MIME type application/x-esri-shapefile
29
+
30
+ May need other element sources for formats if not in 'formname' tag
31
+
32
+ -->
33
+ <xsl:stylesheet
34
+ xmlns="http://www.loc.gov/mods/v3"
35
+ xmlns:gco="http://www.isotc211.org/2005/gco"
36
+ xmlns:gmi="http://www.isotc211.org/2005/gmi"
37
+ xmlns:gmd="http://www.isotc211.org/2005/gmd"
38
+ xmlns:gml="http://www.opengis.net/gml"
39
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
40
+ version="2.0" exclude-result-prefixes="gml gmd gco gmi xsl">
41
+ <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
42
+ <xsl:strip-space elements="*"/>
43
+ <xsl:param name="format" select="'application/x-esri-shapefile'"/>
44
+ <xsl:param name="geometryType"/>
45
+ <xsl:param name="purl"/>
46
+ <xsl:param name="zipName" select="'data.zip'"/>
47
+ <!-- The coordinates value for MODS v3 is quite vague,
48
+ so we have a variety of formats:
49
+ GMD, WKT, WMS, GML, GeoRSS, MARC034, MARC255 (default)
50
+ -->
51
+ <xsl:param name="geoformat" select="'MARC255'"/>
52
+ <xsl:param name="fileIdentifier" select="''"/>
53
+ <xsl:template match="metadata">
54
+
55
+ <!-- geometryType for dc:type -->
56
+ <xsl:variable name="geometryType">
57
+ <xsl:choose>
58
+ <xsl:when test="idinfo/keywords/theme/themekey[contains(.,'line')]">
59
+ <xsl:text>Line</xsl:text>
60
+ </xsl:when>
61
+ <xsl:when test="idinfo/keywords/theme/themekey[contains(.,'point')]">
62
+ <xsl:text>Point</xsl:text>
63
+ </xsl:when>
64
+ <xsl:when test="idinfo/keywords/theme/themekey[contains(.,'polygon')]">
65
+ <xsl:text>Polygon</xsl:text>
66
+ </xsl:when>
67
+ <xsl:when test="spdoinfo/ptvctinf/esriterm/efeageom">
68
+ <xsl:value-of select="spdoinfo/ptvctinf/esriterm/efeageom"/>
69
+ </xsl:when>
70
+ <xsl:when test="spdoinfo/direct[contains(., 'Raster')]">
71
+ <xsl:text>Raster</xsl:text>
72
+ </xsl:when>
73
+ <xsl:when test="spdoinfo/ptvctinf/sdtsterm/sdtstype[contains(., 'G-polygon')]">
74
+ <xsl:text>Polygon</xsl:text>
75
+ </xsl:when>
76
+ </xsl:choose>
77
+ </xsl:variable>
78
+
79
+ <!-- institution for mods:recordContentSource -->
80
+ <xsl:variable name="institution">
81
+ <xsl:choose>
82
+ <xsl:when test="contains(distinfo/distrib/cntinfo/cntorgp/cntorg, 'Harvard')">
83
+ <xsl:text>Harvard</xsl:text>
84
+ </xsl:when>
85
+ <xsl:when test="contains(distinfo/distrib/cntinfo/cntorgp/cntorg, 'Tufts')">
86
+ <xsl:text>Tufts</xsl:text>
87
+ </xsl:when>
88
+ <xsl:when test="contains(distinfo/distrib/cntinfo/cntorgp/cntorg, 'MIT')">
89
+ <xsl:text>MIT</xsl:text>
90
+ </xsl:when>
91
+ <xsl:when test="contains(distinfo/distrib/cntinfo/cntorgp/cntorg, 'Massachusetts')">
92
+ <xsl:text>MassGIS</xsl:text>
93
+ </xsl:when>
94
+ <xsl:when test="contains(metainfo/metc/cntinfo/cntorgp/cntorg, 'MassGIS')">
95
+ <xsl:text>MassGIS</xsl:text>
96
+ </xsl:when>
97
+ <xsl:when test="contains(distinfo/distrib/cntinfo/cntemail, 'state.ma.us')">
98
+ <xsl:text>MassGIS</xsl:text>
99
+ </xsl:when>
100
+ <xsl:when test="contains(metainfo/metc/cntinfo/cntemail, 'ca.gov')">
101
+ <xsl:text>Berkeley</xsl:text>
102
+ </xsl:when>
103
+ </xsl:choose>
104
+ </xsl:variable>
105
+
106
+ <!-- fileidentifier for mods:recordIdentifier -->
107
+ <xsl:variable name="recordID">
108
+ <xsl:choose>
109
+ <xsl:when test="contains($institution, 'Tufts')">
110
+ <xsl:text>urn:geodata.tufts.edu:Tufts.</xsl:text>
111
+ <xsl:value-of select="substring-before(tokenize(base-uri(), '/')[last()], '.xml')"/>
112
+ </xsl:when>
113
+ <xsl:when test="contains($institution, 'MIT')">
114
+ <xsl:text>urn:arrowsmith.mit.edu:MIT.SDE_DATA.</xsl:text>
115
+ <xsl:value-of select="substring-before(tokenize(base-uri(), '/')[last()], '.xml')"/>
116
+ </xsl:when>
117
+ <xsl:when test="contains($institution, 'Harvard')">
118
+ <xsl:text>urn:hul.harvard.edu:HARVARD.</xsl:text>
119
+ <xsl:value-of select="substring-before(tokenize(base-uri(), '/')[last()], '.xml')"/>
120
+ </xsl:when>
121
+ <xsl:when test="contains($institution, 'MassGIS')">
122
+ <xsl:text>urn:massgis.state.ma.us:MassGIS.</xsl:text>
123
+ <xsl:value-of select="substring-before(tokenize(base-uri(), '/')[last()], '.xml')"/>
124
+ </xsl:when>
125
+ <xsl:when test="contains($institution, 'Berkeley')">
126
+ <xsl:text>urn:gis.library.berkeley.edu.</xsl:text>
127
+ <xsl:value-of select="substring-before(tokenize(base-uri(), '/')[last()], '.xml')"/>
128
+ </xsl:when>
129
+ </xsl:choose>
130
+ </xsl:variable>
131
+
132
+
133
+ <mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink" version="3.4" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-4.xsd">
134
+ <titleInfo>
135
+ <title>
136
+ <xsl:apply-templates select="idinfo/citation/citeinfo/title"/>
137
+ </title>
138
+ </titleInfo>
139
+
140
+ <!-- kd: need to map alternate titles
141
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:alternateTitle">
142
+ <titleInfo>
143
+ <title displayLabel="Alternative title">
144
+ <xsl:value-of select="."/>
145
+ </title>
146
+ </titleInfo>
147
+ </xsl:for-each> -->
148
+
149
+ <xsl:for-each select="idinfo/citation/citeinfo/origin">
150
+ <name>
151
+ <namePart>
152
+ <xsl:value-of select="."/>
153
+ </namePart>
154
+ <role>
155
+ <roleTerm type="text" authority="marcrelator">creator</roleTerm>
156
+ </role>
157
+ </name>
158
+ </xsl:for-each>
159
+
160
+ <!-- typeOfResource for SW - see http://www.loc.gov/standards/mods/v3/mods-userguide-elements.html -->
161
+ <typeOfResource>cartographic</typeOfResource>
162
+ <typeOfResource>software, multimedia</typeOfResource>
163
+
164
+ <genre>
165
+ <xsl:attribute name="authority">lcgft</xsl:attribute>
166
+ <xsl:attribute name="valueURI">http://id.loc.gov/authorities/genreForms/gf2011026297</xsl:attribute>
167
+ <xsl:text>Geospatial data</xsl:text>
168
+ </genre>
169
+ <genre>
170
+ <xsl:attribute name="authority">rdacontent</xsl:attribute>
171
+ <xsl:attribute name="valueURI">http://rdvocab.info/termList/RDAContentType/1001</xsl:attribute>
172
+ <xsl:text>cartographic dataset</xsl:text>
173
+ </genre>
174
+
175
+ <originInfo>
176
+ <xsl:for-each select="idinfo/citation/citeinfo/pubinfo/publish">
177
+ <publisher>
178
+ <xsl:value-of select="."/>
179
+ </publisher>
180
+ </xsl:for-each>
181
+ <xsl:for-each select="idinfo/citation/citeinfo/pubinfo/pubplace">
182
+ <place>
183
+ <placeTerm type="text">
184
+ <xsl:value-of select="."/>
185
+ </placeTerm>
186
+ </place>
187
+ </xsl:for-each>
188
+ <xsl:choose>
189
+
190
+ <!-- kd: set up xsl:analysis for dates with text, special characters.... -->
191
+
192
+ <!-- converts 8 digit date to YYYY -->
193
+ <xsl:when test="number(idinfo/citation/citeinfo/pubdate[(string-length()=8)])">
194
+ <dateIssued encoding="w3cdtf" keyDate="yes">
195
+
196
+ <xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,1,4)"/>
197
+ </dateIssued>
198
+ </xsl:when>
199
+
200
+ <!-- converts 6 digit date to YYYY -->
201
+ <xsl:when test="number(idinfo/citation/citeinfo/pubdate[(string-length()=6)])">
202
+ <dateIssued encoding="w3cdtf" keyDate="yes">
203
+ <xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,1,4)"/>
204
+ </dateIssued>
205
+ </xsl:when>
206
+
207
+ <!-- converts 4 digit date to YYYY -->
208
+ <xsl:when test="number(idinfo/citation/citeinfo/pubdate[(string-length()=4)])">
209
+ <dateIssued encoding="w3cdtf" keyDate="yes">
210
+ <!-- strip MM-DD, oupput YYYY -->
211
+ <xsl:value-of select="idinfo/citation/citeinfo/pubdate"/>
212
+ </dateIssued>
213
+ </xsl:when>
214
+
215
+ <!-- all other pubdates -->
216
+ <xsl:otherwise>
217
+ <dateIssued encoding="w3cdtf" keyDate="yes">
218
+ <xsl:value-of select="idinfo/citation/citeinfo/pubdate"/>
219
+ </dateIssued>
220
+ </xsl:otherwise>
221
+
222
+ </xsl:choose>
223
+
224
+
225
+ <xsl:for-each select="idinfo/timeperd/timeinfo/mdattim/sngdate/caldate | idinfo/timeperd/timeinfo/sngdate/caldate">
226
+ <dateValid>
227
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
228
+ <xsl:value-of select="substring(.,1,4)"/>
229
+ </dateValid>
230
+ </xsl:for-each>
231
+
232
+ <xsl:for-each select="idinfo/timeperd/timeinfo/rngdates">
233
+ <dateValid>
234
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
235
+ <xsl:attribute name="point">start</xsl:attribute>
236
+ <xsl:value-of select="substring(begdate,1,4)"/>
237
+ </dateValid>
238
+ <dateValid>
239
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
240
+ <xsl:attribute name="point">end</xsl:attribute>
241
+ <xsl:value-of select="substring(enddate,1,4)"/>
242
+ </dateValid>
243
+ </xsl:for-each>
244
+
245
+ <xsl:for-each select="idinfo/citation/citeinfo/edition">
246
+ <edition>
247
+ <xsl:value-of select="."/>
248
+ </edition>
249
+ </xsl:for-each>
250
+ </originInfo>
251
+
252
+ <!-- kd: default lang is 'eng' -->
253
+ <language>
254
+ <languageTerm authority="iso639-2b">
255
+ <xsl:text>eng</xsl:text>
256
+ </languageTerm>
257
+ </language>
258
+
259
+ <physicalDescription>
260
+ <xsl:choose>
261
+ <xsl:when test="distinfo/stdorder/digform/digtinfo/formname[contains(.,'SHP')]">
262
+ <form>
263
+ <xsl:text>Shapefile</xsl:text>
264
+ </form>
265
+ </xsl:when>
266
+ <xsl:when test="distinfo/stdorder/digform/digtinfo/formname">
267
+ <form>
268
+ <xsl:value-of select="distinfo/stdorder/digform/digtinfo/formname"/>
269
+ </form>
270
+ </xsl:when>
271
+
272
+ <xsl:when test="distInfo/distributor/distorFormat/formatName">
273
+ <form>
274
+ <xsl:value-of select="distInfo/distributor/distorFormat/formatName"/>
275
+ </form>
276
+ </xsl:when>
277
+
278
+ </xsl:choose>
279
+ <xsl:for-each select="distinfo/stdorder/digform/digtinfo/transize">
280
+ <extent>
281
+ <xsl:value-of select="."/>
282
+ </extent>
283
+ <!-- The digitalOrigin is coded here:
284
+ http://www.loc.gov/standards/mods/v3/mods-userguide-elements.html#digitalorigin
285
+ -->
286
+ </xsl:for-each>
287
+ <digitalOrigin>born digital</digitalOrigin>
288
+ </physicalDescription>
289
+ <subject>
290
+ <cartographics>
291
+ <xsl:choose>
292
+ <xsl:when test="number(dataqual/lineage/srcinfo/srcscale)">
293
+ <scale>
294
+ <xsl:text>1:</xsl:text>
295
+ <xsl:value-of select="dataqual/lineage/srcinfo/srcscale"/>
296
+ </scale>
297
+ </xsl:when>
298
+ <xsl:otherwise>
299
+ <scale>
300
+ <xsl:text>Scale not given.</xsl:text>
301
+ </scale>
302
+ </xsl:otherwise>
303
+ </xsl:choose>
304
+
305
+ <xsl:choose>
306
+ <xsl:when test="spref/horizsys/planar/mapproj">
307
+ <projection>
308
+ <xsl:value-of select="spref/horizsys/planar/mapproj/mapprojn"/>
309
+ </projection>
310
+ </xsl:when>
311
+ <xsl:when test="spref/horizsys/cordsysn/projcsn">
312
+ <projection>
313
+ <xsl:value-of select="spref/horizsys/cordsysn/projcsn"/>
314
+ </projection>
315
+ </xsl:when>
316
+ </xsl:choose>
317
+
318
+
319
+
320
+
321
+ <xsl:for-each select="idinfo/spdom/bounding">
322
+ <coordinates>
323
+ <xsl:choose>
324
+ <xsl:when test="$geoformat = 'GMD'">
325
+
326
+ <xsl:value-of select="westbc"/>
327
+ <xsl:text> -- </xsl:text>
328
+ <xsl:value-of select="eastbc"/>
329
+ <xsl:text>/</xsl:text>
330
+ <xsl:value-of select="northbc"/>
331
+ <xsl:text> -- </xsl:text>
332
+ <xsl:value-of select="southbc"/>
333
+ </xsl:when>
334
+ <!-- WKT is x y, x y
335
+
336
+ POLYGON((sw, nw, ne, se, sw))
337
+ -->
338
+ <xsl:when test="$geoformat = 'WKT'">
339
+ <xsl:text>POLYGON((</xsl:text>
340
+ <xsl:value-of select="westbc"/>
341
+ <xsl:text> </xsl:text>
342
+ <xsl:value-of select="southbc"/>
343
+ <xsl:text>, </xsl:text>
344
+ <xsl:value-of select="westbc"/>
345
+ <xsl:text> </xsl:text>
346
+ <xsl:value-of select="northbc"/>
347
+ <xsl:text>, </xsl:text>
348
+ <xsl:value-of select="eastbc"/>
349
+ <xsl:text> </xsl:text>
350
+ <xsl:value-of select="northbc"/>
351
+ <xsl:text>, </xsl:text>
352
+ <xsl:value-of select="eastbc"/>
353
+ <xsl:text> </xsl:text>
354
+ <xsl:value-of select="southbc"/>
355
+ <xsl:text>, </xsl:text>
356
+ <xsl:value-of select="westbc"/>
357
+ <xsl:text> </xsl:text>
358
+ <xsl:value-of select="southbc"/>
359
+ <xsl:text>))</xsl:text>
360
+ </xsl:when>
361
+ <xsl:when test="$geoformat = 'WMS'">
362
+ <!-- WMS
363
+ Uses min/max as attributes
364
+
365
+ Example:
366
+
367
+ <wms:BoundingBox xmlns:wms="http://www.opengis.net/wms"
368
+ CRS="EPSG:4326"
369
+ minx="-97.119945" miny="25.467075"
370
+ maxx="-82.307619" maxy="30.665492"/>
371
+ -->
372
+ <wms:BoundingBox xmlns:wms="http://www.opengis.net/wms">
373
+ <xsl:attribute name="CRS">EPSG:4326</xsl:attribute>
374
+ <xsl:attribute name="minx">
375
+ <xsl:value-of select="westbc"/>
376
+ </xsl:attribute>
377
+ <xsl:attribute name="miny">
378
+ <xsl:value-of select="southbc"/>
379
+ </xsl:attribute>
380
+ <xsl:attribute name="maxx">
381
+ <xsl:value-of select="eastbc"/>
382
+ </xsl:attribute>
383
+ <xsl:attribute name="maxy">
384
+ <xsl:value-of select="northbc"/>
385
+ </xsl:attribute>
386
+ </wms:BoundingBox>
387
+ </xsl:when>
388
+ <xsl:when test="$geoformat = 'GML'">
389
+ <!-- GML
390
+ Using SW and NE corners in (x, y) coordinates
391
+
392
+ Example:
393
+
394
+ <gml:Envelope xmlns:gml="http://www.opengis.net/gml/3.2" srsName="EPSG:4326">
395
+ <gml:lowerCorner>-97.119945 25.467075</gml:lowerCorner>
396
+ <gml:upperCorner>-82.307619 30.665492</gml:upperCorner>
397
+ </gml:Envelope>
398
+ -->
399
+ <gml:Envelope xmlns:gml="http://www.opengis.net/gml/3.2">
400
+ <xsl:attribute name="srsName">
401
+ <xsl:value-of select="//gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:referenceSystemIdentifier/gmd:RS_Identifier/gmd:codeSpace/gco:CharacterString"/>
402
+ <xsl:text>:</xsl:text>
403
+ <xsl:value-of select="//gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:referenceSystemIdentifier/gmd:RS_Identifier/gmd:code/gco:CharacterString"/>
404
+ </xsl:attribute>
405
+ <gml:lowerCorner>
406
+ <xsl:value-of select="gmd:westBoundLongitude/gco:Decimal"/>
407
+ <xsl:text> </xsl:text>
408
+ <xsl:value-of select="gmd:southBoundLatitude/gco:Decimal"/>
409
+ </gml:lowerCorner>
410
+ <gml:upperCorner>
411
+ <xsl:value-of select="gmd:eastBoundLongitude/gco:Decimal"/>
412
+ <xsl:text> </xsl:text>
413
+ <xsl:value-of select="gmd:northBoundLatitude/gco:Decimal"/>
414
+ </gml:upperCorner>
415
+ </gml:Envelope>
416
+ </xsl:when>
417
+ <xsl:when test="$geoformat = 'GeoRSS'">
418
+ <!-- GeoRSS:
419
+ Rectangular envelope property element containing two pairs of coordinates
420
+ (lower left envelope corner, upper right envelope corner) representing
421
+ latitude then longitude in the WGS84 coordinate reference system.
422
+
423
+ Example:
424
+
425
+ <georss:box>42.943 -71.032 43.039 -69.856</georss:box>
426
+ -->
427
+ <georss:box xmlns:georss="http://www.georss.org/georss">
428
+ <xsl:value-of select="southbc"/>
429
+ <xsl:text> </xsl:text>
430
+ <xsl:value-of select="westbc"/>
431
+ <xsl:text> </xsl:text>
432
+ <xsl:value-of select="northbc"/>
433
+ <xsl:text> </xsl:text>
434
+ <xsl:value-of select="eastbc"/>
435
+ </georss:box>
436
+ </xsl:when>
437
+ <xsl:when test="$geoformat = 'MARC034'">
438
+ <!-- MARC 034
439
+ Subfields $d, $e, $f, and $g always appear together. The coordinates
440
+ may be recorded in the form hdddmmss (hemisphere-degrees-minutes-seconds),
441
+ however, other forms are also allowed, such as decimal degrees.
442
+ The subelements are each right justified and unused positions contain zeros.
443
+
444
+ $d - Coordinates - westernmost longitude (NR)
445
+ $e - Coordinates - easternmost longitude (NR)
446
+ $f - Coordinates - northernmost latitude (NR)
447
+ $g - Coordinates - southernmost latitude (NR)
448
+
449
+ Example:
450
+
451
+ $d-097.119945$e-082.307619$f+30.665492$g+25.467075
452
+
453
+ See http://www.w3.org/TR/1999/REC-xslt-19991116#format-number
454
+ -->
455
+ <xsl:text>$d</xsl:text>
456
+ <xsl:value-of select="format-number(westbc, '+000.000000;-000.000000')"/>
457
+ <xsl:text>$e</xsl:text>
458
+ <xsl:value-of select="format-number(eastbc, '+000.000000;-000.000000')"/>
459
+ <xsl:text>$f</xsl:text>
460
+ <xsl:value-of select="format-number(nothbc, '+00.000000;-00.000000')"/>
461
+ <xsl:text>$g</xsl:text>
462
+ <xsl:value-of select="format-number(southbc, '+00.000000;-00.000000')"/>
463
+ </xsl:when>
464
+ <xsl:otherwise>
465
+ <!-- MARC 255 $c:
466
+ Coordinates are recorded in the order of
467
+ westernmost longitude, easternmost longitude,
468
+ northernmost latitude, and southernmost latitude,
469
+ and separated with double-hyphen and / characters.
470
+
471
+ XXX: Note that this leaves the coordinates in decimal
472
+ degrees whereas 255c suggests deg-min-sec.
473
+
474
+ Example:
475
+
476
+ -97.119945 &#x002D;&#x002D; -82.307619/30.665492 &#x002D;&#x002D; 25.467075
477
+
478
+ See http://www.loc.gov/marc/bibliographic/bd255.html $c
479
+ -->
480
+
481
+ <xsl:value-of select="westbc"/>
482
+ <xsl:text> -- </xsl:text>
483
+ <xsl:value-of select="eastbc"/>
484
+ <xsl:text>/</xsl:text>
485
+ <xsl:value-of select="northbc"/>
486
+ <xsl:text> -- </xsl:text>
487
+ <xsl:value-of select="southbc"/>
488
+ </xsl:otherwise>
489
+ </xsl:choose>
490
+ </coordinates>
491
+ </xsl:for-each>
492
+ </cartographics>
493
+ </subject>
494
+ <xsl:for-each select="idinfo/descript/abstract">
495
+ <abstract displayLabel="Abstract">
496
+ <xsl:attribute name="lang">eng</xsl:attribute>
497
+ <xsl:value-of select="."/>
498
+ </abstract>
499
+ </xsl:for-each>
500
+ <xsl:for-each select="idinfo/descript/purpose">
501
+ <abstract displayLabel="Purpose">
502
+ <xsl:attribute name="lang">eng</xsl:attribute>
503
+ <xsl:value-of select="."/>
504
+ </abstract>
505
+ </xsl:for-each>
506
+
507
+ <!-- Reports, citation, other info, etc.
508
+ <xsl:for-each select="dataqual">
509
+ <note displayLabel="Conceptual consistency report">
510
+ <xsl:attribute name="lang">eng</xsl:attribute>
511
+ <xsl:value-of select="."/>
512
+ </note>
513
+ </xsl:for-each>
514
+ <xsl:for-each select="dataqual">
515
+ <note displayLabel="Attribute accuracy report">
516
+ <xsl:attribute name="lang">eng</xsl:attribute>
517
+ <xsl:value-of select="."/>
518
+ </note>
519
+ </xsl:for-each>
520
+ <xsl:for-each select="idinfo/datacred">
521
+ <note displayLabel="Preferred citation">
522
+ <xsl:attribute name="lang">eng</xsl:attribute>
523
+ <xsl:value-of select="."/>
524
+ </note>
525
+ </xsl:for-each>
526
+ <xsl:for-each select="idinfo/descript/supplinf">
527
+ <note displayLabel="Supplemental information">
528
+ <xsl:value-of select="."/>
529
+ </note>
530
+ </xsl:for-each> -->
531
+
532
+
533
+ <!-- MODS relatedItem types: host, series, isReferencedby-->
534
+
535
+ <xsl:for-each select="idinfo/citation/citeinfo/lworkcit">
536
+ <relatedItem>
537
+ <xsl:attribute name="type">host</xsl:attribute>
538
+ <titleInfo>
539
+ <title>
540
+ <xsl:value-of select="citeinfo/title"/>
541
+ </title>
542
+ </titleInfo>
543
+
544
+ <xsl:if test="citeinfo/origin">
545
+
546
+ <name>
547
+ <namePart>
548
+ <xsl:value-of select="citeinfo/origin"/>
549
+ </namePart>
550
+ </name>
551
+
552
+ </xsl:if>
553
+ <originInfo>
554
+ <xsl:if test="citeinfo/pubinfo/publish">
555
+ <publisher>
556
+ <xsl:value-of select="citeinfo/pubinfo/publish"/>
557
+ </publisher>
558
+ </xsl:if>
559
+ <xsl:if test="citeinfo/pubdate">
560
+ <dateIssued encoding="w3cdtf" keyDate="yes">
561
+ <!-- strip MM-DD, oupput YYYY -->
562
+ <xsl:value-of select="substring(citeinfo/pubdate,1,4)"/>
563
+ </dateIssued>
564
+ </xsl:if>
565
+ </originInfo>
566
+ </relatedItem>
567
+ </xsl:for-each>
568
+
569
+ <xsl:for-each select="idinfo/crossref">
570
+ <relatedItem>
571
+ <xsl:attribute name="type">isReferencedBy</xsl:attribute>
572
+ <titleInfo>
573
+ <title>
574
+ <xsl:value-of select="citeinfo/title"/>
575
+ </title>
576
+ </titleInfo>
577
+
578
+ <xsl:if test="citeinfo/origin">
579
+ <name>
580
+ <namePart>
581
+ <xsl:value-of select="citeinfo/origin"/>
582
+ </namePart>
583
+ </name>
584
+ </xsl:if>
585
+ <originInfo>
586
+ <xsl:if test="citeinfo/pubinfo/publish">
587
+ <publisher>
588
+ <xsl:value-of select="citeinfo/pubinfo/publish"/>
589
+ </publisher>
590
+ </xsl:if>
591
+ <xsl:if test="citeinfo/pubdate">
592
+ <dateIssued encoding="w3cdtf" keyDate="yes">
593
+ <!-- strip MM-DD, oupput YYYY -->
594
+ <xsl:value-of select="substring(citeinfo/pubdate,1,4)"/>
595
+ </dateIssued>
596
+ </xsl:if>
597
+ </originInfo>
598
+ </relatedItem>
599
+ </xsl:for-each>
600
+
601
+
602
+ <!-- subjects: topic, geographic, temporal, ISO19115TopicCategory -->
603
+
604
+
605
+ <xsl:for-each select="idinfo/keywords/place">
606
+ <xsl:choose>
607
+ <xsl:when test="contains(placekt, 'FIPS')"/>
608
+
609
+ <xsl:when test="placekey">
610
+ <xsl:for-each select="placekey">
611
+ <subject>
612
+ <geographic>
613
+ <!-- adds geonames info through external process -->
614
+ <xsl:if test="ancestor-or-self::*/placekt">
615
+ <xsl:attribute name="authority">
616
+ <xsl:choose>
617
+ <xsl:when test="ancestor-or-self::*/placekt[contains(.,'LCNH')]">
618
+ <xsl:text>lcnaf</xsl:text>
619
+ </xsl:when>
620
+ <xsl:when test="ancestor-or-self::*/placekt[contains(.,'LCSH')]">
621
+ <xsl:text>lcsh</xsl:text>
622
+ </xsl:when>
623
+ <xsl:otherwise>
624
+ <xsl:value-of select="ancestor-or-self::*/placekt"/>
625
+ </xsl:otherwise>
626
+ </xsl:choose>
627
+ </xsl:attribute>
628
+
629
+ </xsl:if>
630
+
631
+ <xsl:attribute name="lang">eng</xsl:attribute>
632
+ <xsl:value-of select="."/>
633
+
634
+ </geographic>
635
+ </subject>
636
+ </xsl:for-each>
637
+ </xsl:when>
638
+ </xsl:choose>
639
+ </xsl:for-each>
640
+
641
+
642
+ <xsl:choose>
643
+
644
+ <xsl:when test="idinfo/keywords/temporal/tempkey">
645
+ <xsl:for-each select="idinfo/keywords/temporal/tempkey">
646
+ <subject>
647
+ <temporal>
648
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
649
+ <xsl:value-of select="substring(.,1,4)"/>
650
+ </temporal>
651
+ </subject>
652
+ </xsl:for-each>
653
+ </xsl:when>
654
+
655
+ <xsl:when test="idinfo/timeperd/timeinfo/mdattim/sngdate/caldate | idinfo/timeperd/timeinfo/sngdate/caldate">
656
+ <xsl:for-each select="idinfo/timeperd/timeinfo/mdattim/sngdate/caldate | idinfo/timeperd/timeinfo/sngdate/caldate">
657
+ <subject>
658
+ <temporal>
659
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
660
+ <xsl:value-of select="substring(.,1,4)"/>
661
+ </temporal>
662
+ </subject>
663
+ </xsl:for-each>
664
+ </xsl:when>
665
+
666
+ <xsl:when test="idinfo/timeperd/timeinfo/rngdates">
667
+ <xsl:for-each select="idinfo/timeperd/timeinfo/rngdates">
668
+ <subject>
669
+ <temporal>
670
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
671
+ <xsl:attribute name="point">start</xsl:attribute>
672
+ <xsl:value-of select="substring(begdate,1,4)"/>
673
+ </temporal>
674
+ <temporal>
675
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
676
+ <xsl:attribute name="point">end</xsl:attribute>
677
+ <xsl:value-of select="substring(enddate,1,4)"/>
678
+ </temporal>
679
+ </subject>
680
+ </xsl:for-each>
681
+ </xsl:when>
682
+ </xsl:choose>
683
+
684
+
685
+ <xsl:for-each select="idinfo/keywords/theme">
686
+ <xsl:choose>
687
+ <xsl:when test="themekt[contains(.,'19115')]">
688
+ <xsl:for-each select="themekey">
689
+ <subject>
690
+ <topic>
691
+ <xsl:attribute name="authority">ISO19115TopicCategory</xsl:attribute>
692
+
693
+ <!-- kd: do we need authorityURI? -->
694
+ <xsl:attribute name="authorityURI">
695
+ <xsl:text>http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_TopicCategoryCode</xsl:text>
696
+ </xsl:attribute>
697
+
698
+
699
+ <xsl:if test="contains(.,'farming')">
700
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
701
+ <xsl:text>Farming</xsl:text>
702
+ </xsl:if>
703
+ <xsl:if test="contains(.,'biota')">
704
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
705
+ <xsl:text>Biology and Ecology</xsl:text>
706
+ </xsl:if>
707
+ <xsl:if test="contains(.,'climatologyMeteorologyAtmosphere')">\
708
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
709
+ <xsl:text>Climatology, Meteorology and Atmosphere</xsl:text>
710
+ </xsl:if>
711
+ <xsl:if test="contains(.,'boundaries')">
712
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
713
+ <xsl:text>Boundaries</xsl:text>
714
+ </xsl:if>
715
+ <xsl:if test="contains(.,'elevation')">
716
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
717
+ <xsl:text>Elevation</xsl:text>
718
+ </xsl:if>
719
+ <xsl:if test="contains(.,'environment')">
720
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
721
+ <xsl:text>Environment</xsl:text>
722
+ </xsl:if>
723
+ <xsl:if test="contains(.,'geoscientificInformation')">
724
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
725
+ <xsl:text>Geoscientific Information</xsl:text>
726
+ </xsl:if>
727
+ <xsl:if test="contains(.,'health')">
728
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
729
+ <xsl:text>Health</xsl:text>
730
+ </xsl:if>
731
+ <xsl:if test="contains(.,'imageryBaseMapsEarthCover')">
732
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
733
+ <xsl:text>Imagery and Base Maps</xsl:text>
734
+ </xsl:if>
735
+ <xsl:if test="contains(.,'intelligenceMilitary')">
736
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
737
+ <xsl:text>Military</xsl:text>
738
+ </xsl:if>
739
+ <xsl:if test="contains(.,'inlandWaters')">
740
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
741
+ <xsl:text>Inland Waters</xsl:text>
742
+ </xsl:if>
743
+ <xsl:if test="contains(.,'location')">
744
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
745
+ <xsl:text>Location</xsl:text>
746
+ </xsl:if>
747
+ <xsl:if test="contains(.,'oceans')">
748
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
749
+ <xsl:text>Oceans</xsl:text>
750
+ </xsl:if>
751
+ <xsl:if test="contains(.,'planningCadastre')">
752
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
753
+ <xsl:text>Planning and Cadastral</xsl:text>
754
+ </xsl:if>
755
+ <xsl:if test="contains(.,'structure')">
756
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
757
+ <xsl:text>Structures</xsl:text>
758
+ </xsl:if>
759
+ <xsl:if test="contains(.,'transportation')">
760
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
761
+ <xsl:text>Transportation</xsl:text>
762
+ </xsl:if>
763
+ <xsl:if test="contains(.,'utilitiesCommunication')">
764
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
765
+ <xsl:text>Utilities and Communication</xsl:text>
766
+ </xsl:if>
767
+ <xsl:if test="contains(.,'society')">
768
+ <xsl:attribute name="valueURI"><xsl:value-of select="."/></xsl:attribute>
769
+ <xsl:text>Society</xsl:text>
770
+ </xsl:if>
771
+
772
+ </topic>
773
+ </subject>
774
+ </xsl:for-each>
775
+ </xsl:when>
776
+
777
+ <xsl:when test="contains(themekt, 'LCSH')">
778
+ <xsl:for-each select="themekey">
779
+ <subject>
780
+ <topic>
781
+ <xsl:attribute name="authority">lcsh</xsl:attribute>
782
+ <xsl:attribute name="lang">eng</xsl:attribute>
783
+ <xsl:value-of select="."/>
784
+ </topic>
785
+ </subject>
786
+ </xsl:for-each>
787
+ </xsl:when>
788
+
789
+ <!-- GCMD keywords -->
790
+ <xsl:when test="contains(themekt, 'GCMD')">
791
+ <xsl:for-each select="tokenize(themekey, ' &gt; ')">
792
+ <subject>
793
+ <topic>
794
+ <xsl:attribute name="authority">gcmd</xsl:attribute>
795
+ <xsl:attribute name="lang">eng</xsl:attribute>
796
+ <xsl:value-of select="."/>
797
+ </topic>
798
+ </subject>
799
+ </xsl:for-each>
800
+ </xsl:when>
801
+ <xsl:otherwise>
802
+
803
+ <xsl:for-each select="themekey">
804
+ <subject>
805
+ <topic>
806
+ <xsl:attribute name="lang">eng</xsl:attribute>
807
+ <xsl:value-of select="."/>
808
+ </topic>
809
+ </subject>
810
+ </xsl:for-each>
811
+ </xsl:otherwise>
812
+ </xsl:choose>
813
+ </xsl:for-each>
814
+
815
+ <!-- TODO: Need a metadata practice for GIS Dataset's Online Resource. -->
816
+ <!-- access rights to be mapped from restrictionCode/otherRestrictions/APO -->
817
+ <xsl:for-each select="idinfo/accconst">
818
+ <accessCondition type="restriction on access">
819
+ <xsl:value-of select=". "/>
820
+ </accessCondition>
821
+ </xsl:for-each>
822
+ <xsl:for-each select="idinfo/useconst">
823
+ <accessCondition type="use and reproduction">
824
+ <xsl:value-of select=". "/>
825
+ </accessCondition>
826
+ </xsl:for-each>
827
+
828
+ <!-- MODS recordInfo -->
829
+
830
+ <recordInfo>
831
+ <recordContentSource>
832
+ <xsl:value-of select="$institution"/>
833
+ </recordContentSource>
834
+ <recordIdentifier>
835
+ <xsl:value-of select="$recordID"/>
836
+ </recordIdentifier>
837
+ <recordOrigin>This record was translated from FGDC Content Standards for Digital Geospatial Metadata to MODS v.3 using an xsl transformation.</recordOrigin>
838
+ <languageOfCataloging>
839
+ <languageTerm authority="iso639-2b" type="code">eng</languageTerm>
840
+ </languageOfCataloging>
841
+ </recordInfo>
842
+
843
+ <!-- Output minimal geo extension to MODS -->
844
+ <xsl:if test="idinfo/spdom/bounding">
845
+ <extension displayLabel="geo" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
846
+ <rdf:RDF xmlns:gml="http://www.opengis.net/gml/3.2/" xmlns:dc="http://purl.org/dc/elements/1.1/">
847
+ <rdf:Description>
848
+ <xsl:attribute name="rdf:about">
849
+ <xsl:value-of select="$purl"/>
850
+ </xsl:attribute>
851
+ <!-- Output MIME type -->
852
+ <dc:format>
853
+ <xsl:value-of select="$format"/>
854
+ </dc:format>
855
+ <!-- Output Dataset# point, linestring, polygon, raster, etc. -->
856
+ <dc:type>
857
+ <xsl:text>Dataset#</xsl:text>
858
+ <xsl:value-of select="$geometryType"/>
859
+ </dc:type>
860
+ <gml:boundedBy>
861
+ <gml:Envelope>
862
+ <xsl:attribute name="gml:srsName">
863
+ <xsl:text>EPSG:4326</xsl:text>
864
+ </xsl:attribute>
865
+ <gml:lowerCorner>
866
+ <xsl:value-of select="idinfo/spdom/bounding/westbc"/>
867
+ <xsl:text> </xsl:text>
868
+ <xsl:value-of select="idinfo/spdom/bounding/southbc"/>
869
+ </gml:lowerCorner>
870
+ <gml:upperCorner>
871
+ <xsl:value-of select="idinfo/spdom/bounding/eastbc"/>
872
+ <xsl:text> </xsl:text>
873
+ <xsl:value-of select="idinfo/spdom/bounding/northbc"/>
874
+ </gml:upperCorner>
875
+ </gml:Envelope>
876
+ </gml:boundedBy>
877
+ </rdf:Description>
878
+ </rdf:RDF>
879
+ </extension>
880
+ </xsl:if>
881
+
882
+ </mods>
883
+ </xsl:template>
884
+ </xsl:stylesheet>