Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sbtools: item_get_wfs #276

Open
aappling-usgs opened this issue Jul 17, 2017 · 1 comment
Open

sbtools: item_get_wfs #276

aappling-usgs opened this issue Jul 17, 2017 · 1 comment

Comments

@aappling-usgs
Copy link
Member

item_get_wfs(ex_id) doesn't seem to be working for any ex_id we've tried.

@aappling-usgs
Copy link
Member Author

well, good news and bad news. the good news: i found three items that work!

wfs <- item_get_wfs('57681584e4b07657d19f586d')
## OGR data source with driver: ESRI Shapefile 
## Source: "C:\...\Temp\1\RtmpSehK0O/file1e607e963f41", layer:  "USA_MO_Ironton_Airborne_survey_footprint_2016"
## with 1 features
## It has 22 fields
library(maps)
library(sp)
map('state', regions = 'missouri')
plot(wfs, add = TRUE, col='blue')

image

the other working items i found are 5699855be4b0ec051295ed8b and 58cbe556e4b0849ce97dcd31.

the bad news: i found 97 that should have but didn't work.

wfs_candidates <- query_sb_datatype('OGC WFS Layer', limit=100)
wfs_ids <- sapply(wfs_candidates, function(item) item$id)
for(sb_id in wfs_ids) {
	wfs_url <- sprintf("https://www.sciencebase.gov/catalogMaps/mapping/ows/%s?service=wfs&request=getcapabilities&version=1.3.0", sb_id)
	
	caps = xml2::read_xml(wfs_url)
	
	layer_names = xml2::xml_text(xml2::xml_find_all(caps, '//d1:FeatureType/d1:Name', xml2::xml_ns(caps)))
	
	layer_names = layer_names[!is.na(layer_names) & !layer_names %in% c('sb:boundingBox', 'sb:footprint')]
	if(length(layer_names) == 0) {
		message(sb_id, ': no layers other than sb:boundingBox and sb:footprint')
	} else if(length(layer_names) == 1) {
		message(sb_id, ': success!!!')
	} else if(length(layer_names) > 1){
		message(sb_id, ': SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer')
	}
}
513a2eaae4b09608cc166c1b: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
4f554260e4b018de15819c88: no layers other than sb:boundingBox and sb:footprint
57c98889e4b0f2f0cec15c57: no layers other than sb:boundingBox and sb:footprint
55ae6b7de4b066a249242350: no layers other than sb:boundingBox and sb:footprint
57c0a0c0e4b0f2f0ceb8a994: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
57df8644e4b090825000fb27: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
546cddd4e4b0fc7976bf1d08: no layers other than sb:boundingBox and sb:footprint
58bd9576e4b01a6517dc0cfd: no layers other than sb:boundingBox and sb:footprint
57bb51ece4b03fd6b7dd04de: no layers other than sb:boundingBox and sb:footprint
568e9959e4b0e7a44bc58c00: no layers other than sb:boundingBox and sb:footprint
58ffa40ae4b0e85db3a46c40: no layers other than sb:boundingBox and sb:footprint
5672fd24e4b01a7f82451e9d: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
577e7c5be4b0ef4d2f44ee82: no layers other than sb:boundingBox and sb:footprint
4f554236e4b018de15819c85: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
57d1e94de4b0571647cfd4d2: no layers other than sb:boundingBox and sb:footprint
5698119de4b039675d04911f: no layers other than sb:boundingBox and sb:footprint
56cf3a77e4b015c306ed1792: no layers other than sb:boundingBox and sb:footprint
55b24f7ee4b09a3b01b5361e: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
570687cde4b032f77a8a4559: no layers other than sb:boundingBox and sb:footprint
578681a2e4b0e02680c15035: no layers other than sb:boundingBox and sb:footprint
5714ec24e4b0ef3b7ca85d75: no layers other than sb:boundingBox and sb:footprint
586e4e2ce4b0f5ce109fcb6d: no layers other than sb:boundingBox and sb:footprint
571e2412e4b071321fe5653f: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
xmlXPathEval: evaluation failed
586c08c6e4b0f5ce109fa810: no layers other than sb:boundingBox and sb:footprint
56d5d267e4b015c306f26e3a: no layers other than sb:boundingBox and sb:footprint
58599681e4b01224f329b484: no layers other than sb:boundingBox and sb:footprint
56e82cc2e4b0f59b85d71269: no layers other than sb:boundingBox and sb:footprint
57116c51e4b0ef3b7ca55583: no layers other than sb:boundingBox and sb:footprint
5733bc85e4b0dae0d5dd627b: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
58fe1676e4b0f87f0854acd7: no layers other than sb:boundingBox and sb:footprint
5821fc58e4b0a3e2fc7b957a: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
587702ece4b0315b4c11fdf5: no layers other than sb:boundingBox and sb:footprint
56d72947e4b015c306f4582a: no layers other than sb:boundingBox and sb:footprint
58c187dae4b014cc3a3d36bd: no layers other than sb:boundingBox and sb:footprint
5888e591e4b05ccb964c2824: no layers other than sb:boundingBox and sb:footprint
51360a27e4b03b8ec4025c07: no layers other than sb:boundingBox and sb:footprint
56ec52b5e4b0f59b85da150d: no layers other than sb:boundingBox and sb:footprint
5894bedee4b0fa1e59b8697b: no layers other than sb:boundingBox and sb:footprint
5641306ee4b0831b7d62e5d5: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
5697c1a2e4b039675d00a73e: no layers other than sb:boundingBox and sb:footprint
5825e97ee4b01fad86e41247: no layers other than sb:boundingBox and sb:footprint
58c1d920e4b014cc3a3d3b63: no layers other than sb:boundingBox and sb:footprint
589b6d69e4b0efcedb72d36f: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
583dad52e4b0d9329c80f98d: no layers other than sb:boundingBox and sb:footprint
57d1e975e4b0571647cfd4db: no layers other than sb:boundingBox and sb:footprint
580a1f12e4b0f497e790634e: no layers other than sb:boundingBox and sb:footprint
580587a2e4b0824b2d1c1f23: no layers other than sb:boundingBox and sb:footprint
5522bdf7e4b027f0aee3d039: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
569831c0e4b0fbd3f7fa2df1: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
58486f16e4b06d80b7af712f: no layers other than sb:boundingBox and sb:footprint
568425cbe4b0a04ef4932e4d: no layers other than sb:boundingBox and sb:footprint
570d4bebe4b0ef3b7ca14df7: no layers other than sb:boundingBox and sb:footprint
5699855be4b0ec051295ed8b: success!!!
55f6fba8e4b0477df11bff2b: no layers other than sb:boundingBox and sb:footprint
57b9d98ee4b03fd6b7dbf564: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
5851c123e4b0e2663625eb25: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
58fe18eee4b0f87f0854ad3f: no layers other than sb:boundingBox and sb:footprint
57bf06a7e4b0f2f0ceb733ab: no layers other than sb:boundingBox and sb:footprint
5702a5a3e4b0328dcb817435: no layers other than sb:boundingBox and sb:footprint
58cbe556e4b0849ce97dcd31: success!!!
5820c66de4b080404e711965: no layers other than sb:boundingBox and sb:footprint
575b0d6ae4b04f417c2752c4: no layers other than sb:boundingBox and sb:footprint
58937d08e4b0fa1e59b7372a: no layers other than sb:boundingBox and sb:footprint
56c235f5e4b0946c651fc290: no layers other than sb:boundingBox and sb:footprint
56fc53fee4b0a6037df26aa1: no layers other than sb:boundingBox and sb:footprint
5887c0e1e4b02e34393da413: no layers other than sb:boundingBox and sb:footprint
56bb6e84e4b08d617f657860: no layers other than sb:boundingBox and sb:footprint
57c9ad65e4b0f2f0cec1923b: no layers other than sb:boundingBox and sb:footprint
577537cae4b07dd077c70843: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
577683a4e4b07dd077c87574: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
547c7a02e4b0bdc517925ba0: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
587546b3e4b0a829a325a276: no layers other than sb:boundingBox and sb:footprint
58adf467e4b01ccd54f8b99b: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
580a4460e4b0f497e79064a9: no layers other than sb:boundingBox and sb:footprint
5824e0b9e4b0c05b678c45dd: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
58489952e4b06d80b7b0394f: no layers other than sb:boundingBox and sb:footprint
586be7b2e4b0f5ce109fa7ab: no layers other than sb:boundingBox and sb:footprint
58c03bd4e4b014cc3a3bb7ff: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
5696e902e4b039675d00a5ab: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
58ac74abe4b0ce4410e7d741: no layers other than sb:boundingBox and sb:footprint
5602ab5ae4b03bc34f5448b4: no layers other than sb:boundingBox and sb:footprint
58d44deae4b0d4ac7e32a632: no layers other than sb:boundingBox and sb:footprint
57681584e4b07657d19f586d: success!!!
582f7011e4b04d580bd5674f: no layers other than sb:boundingBox and sb:footprint
580f8dc9e4b0f497e7960008: no layers other than sb:boundingBox and sb:footprint
58594c10e4b03639a6025ebe: no layers other than sb:boundingBox and sb:footprint
585c07dfe4b01224f329b9fc: no layers other than sb:boundingBox and sb:footprint
5735f0f2e4b0dae0d5df6c67: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
592eda03e4b092b266f13e44: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
583dfd9ee4b088b77f520d07: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
57d1776ae4b0571647cfd1f1: no layers other than sb:boundingBox and sb:footprint
58af7022e4b01ccd54f9f542: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
572a72cfe4b0b13d391a48b2: no layers other than sb:boundingBox and sb:footprint
588605dde4b0496b79d7945a: no layers other than sb:boundingBox and sb:footprint
55de29afe4b0518e354dfd30: no layers other than sb:boundingBox and sb:footprint
5943e0a8e4b062508e322fec: no layers other than sb:boundingBox and sb:footprint
58f796a7e4b0b7ea5451f222: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
55f6d7dae4b0477df11bfec4: no layers other than sb:boundingBox and sb:footprint
57f67197e4b0bc0bec06e0a3: SB Item WFS has > 1 layer. item_download_sp currently cannot handle more than one layer
5547a069e4b0a658d794d1f1: no layers other than sb:boundingBox and sb:footprint
Warning messages:
1: closing unused connection 3 (https://www.sciencebase.gov/catalogMaps/mapping/ows/571e2412e4b071321fe5653f?service=wfs&request=GetFeature&version=1.3.0) 
2: In xpath_search(x$node, x$doc, xpath = xpath, nsMap = ns, num_results = Inf) :
  Undefined namespace prefix [1219]

when an item does work, it has a WFS link on its browser-accessible page, e.g., https://www.sciencebase.gov/catalog/item/57681584e4b07657d19f586d

item_get_wfs can't currently handle >1 layer; based on the above sample, it looks like there are many items where this would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants