FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mapserver/mapscript/java/examples/QueryByAttributeUnicode.java at master · dufop/mapserver · GitHub
dufop
/
mapserver
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
mapserver
/
mapscript
/
java
/
examples
/
QueryByAttributeUnicode.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (44 loc) · 1.71 KB
Breadcrumbs
mapserver
/
mapscript
/
java
/
examples
/
QueryByAttributeUnicode.java
Copy path
File metadata and controls
52 lines (44 loc) · 1.71 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
edu
.
umn
.
gis
.
mapscript
.*;
public
class
QueryByAttributeUnicode
{
public
static
void
main
(
String
[]
args
) {
String
filter
=
"/Südliche Weinstraße/"
;
if
(
args
.
length
==
2
) {
filter
=
args
[
1
];
}
// Unsupported
//String langSettings=System.getenv("LANG");
// Only since jdk 1.5
//String charsetSetting=Charset.defaultCharset().displayName();
String
charsetSetting
=
new
java
.
io
.
OutputStreamWriter
(
System
.
out
).
getEncoding
();
System
.
out
.
println
(
"("
+
charsetSetting
+
") Searching for: "
+
filter
);
if
(
charsetSetting
.
indexOf
(
"UTF"
) == -
1
) {
mapObj
map
=
new
mapObj
(
args
[
0
]);
layerObj
layer
=
map
.
getLayerByName
(
"test-iso"
);
layer
.
queryByAttributes
(
map
,
"KREIS_NAME"
,
filter
,
mapscriptConstants
.
MS_MULTIPLE
);
layer
.
open
();
resultObj
result
=
layer
.
getResult
(
0
);
if
(
result
==
null
) {
System
.
out
.
println
(
"Error: no results found, resultObj is null!"
);
}
else
{
shapeObj
shp
=
layer
.
getShape
(
result
);
for
(
int
z
=
0
;
z
<
shp
.
getNumvalues
();
z
++) {
System
.
out
.
println
(
"shp.value["
+
z
+
"]="
+
shp
.
getValue
(
z
));
}
System
.
out
.
println
(
"Results number (should be always 1): "
+
layer
.
getNumResults
() );
}
layer
.
close
();
}
else
{
mapObj
map
=
new
mapObj
(
args
[
0
]);
layerObj
layer
=
map
.
getLayerByName
(
"test-utf"
);
layer
.
queryByAttributes
(
map
,
"KREIS_NAME"
,
filter
,
mapscriptConstants
.
MS_MULTIPLE
);
layer
.
open
();
int
results
=
layer
.
getNumResults
();
System
.
out
.
println
(
"Results number (should be always 1): "
+
results
);
for
(
int
i
=
0
;
i
<
results
;
i
++) {
shapeObj
shape
=
layer
.
getShape
(
layer
.
getResult
(
i
));
System
.
out
.
println
(
"shape["
+
i
+
"]="
+
shape
);
}
layer
.
close
();
}
}
}
Back
|
FazBrowse Home
|
New Git URL