我正在尝试使用 DocumentFile 列出 Android 5.1 手机上的外部存储设备中的文件
String rootPathURI = "file:/media/storage/sdcard1/data/example.externalstorage/files/";
File f = new File(URI(rootPathURI));
DocumentFile documentFile = DocumentFile.fromFile(f);
Run Code Online (Sandbox Code Playgroud)
这段代码工作正常,但我想这样做;
String rootPathURI = "file:/media/storage/sdcard1/data/example.externalstorage/files/";
DocumentFile documentFile = DocumentFile.fromTreeUri(getApplicationContext(), Uri.parse(rootPathURI));
Run Code Online (Sandbox Code Playgroud)
但我得到这样的例外:
W/System.err( 5157): java.lang.IllegalArgumentException: Invalid URI:"file:/media/storage/sdcard1/data/example.externalstorage/files/"
Run Code Online (Sandbox Code Playgroud) 当我尝试在 mongoDB 中创建 2dsphere 索引时,我收到以下错误消息:
\n\n> db.mahalle.createIndex({geometry:"2dsphere"})\n{\n "createdCollectionAutomatically" : false,\n "numIndexesBefore" : 1,\n "errmsg" : "exception: Can\'t extract geo keys: { _id: ObjectId(\'55b4e025a6ef7e9c50ae79cd\'), type: \\"Feature\\", p\nroperties: { ADI: \\"\xc3\x87elemli\\", ILADI: \\"Adana\\", ILCEADI: \\"Y\xc3\xbcre?ir\\", BUCAKADI: \\"Merkez\\", KOYADI: \\"\xc3\x87elemli\\", ILKOD:\n 1 }, geometry: { type: \\"Polygon\\", coordinates: [ [ [ 35.624498, 36.849395 ], [ 35.649357, 36.876937 ], [ 35.657724, 3\n6.879572 ], [ 35.663334, 36.873718 ], [ 35.668063, 36.875857 ], [ 35.671228, 36.87511 ], [ 35.676613, 36.872193 ], [ 35.\n676789, 36.86627 ], …Run Code Online (Sandbox Code Playgroud) 有没有办法为 openlayers 4+ 的 ol.style.Text 类设置多种字体颜色?
我正在尝试做类似的事情
const label = new ol.style.Style({
text: new ol.style.Text({
text: '<color1>X</color1> other text',
textAlign: 'center',
font: '11px roboto,sans-serif',
fill: new ol.style.Fill({
color: 'white'
}),
stroke: new ol.style.Stroke({
color: 'black',
lineCap: 'butt',
width: 4
}),
offsetX: 0,
offsetY: 25.5,
})
Run Code Online (Sandbox Code Playgroud)
由于“其他文本”的长度或宽度未知且 textAlign 必须设置为居中,因此我无法添加两个 ol.style.Text 类并将它们并排放置。
提前致谢
2dsphere ×1
android ×1
documentfile ×1
geospatial ×1
java ×1
mongodb ×1
openlayers ×1
polygon ×1