Skip to content

Commit

Permalink
Присвоение регионов фотографиям 4. Вывод регионов под названием фотог…
Browse files Browse the repository at this point in the history
…рафии
  • Loading branch information
klimashkin committed Oct 23, 2013
1 parent 5000dc0 commit db41586
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 28 deletions.
62 changes: 41 additions & 21 deletions misc/Регионы.Руководство.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
Как найти номер отношения OSM, которое является административной гтраницей:
http://nominatim.openstreetmap.org/ Вводим искомое название, находим, нажимаем 'details' и в открывшейся странице находим 'boundary:administrative, relation: NUMBER'

Номера OSM границ некоторых объектов:
Russia - 60189
Moscow - 102269
Moscow Oblast - 51490
Saint Petersburg - 337422
Krasnogorsk - 181345

USA - 148838
New York - 61320
New York City - 175905
New Jersey - 224951

France - 1403916
Bretagne - 102740
Ile-de-France - 8649

Andorra - 9407
Monaco - 1124039
OSM:

Как найти номер отношения OSM, которое является административной границей:
http://nominatim.openstreetmap.org/ Вводим искомое название, находим, нажимаем 'details' и в открывшейся странице находим 'boundary:administrative, relation: NUMBER'

Получение всех координат в формате GeoJSON мультиполигона: http://osm102.openstreetmap.fr/~jocelyn/polygons/index.py?id=+NUMBER
Вводим номер, делаем refresh и открываем GeoJSON
Внимание! Он выводит все полигоны в виде отдельных полигонов в составе multipolygon, даже выколотые.
Это необходимо проверять и править руками путем понижения уровня массивов выколотых полигонов.

Или с помощью программы JOSM скачать все объекты по номеру отношения (Download object с опцией Download referrers),
разбить в объектах все связи, удалить все тэги у всех точек и сохранить как geojson. Не забыть вставить в массив последние элементы массива равные первым для каждого полигона.
Подробнее: https://help.openstreetmap.org/questions/8082/export-boundaries

Еще варианты: https://help.openstreetmap.org/questions/8273/how-do-i-extract-the-polygon-of-an-administrative-boundary

Номера OSM границ некоторых объектов:
Russia - 60189
Moscow - 102269
Moscow Oblast - 51490
Saint Petersburg - 337422
Krasnogorsk - 181345

USA - 148838
New York - 61320
New York City - 175905
New Jersey - 224951

France - 1403916
Bretagne - 102740
Ile-de-France - 8649

Andorra - 9407
Monaco - 1124039


Вариант с shpefile:
Сайт http://www.gadm.org/ может отдать shapefile полигонов административных областе (с не очень хорошей точностью)
Онлайн иструмент: http://mapshaper.org/
Утилита: http://vallandingham.me/shapefile_to_geojson.html
Клиентский скрипт для конвертации shapefile в geojson: https://github.com/wavded/js-shapefile-to-geojson (Реализован в pastvu: pastvu.com/js/shape2geojson/leaf.html)
6 changes: 6 additions & 0 deletions public/style/photo/photo.less
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@
.imgareaselect-selection {
}

.regions {
.region {
display: inline-block;
}
}

.photoInfoBlock {
&:nth-child(n+3) {
margin-top: 7px;
Expand Down
22 changes: 15 additions & 7 deletions views/module/photo/photo.jade
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
select.multiSelect#convertSelect(multiple="multiple", data-bind="multiselect: true, options: convertOptions, selectedOptions: selectedOpt, optionsValue: 'vId', optionsText: 'vName'")
button.btn-strict.btnConvert(type="button", data-bind="click: toConvert, attr: {disabled: exe()}")
span start
.photoMsg(data-bind="text: msg(), css: msgCss(), style: {display: msg().length > 0 ? '' : 'none'}")
.photoMsg(data-bind="text: msg(), css: msgCss(), style: {display: msg().length ? '' : 'none'}")

.row-fluid.photoData(data-bind="css: {editMode: edit()}")
.span8-9.photoPanel
Expand Down Expand Up @@ -117,24 +117,32 @@
//-DATA VIEW MODE
script(id="photoView", type="text/html")
.row-fluid.photoInfoBlock
//ko if: p.title().length > 0
//ko if: p.title().length
.row-fluid.photoInfo.photoTitle.editable(data-bind="cEdit: {edit: edit(), val: p.title, cap: 'Введите название фотографии'}")
// /ko
//ko if: p.desc().length > 0
//ko if: p.regions().length
.row-fluid.regions(data-bind="foreach: p.regions")
.region
a(data-bind="text: ' ' + $data.title_local(), attr: {href: '/admin/region/' + $data.cid()}")
//ko if: $index() < $parent.p.regions().length - 1
| ,&nbsp;
// /ko
// /ko
//ko if: p.desc().length
.row-fluid.photoInfo(data-bind="html: p.desc()")
// /ko
.row-fluid.photoInfoBlock
//ko if: p.address().length > 0
//ko if: p.address().length
.row-fluid.photoInfo
.infoName Адрес снимка:
.editable(data-bind="cEdit: {edit: edit(), val: p.address, cap: 'Вы знаете адрес точки съемки?', readPrefix: 'Adress:', readPrefixCss: 'infoName'}")
// /ko
//ko if: p.source().length > 0
//ko if: p.source().length
.row-fluid.photoInfo
.infoName Источник:
.editable(data-bind="html: p.source()")
// /ko
//ko if: p.author().length > 0
//ko if: p.author().length
.row-fluid.photoInfo
.infoName Автор:
.editable(data-bind="cEdit: {edit: edit(), val: p.author, cap: 'Возможно вы знаете автора фотографии?'}")
Expand All @@ -146,7 +154,7 @@
span(data-bind="html: p.year()")
span(data-bind="html: '&minus;' + p.year2(), style: {display: p.year() !== p.year2() ? '' : 'none'}")
span(data-bind="html: '&nbsp;' + (p.year() !== p.year2() ? 'годами' : 'году') + '&nbsp;'")
//ko if: p.dir && p.dir() && p.dir().length > 0
//ko if: p.dir && p.dir() && p.dir().length
span &nbsp;(направление съемки &minus;&nbsp;
span.editable(data-bind="text: $root.P.photoDirsTxt[p.dir()]", style="text-transform: lowercase;")
| )
Expand Down

0 comments on commit db41586

Please sign in to comment.