コード例 #1
0
    def test_add_indexes(self):
        poi = PointOfInterest()
        poi.slug = 'osm:N12345'
        poi.names = [LocalisedName(name='Test', lang='en')]
        poi.descriptions = [LocalisedName(name='Descriptions', lang='en')]
        poi.geography = Point(-1.6, 54.0)
        poi.identifiers = [Identifier(namespace='foo', value='bar')]

        self._pois.add_or_update(poi)
コード例 #2
0
    def _build_point_of_interest(self, elem, atco_code, stop_type):
        poi = PointOfInterest()
        poi.slug = 'atco:' + atco_code
        poi.categories.append(self._get_category(stop_type, atco_code))

        poi.identifiers.add(Identifier(namespace=ATCO_NAMESPACE, value=atco_code))
        self._add_identifier(poi, elem, CRS_NAMESPACE, self._CRS_CODE_XPATH)
        self._add_identifier(poi, elem, TIPLOC_NAMESPACE, self._TIPLOC_CODE_XPATH)

        self._add_location(poi, elem)

        poi.sources.append(Source(
            url=self._source_url + '/' + self._source_file,
            version=elem.attrib.get('RevisionNumber', '0'),
            attribution=self._ATTRIBUTION
        ))

        return poi