GeoJSON y Mapant

De Mapant ES
Revisión del 10:09 3 nov 2022 de Mapantwiki (discusión | contribs.)
(difs.) ← Revisión anterior | Revisión actual (difs.) | Revisión siguiente → (difs.)

Un fichero GeoJSON es de tipo texto y en él se sigue una notación que procede de JSON, JavaScript Object Notation. Es una extensión de esa notación en la que solo se describen elementos geográficos.

La exportación que genera Mapant describe los elementos de una forma particular. Se trata básicamente de indicar que se van a escribir un conjunto de elementos; a continuación se escribe cada elemento, describiendo su tipo, coordenadas y símbolo ISOM correspondiente; finalmente se hace un listado de todos los símbolos utilizados, con su código y descripción.

Los elementos pueden ser de los siguientes tipos: punto, línea, multilínea, polígono y multipolígono.

A continuación se muestra un ejemplo extraído de una exportación real. Se han dejado solo unos pocos elementos y se han añadido saltos de línea (que no existen en el original) solo con el propósito de hacerlo más interpretable. En el ejemplo se puede ver la cabecera de inicio del fichero, un elemento de cada tipo y la lista de símbolos.

{"type" : "FeatureCollection", "features" : [

{"type" : "Feature", "geometry" : {"type":"Point","coordinates":[-8.0284763489,43.6830938622]}, "properties" : {"isom_code" : "111.00"}},

{"type" : "Feature", "geometry" : {"type":"LineString","coordinates":[[-8.0310747192,43.6784810155],[-8.031134807,43.6784461749]]}, "properties" : {"isom_code" : "202.10"}},

{"type" : "Feature", "geometry" : {"type":"MultiLineString","coordinates":[[[-8.0321184985,43.6861402344],[-8.0319124,43.6862455],[-8.031927,43.6860035],[-8.0321184985,43.6856920541]],[[-8.0321184985,43.6836698367],[-8.0316516,43.6840086],[-8.0312195,43.684453],[-8.030893,43.6847933],[-8.030593,43.6850822],[-8.0300672,43.6853835],[-8.0298752,43.6856196],[-8.0296255,43.6859946],[-8.0294317,43.6863212],[-8.029359,43.686328],[-8.0291646,43.6860502],[-8.0290493,43.6857099],[-8.0290203,43.6854528],[-8.0290546,43.685192],[-8.029072,43.6849236],[-8.0290994,43.684722],[-8.0290317,43.6844729],[-8.0288669,43.6842447],[-8.0286268,43.6840641],[-8.0281659,43.6839947],[-8.0277338,43.6841475],[-8.0272249,43.6843211],[-8.0268984,43.6843905],[-8.0262646,43.6844391],[-8.0260297859,43.6844801261]]]}, "properties" : {"isom_code" : "505.00"}},

{"type" : "Feature", "geometry" : {"type":"Polygon","coordinates":[[[-8.0270599533,43.6805221511],[-8.0270891212,43.6805014733],[-8.0271180245,43.6805036633],[-8.0271524883,43.680486766],[-8.0272016773,43.6805271691],[-8.0271804559,43.6805403674],[-8.027083254,43.6805395401],[-8.0270599533,43.6805221511]]]}, "properties" : {"isom_code" : "206.00"}},

{"type" : "Feature", "geometry" : {"type":"MultiPolygon","coordinates":[[[[-8.03210335,43.6863948104],[-8.0321184985,43.6863913608],[-8.0321184985,43.6864173703],[-8.0320801984,43.686417046],[-8.0320843985,43.6864082459],[-8.03210335,43.6863948104]]],[[[-8.0321167664,43.6863320765],[-8.0321045082,43.6863227886],[-8.0320859703,43.6863182197],[-8.0320239408,43.6863176944],[-8.0319678985,43.6863306357],[-8.0319179824,43.6863484009],[-8.0318993026,43.6863526546],[-8.0318868967,43.6863525495],[-8.0318683588,43.6863479806],[-8.0318498446,43.6863342278],[-8.0318439872,43.6863204021],[-8.0318320423,43.6863070652],[-8.0318009243,43.6862977976],[-8.0317761125,43.6862975874],[-8.0317574327,43.6863018411],[-8.0317384811,43.6863152766],[-8.031732185,43.6863287291],[-8.0317320402,43.6863377319],[-8.0317135863,43.6863510814],[-8.0316818064,43.6863598162],[-8.0316695066,43.6863685358],[-8.03166328,43.6863776671],[-8.0316507293,43.6863865647],[-8.0316446152,43.6863732771],[-8.0316569946,43.6863596059],[-8.031682096,43.6863418107],[-8.031694821,43.6863375066],[-8.0317137726,43.6863240712],[-8.0317326948,43.6862970396],[-8.0317449945,43.6862883199],[-8.0317577194,43.6862840158],[-8.031776671,43.6862705803],[-8.0317828976,43.6862614491],[-8.0317956935,43.6862527336],[-8.0318080728,43.6862390624],[-8.0318265224,43.6862259829],[-8.0318455743,43.6862217323],[-8.0318519752,43.6862171946],[-8.0318581959,43.6862084234],[-8.0318520166,43.686199187],[-8.031846155,43.6861856314],[-8.031846879,43.6861406179],[-8.0318531751,43.6861271653],[-8.0318785245,43.6861093721],[-8.0318848206,43.6860959195],[-8.0318849654,43.6860869168],[-8.0318912614,43.6860734642],[-8.031904205,43.6860555659],[-8.0319105011,43.6860421133],[-8.0319106458,43.6860331106],[-8.0319047842,43.6860195551],[-8.03188627,43.6860058023],[-8.0318616003,43.6859967695],[-8.0318553471,43.6859921245],[-8.0318494855,43.6859785689],[-8.0318496303,43.6859695662],[-8.0318684562,43.6859562197],[-8.0318932679,43.6859564299],[-8.0319118057,43.6859609988],[-8.0319545938,43.6859929651],[-8.0319609946,43.6859884273],[-8.0319796743,43.6859841736],[-8.0320541092,43.6859848039],[-8.0320729351,43.6859714575],[-8.0320732247,43.685953452],[-8.0320795207,43.6859399994],[-8.0321184985,43.6859123663],[-8.0321184985,43.6860843926],[-8.0321021401,43.6860842541],[-8.0320836023,43.6860796852],[-8.032046822,43.6860521818],[-8.032034239,43.6860476633],[-8.0320220103,43.6860519717],[-8.0320156095,43.6860565095],[-8.0320031622,43.6860744119],[-8.0319967643,43.6860787697],[-8.0320030174,43.6860834147],[-8.0320151337,43.6861015252],[-8.0320209954,43.6861150807],[-8.0320208506,43.6861240834],[-8.0320145546,43.686137536],[-8.0319956031,43.6861509715],[-8.0319706495,43.686159584],[-8.0319580959,43.6861686617],[-8.0319081858,43.6861860668],[-8.0319017849,43.6861906046],[-8.0318893376,43.6862085071],[-8.0318829396,43.6862128648],[-8.0319137149,43.6862357254],[-8.0319388163,43.6862179301],[-8.0319512636,43.6862000276],[-8.0319697779,43.6862137804],[-8.0319879436,43.6862183462],[-8.0320256781,43.6862096618],[-8.0320504899,43.6862098719],[-8.0320882245,43.6862011875],[-8.0321184985,43.686179287],[-8.0321184985,43.6863326984],[-8.0321167664,43.6863320765]]]]}, "properties" : {"isom_code" : "406.00"}}

],

"properties" : {"isom_codes" : [{"isom_code" : 20600, "name" : "Gigantic Boulder or Rock Pillar"}, {"isom_code" : 40600, "name" : "Vegetation, Slow Running"}, {"isom_code" : 50500, "name" : "Footpath"}, {"isom_code" : 11100, "name" : "Small Depression"}, {"isom_code" : 20210, "name" : "Cliff Without Tags"}]}

}

En el ejemplo se puede ver cómo los corchetes sirven para encerrar grupos de valores: una coordenada (ya que es un grupo de 2 valores, la x + la y); una secuencia de coordenadas; una grupo de secuencias de coordenadas; todo el grupo de elementos (features)

Las llaves sirven para encerrar las distintas "propiedades : valores" de los elementos y también para comenzar y finalizar el fichero.