class Locality(Entity): nombre = NameField centroide = CentroidField geometria = GeoShape() provincia = StateSimpleField departamento = DepartmentSimpleField municipio = MunicipalitySimpleField categoria = UnindexedTextField fuente = UnindexedTextField
class Settlement(Entity): nombre = NameField centroide = CentroidField geometria = GeoShape() provincia = StateSubField departamento = DepartmentSubField municipio = MunicipalitySubField localidad_censal = CensusLocalitySubField categoria = UnindexedTextField fuente = UnindexedTextField
class Municipality(Entity): nombre = NameField nombre_completo = UnindexedTextField centroide = CentroidField geometria = GeoShape() provincia = StateSimpleField categoria = UnindexedTextField fuente = UnindexedTextField class Meta: source = MetaField(excludes=['geometria'])
class Department(Entity): nombre = NameField nombre_completo = Text(index=False) centroide = CentroidField geometria = GeoShape() provincia = StateSimpleField categoria = UnindexedTextField fuente = UnindexedTextField class Meta: source = MetaField(excludes=['geometria'])
class Street(Entity): nombre = NameField altura = StreetNumbersField geometria = GeoShape() provincia = StateSubField departamento = DepartmentSubField localidad_censal = CensusLocalitySubField # Indexar las categorÃas de calles ya que se puede filtrar por las mismas categoria = Text(analyzer=name_analyzer_synonyms, search_analyzer=name_analyzer) fuente = UnindexedTextField
class WetlandIndex(DocType): title = Text() category = Text(fields={'raw': Keyword()}) keywords = Text(fielddata=True, fields={'raw': Keyword()}) wetland = Text(fielddata=True, fields={'raw': Keyword()}) country = Keyword() partner = Text(fielddata=True, fields={'raw': Keyword()}) ecoregion = Text(fielddata=True, fields={'raw': Keyword()}) geom = GeoShape() class Meta: index = 'wetland_index'
class State(Entity): nombre = NameField nombre_completo = UnindexedTextField iso_id = UnindexedTextField iso_nombre = UnindexedTextField centroide = CentroidField geometria = GeoShape() categoria = UnindexedTextField fuente = UnindexedTextField class Meta: source = MetaField(excludes=['geometria'])
class Street(Entity): nombre = NameField nomenclatura = Text(index=False) altura = StreetNumbersField geometria = GeoShape() provincia = StateSimpleField departamento = DepartmentSimpleField # Indexar las categorÃas de calles ya que se puede filtrar por las mismas categoria = Text( analyzer=name_analyzer_synonyms, search_analyzer=name_analyzer ) fuente = UnindexedTextField
class LayerIndex(DocType): title = Text() category = Text(fields={'raw': Keyword()}) topiccat = Keyword() description = Text() keywords = Text(fielddata=True, fields={'raw': Keyword()}) wetland = Text(fielddata=True, fields={'raw': Keyword()}) product_name = Text(fielddata=True, fields={'raw': Keyword()}) indicator_name = Text(fielddata=True, fields={'raw': Keyword()}) contact_person = Text(fielddata=True, fields={'raw': Keyword()}) contact_org = Text(fielddata=True, fields={'raw': Keyword()}) date_begin = Date() date_end = Date() lineage = Text() geom = GeoShape() class Meta: index = 'layer_index'
class MunicipalityGeom(Entity): geometria = GeoShape()
class DepartmentGeom(Entity): geometria = GeoShape()
class StateGeom(Entity): geometria = GeoShape()
class StreetBlock(Entity): calle = StreetSubField altura = StreetNumbersField geometria = GeoShape()
# small.append(str(lat)+", "+str(long)) small.append(lat) small.append(long) # print(str(lat) +", "+str(long)) # print (item['geometry']['rings']) large.append(small) print("====================") print(large) type = "Fuel Strage" if item['attributes']['NAME'] is None: description = type else: description = item['attributes']['NAME'] score = 0.72 v = {"type": "multipoint", "coordinates": large} gs = GeoShape(type="multipoint", coordinates=large) shpe = Area("multipoint", large) # long, lat = toLatLong(pylonas['geometry']['x'], pylonas['geometry']['y'], inverse=True) # poi = ProlepsysPOI( typos=type, description=description, score=score, # location=str(lat) + ", " + str(long), shape=v # shape = '{ "type": "multipoint", "coordinates": ' + shape + '}' ) poi.save()
class ReviewDoc(DocType): summary = Text() username = Object(properties={'username':Keyword()}) location = Nested(properties={'polygon':GeoShape()}) class Meta: index = 'review-index'
class Intersection(Entity): calle_a = StreetSimpleField calle_b = StreetSimpleField geometria = GeoShape()
class Meta: using = es_connection dynamic_templates = MetaField([ # Can't get this to work # https://stackoverflow.com/questions/49740033/elasticsearch-6-copy-to-with-dynamic-index-mappings # { # "strings": # { # "match_mapping_type": "string", # "mapping": { # "type": "text", # "copy_all": "anytext" # } # } # }, { "metadata_json": { "path_match": "metadata_json.identifier.identifier", "match_mapping_type": "string", "mapping": Keyword("not_analyzed") } }, { "metadata_json": { "path_match": "metadata_json.titles.title", "match_mapping_type": "string", "mapping": Text(fields={'raw': Keyword()}), } }, { "metadata_json": { "path_match": "metadata_json.subjects.subject", "match_mapping_type": "string", "mapping": Text(fields={'raw': Keyword()}), } }, { "metadata_json": { "path_match": "metadata_json.creators.creatorName", "match_mapping_type": "string", "mapping": Text(fields={'raw': Keyword()}), } }, { "metadata_json": { "path_match": "metadata_json.publicationYear", "match_mapping_type": "string", "mapping": Integer() } }, { "metadata_json": { "path_match": "metadata_json.publisher", "match_mapping_type": "string", "mapping": Text(fields={'raw': Keyword()}), } }, { "metadata_json": { "path_match": "metadata_json.dates.date", "match_mapping_type": "string", "mapping": DateRange() } }, { "metadata_json": { "path_match": "metadata_json.geoLocations.geoLocationBox", "match_mapping_type": "string", "mapping": GeoShape() } }, { "metadata_json": { "path_match": "metadata_json.geoLocations.geoLocationPoint", "match_mapping_type": "string", "mapping": GeoPoint() } } ])