Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
|
fw:othersnet:easygis [2009/11/03 09:20] alfred |
fw:othersnet:easygis [2020/05/09 09:25] (actual) |
||
|---|---|---|---|
| Línea 1: | Línea 1: | ||
| ====== EasyGIS ====== | ====== EasyGIS ====== | ||
| Es una librería bastante sencilla para la creación de aplicaciones GIS con .NET. \\ | Es una librería bastante sencilla para la creación de aplicaciones GIS con .NET. \\ | ||
| - | Su página es: [[http://www.easygisdotnet.com/]]. | + | * Su página es: [[http://www.easygisdotnet.com/]]. |
| + | * Podemos encontrar ejemplos en: [[http://www.easygisdotnet.com/api/]] | ||
| + | |||
| Línea 33: | Línea 36: | ||
| ShapeFileWriter sfw = ShapeFileWriter.CreateWriter("c:\\LiniesExportadesSAE\\", "Line", ShapeType.PolyLine, d); | ShapeFileWriter sfw = ShapeFileWriter.CreateWriter("c:\\LiniesExportadesSAE\\", "Line", ShapeType.PolyLine, d); | ||
| </code> | </code> | ||
| + | Luego, por cada elemento\registro que queramos agregar a la shapefile llamaremos al método ''AddRecord'' del ''ShapeFileWriter''. Como en nuestro caso creamos una linia tendremos que ir agregando los puntos que la forman mediante un array de ''PointF'', luego crearemos un array de strings que contendrá los valores de cada campo definidos en el array de ''DbfFieldDesc''. | ||
| + | <code csharp> | ||
| + | PointF[] ps = new PointF[numSubVials]; | ||
| + | foreach (int i=0; i<numSubVials; i++) | ||
| + | ps[i] = new PointF(float.Parse(SubVials[i].x), float.Parse(SubVials[i].y)); | ||
| + | |||
| + | string[] values = new string[4]; | ||
| + | values[0] = t.id; | ||
| + | values[1] = fixString(t.cod_pub); | ||
| + | values[2] = fixString(t.denominacio); | ||
| + | values[3] = l.id; | ||
| + | |||
| + | sfw.AddRecord(ps, ps.Length, values); | ||
| + | </code> | ||
| + | |||
| + | Y luego, finalizaremos el writer: | ||
| + | <code csharp> | ||
| + | sfw.Close(); | ||
| + | </code> | ||
| + | ===== Lectura de Shapes ===== | ||
| + | ==== Lectura de la forma ==== | ||
| + | <code csharp> | ||
| + | string file = "c:\\Export_Output.shp"; | ||
| + | ShapeFile sf = new ShapeFile(file); | ||
| + | ShapeFileEnumerator sfEnum = sf.GetShapeFileEnumerator(); | ||
| + | while (sfEnum.MoveNext()) | ||
| + | { | ||
| + | PointF[] points = sfEnum.Current[0]; | ||
| + | int a = points.Length; | ||
| + | } | ||
| + | sf.Close(); | ||
| + | </code> | ||
| + | ==== Lectura de los datos ==== | ||
| ===== Notas ===== | ===== Notas ===== | ||