Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
Predrag Milanovic
prostorne-jedinice-import
Commits
dd38808b
Commit
dd38808b
authored
Jan 21, 2020
by
Predrag Milanovic
Browse files
za pokazivanje
parent
928954a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
importRgzPodataka.py
View file @
dd38808b
import
osmapi
from
pyproj
import
Proj
,
transform
import
overpy
import
time
def
getIdZajednickogWaya
(
apiOverpass
,
naziv1
,
naziv2
):
result
=
apiOverpass
.
query
(
"""
[out:json];
area["name"="Сремски управни округ"]["admin_level"=6]->.a;
relation(area.a)["boundary"="administrative"]["admin_level"=9]["name"="{}"]->.prvaRelacija;
relation(area.a)["boundary"="administrative"]["admin_level"=9]["name"="{}"]->.drugaRelacija;
(.prvaRelacija ;>;) -> .a1;
(.drugaRelacija;>;) -> .a2;
(.a1;- .a2;) -> .a3;
(.a1;- .a3;) -> .a4;
way.a4;
out;
"""
.
format
(
naziv1
,
naziv2
)
)
print
(
result
.
ways
)
print
(
result
.
ways
[
0
].
id
)
time
.
sleep
(
10
)
return
result
.
ways
[
0
].
id
api
=
overpy
.
Overpass
()
naselje1
=
"Мартинци"
naselje2
=
"Кузмин"
id
=
getIdZajednickogWaya
(
api
,
naselje1
,
naselje2
)
print
(
id
)
quit
()
inProj
=
Proj
(
"EPSG:32634"
,
preserve_units
=
True
)
outProj
=
Proj
(
"EPSG:4326"
)
api
=
osmapi
.
OsmApi
(
api
=
"https://api06.dev.openstreetmap.org"
,
username
=
"mpele"
,
password
=
"asdf1234"
)
#api = osmapi.OsmApi(api="https://api06.dev.openstreetmap.org", username = "mpele", password = "asdf1234")
api
=
osmapi
.
OsmApi
(
username
=
"mpele"
,
passwordfile
=
"mypasswords"
)
api
.
ChangesetCreate
({
u
"comment"
:
u
"Proba azuriranja postojeceg way sa novim tackama"
,
u
"source"
:
u
"RGZ import"
})
way
=
api
.
WayGet
(
1234
)
way
=
api
.
WayGet
(
703302009
)
#print(way['nd'][0])
#
print(way)
print
(
way
)
#quit()
f
=
open
(
r
'
izlaz
.csv'
,
'r'
,
encoding
=
'utf8'
)
f
=
open
(
r
'
zaImport
.csv'
,
'r'
,
encoding
=
'utf8'
)
linija
=
str
(
f
.
readline
())
p
=
linija
.
find
(
'('
)
+
1
k
=
linija
.
find
(
')'
,
p
)
...
...
@@ -35,3 +72,6 @@ way['nd'] = ndList
print
(
api
.
WayUpdate
(
way
))
api
.
ChangesetClose
()
zaImport.csv
0 → 100644
View file @
dd38808b
ДОБРИНЦИ,РУМА,"LINESTRING(412452.0923 4976357.8205,412849.0568 4976552.3689,412850.296600002 4976575.3424,412851.756400001 4976602.3448,412854.366 4976650.5912,412856.3857 4976687.8206,412860.325500001 4976811.2059,412863.946 4977025.2057,412865.936 4977093.4564,412869.955400001 4977169.395,412875.416000001 4977329.0439,412876.434900001 4977358.8315,412882.919200001 4977547.9401,412884.2828 4977587.698,412887.371900002 4977680.4523,412892.930400001 4977847.7959,412892.935400002 4977847.9439,412898.099 4978001.6533,412898.2689 4978006.8518,412898.4639 4978012.3023,412898.468900001 4978012.4503)","POINT(412452.0923 4976357.8205)"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment