Bonjour,
J'ai analysé plusieurs fichier .shp afin de pouvoir dessiner les différentes formes géométriques.
Par contre, j'ai un problème: toutes les formes ne sont pas affichées!
En effet, j'ai parfois des formes dont le shapeType est incohérent (par ex:1358954496).
En faisant le test avec GeoTools, il m'affiche tout ce dont j'ai besoin donc le problème vient certainement de mon code
Voici comment je lis un polygone:
Si quelqu'un trouve un anomalie...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 public Polygon readPolygon(int _fileLength) throws IOException { m_newFileLength = _fileLength; double xMin = readDoubleLittleEndian(); double yMin = readDoubleLittleEndian(); double xMax = readDoubleLittleEndian(); double yMax = readDoubleLittleEndian(); int numParts = readIntLittleEndian(); int numPoints = readIntLittleEndian(); m_newFileLength -= 40; Polygon polygon = new Polygon(numPoints); polygon.setBoundingBox(xMin, yMin, xMax, yMax); polygon.setNumParts(numParts); // remplissage des index de départ for (int i = 0; i < numParts; i++) { polygon.addPart(readIntLittleEndian(), i); m_newFileLength -= 4; } // remplissage des points for (int i = 0; i < numPoints; i++) { double pointX = readDoubleLittleEndian(); double pointY = readDoubleLittleEndian(); polygon.addPoint(new Point(pointX, pointY), i); m_newFileLength -= 16; } return polygon; }
Merci
Partager