Hi,
I'm new to Processing, so this is kind of a beginners level question:
I have a json file with lat/long decimaldegrees (ex. 153.134689, 26.848083 ) of the contour of Australia. I want to use this data to draw a contour of Australia in Processing. Just because I'm new to Processing I want to keep this as simple as possible, and so I wrote manually all the coordinates into Processing and used beginShape endShape. Why isn't this working? Is it just the ordering of the points that are off? Anybody got an idea?
Here is how my file should look like (in Shape Viewer, I converted the file from .shp to .json) compared to how it looks like in Processing:
Here is the code (with a LOT of coordinates, each "nummer x" is a new polygon in my json file):
I have a json file with lat/long decimaldegrees (ex. 153.134689, 26.848083 ) of the contour of Australia. I want to use this data to draw a contour of Australia in Processing. Just because I'm new to Processing I want to keep this as simple as possible, and so I wrote manually all the coordinates into Processing and used beginShape endShape. Why isn't this working? Is it just the ordering of the points that are off? Anybody got an idea?
Here is how my file should look like (in Shape Viewer, I converted the file from .shp to .json) compared to how it looks like in Processing:
Here is the code (with a LOT of coordinates, each "nummer x" is a new polygon in my json file):
- void setup() {
- size(180, 90);
- background(255);
- smooth();
- }
- void draw() {
- stroke(0);
- //nummer 1
- beginShape();
- vertex(150.755524, 23.512945);
- vertex(150.877197, 23.567528);
- vertex(150.790298, 23.558640);
- vertex(150.779922, 23.618999);
- vertex(150.740219, 23.592028);
- vertex(150.707916, 23.600082);
- vertex(150.722855, 23.567806);
- vertex(150.686111, 23.574833);
- vertex(150.755524, 23.512945);
- endShape();
- //nummer to
- beginShape();
- vertex(151.057159, 23.452168);
- vertex(151.190170, 23.541861);
- vertex(151.239105, 23.493389);
- vertex(151.284424, 23.796167);
- vertex(151.261612, 23.758444);
- vertex(151.223221, 23.801945);
- vertex(151.191132, 23.774973);
- vertex(151.173035, 23.746889);
- vertex(151.246307, 23.710583);
- vertex(151.162415, 23.731112);
- vertex(151.124664, 23.667528);
- vertex(151.046921, 23.624083);
- vertex(150.996674, 23.500111);
- vertex(150.975113, 23.496695);
- vertex(151.057159, 23.452168);
- endShape();
- //nummer tre
- beginShape();
- vertex(115.448280, 20.835388);
- vertex(115.308998, 20.869806);
- vertex(115.447281, 20.670361);
- vertex(115.448280, 20.835388);
- endShape();
- //nummer fire
- beginShape();
- vertex(148.277219, 40.002446);
- vertex(147.861149, 40.003430);
- vertex(147.887054, 39.918667);
- vertex(147.749756, 39.875195);
- vertex(147.944107, 39.721554);
- vertex(148.180145, 39.951500);
- vertex(148.294449, 39.964527);
- vertex(148.277219, 40.002446);
- endShape();
- //nummer fem
- beginShape();
- vertex(144.065023, 40.012405);
- vertex(143.894593, 40.012808);
- vertex(143.843384, 39.719917);
- vertex(143.972641, 39.593861);
- vertex(144.109192, 39.673084);
- vertex(144.138168, 39.938499);
- vertex(144.065023, 40.012405);
- endShape();
- //nummer seks
- beginShape();
- vertex(145.296783, 38.451500);
- vertex(145.360672, 38.564278);
- vertex(145.120590, 38.511944);
- vertex(145.296783, 38.451500);
- endShape();
- //nummer syv
- beginShape();
- vertex(145.500977, 38.358723);
- vertex(145.271942, 38.410526);
- vertex(145.293228, 38.288918);
- vertex(145.370834, 38.317722);
- vertex(145.500977, 38.358723);
- endShape();
- //nummer åtte
- beginShape();
- vertex(137.778748, 35.730305);
- vertex(137.751190, 35.846306);
- vertex(137.937637, 35.719501);
- vertex(138.131424, 35.844639);
- vertex(138.040771, 35.907444);
- vertex(137.733521, 35.857971);
- vertex(137.459579, 36.077641);
- vertex(137.218506, 35.977306);
- vertex(136.702133, 36.065971);
- vertex(136.531662, 35.879250);
- vertex(136.586166, 35.752304);
- vertex(137.630341, 35.570667);
- vertex(137.573196, 35.725777);
- vertex(137.778748, 35.730305);
- endShape();
- //nummer ni
- beginShape();
- vertex(153.547806, 27.435917);
- vertex(153.410965, 27.738056);
- vertex(153.397781, 27.496529);
- vertex(153.441910, 27.393862);
- vertex(153.490326, 27.422361);
- vertex(153.547806, 27.435917);
- endShape();
- //nummer ti
- beginShape();
- vertex(153.467285, 27.033333);
- vertex(153.428558, 27.366722);
- vertex(153.363007, 27.067972);
- vertex(153.467285, 27.033333);
- endShape();
- //nummer elleve
- beginShape();
- vertex(153.134689, 26.848083);
- vertex(153.177994, 27.106695);
- vertex(153.082809, 26.985445);
- vertex(153.134689, 26.848083);
- endShape();
- //nummer tolv
- beginShape();
- vertex(112.964447, 25.504694);
- vertex(113.208580, 26.160694);
- vertex(112.956337, 25.789139);
- vertex(112.911057, 25.587334);
- vertex(112.964447, 25.504694);
- endShape();
- //nummer 13
- beginShape();
- vertex(153.367645, 25.008528);
- vertex(153.046799, 25.799778);
- vertex(152.940552, 25.579500);
- vertex(153.057526, 25.340973);
- vertex(152.992828, 25.226862);
- vertex(153.240280, 24.972334);
- vertex(153.123810, 24.816610);
- vertex(153.264450, 24.701279);
- vertex(153.270340, 24.777027);
- vertex(153.367645, 25.008528);
- endShape();
- //nummer 14
- beginShape();
- vertex(149.060135, 20.298111);
- vertex(148.964478, 20.328972);
- vertex(148.909393, 20.286528);
- vertex(148.955307, 20.157972);
- vertex(148.978363, 20.202389);
- vertex(149.060135, 20.298111);
- endShape();
- //nummer 15
- beginShape();
- vertex(146.354172, 18.422167);
- vertex(146.301117, 18.496056);
- vertex(146.072784, 18.251722);
- vertex(146.266861, 18.241722);
- vertex(146.354172, 18.422167);
- endShape();
- //nummer 16
- beginShape();
- vertex(139.578079, 17.088722);
- vertex(139.416077, 17.123556);
- vertex(139.497162, 16.978027);
- vertex(139.542221, 17.022194);
- vertex(139.578079, 17.088722);
- endShape();
- //nummer 17
- beginShape();
- vertex(139.645782, 16.445250);
- vertex(139.713562, 16.533806);
- vertex(139.597366, 16.553139);
- vertex(139.553757, 16.485361);
- vertex(139.442108, 16.677917);
- vertex(139.385300, 16.633751);
- vertex(139.290253, 16.738750);
- vertex(139.161835, 16.664972);
- vertex(139.307022, 16.462862);
- vertex(139.552032, 16.390917);
- vertex(139.645782, 16.445250);
- endShape();
- //nummer 18
- beginShape();
- vertex(137.079422, 15.668167);
- vertex(137.073608, 15.846194);
- vertex(136.929672, 15.728000);
- vertex(136.997635, 15.587028);
- vertex(137.079422, 15.668167);
- endShape();
- //nummer 19
- beginShape();
- vertex(136.609055, 15.527889);
- vertex(136.586105, 15.646528);
- vertex(136.492691, 15.640889);
- vertex(136.522202, 15.530806);
- vertex(136.609055, 15.527889);
- endShape();
- //nummer 20
- beginShape();
- vertex(124.656441, 15.400444);
- vertex(124.527336, 15.448417);
- vertex(124.592026, 15.374861);
- vertex(124.459053, 15.366861);
- vertex(124.557053, 15.260805);
- vertex(124.656441, 15.400444);
- endShape();
- //nummer 21
- beginShape();
- vertex(125.211975, 14.596389);
- vertex(125.139969, 14.649972);
- vertex(125.094749, 14.546556);
- vertex(125.169250, 14.443750);
- vertex(125.211975, 14.596389);
- endShape();
- //nummer 22
- beginShape();
- vertex(136.297470, 13.737750);
- vertex(136.244247, 13.854111);
- vertex(136.181885, 13.770778);
- vertex(136.117554, 13.833889);
- vertex(136.111420, 13.732166);
- vertex(136.223007, 13.665083);
- vertex(136.297470, 13.737750);
- endShape();
- //nummer 23
- beginShape();
- vertex(136.726868, 13.844584);
- vertex(136.824554, 13.853889);
- vertex(136.837448, 13.750778);
- vertex(136.923111, 13.806861);
- vertex(136.853561, 13.913750);
- vertex(136.714752, 13.938694);
- vertex(136.806610, 14.032111);
- vertex(136.703583, 14.174916);
- vertex(136.870026, 14.216194);
- vertex(136.915085, 14.142889);
- vertex(136.947220, 14.309834);
- vertex(136.648697, 14.299806);
- vertex(136.436752, 14.202917);
- vertex(136.323639, 14.247528);
- vertex(136.440521, 14.124805);
- vertex(136.408920, 13.831306);
- vertex(136.633698, 13.789750);
- vertex(136.573975, 13.692056);
- vertex(136.693634, 13.663250);
- vertex(136.726868, 13.844584);
- endShape();
- //nummer 24
- beginShape();
- vertex(135.811081, 11.951583);
- vertex(135.560089, 12.073527);
- vertex(135.587112, 11.956139);
- vertex(135.782272, 11.910444);
- vertex(135.905869, 11.756194);
- vertex(135.811081, 11.951583);
- endShape();
- //nummer 25
- beginShape();
- vertex(132.649246, 11.652472);
- vertex(132.631531, 11.72247);
- vertex(132.498856, 11.682750);
- vertex(132.550278, 11.636861);
- vertex(132.649246, 11.652472);
- endShape();
- //nummer 26
- beginShape();
- vertex(130.407059, 11.548388);
- vertex(130.343384, 11.596194);
- vertex(130.455887, 11.568306);
- vertex(130.442245, 11.722055);
- vertex(130.555969, 11.697361);
- vertex(130.640305, 11.762111);
- vertex(130.611053, 11.827389);
- vertex(130.308945, 11.775084);
- vertex(130.043243, 11.827027);
- vertex(130.068588, 11.674222);
- vertex(130.299728, 11.715639);
- vertex(130.183701, 11.639305);
- vertex(130.230637, 11.494750);
- vertex(130.138855, 11.478278);
- vertex(130.347717, 11.331195);
- vertex(130.407059, 11.548388);
- endShape();
- //nummer 27
- beginShape();
- vertex(130.559525, 11.391778);
- vertex(130.625443, 11.430722);
- vertex(130.658340, 11.341278);
- vertex(130.704300, 11.480778);
- vertex(130.815887, 11.536861);
- vertex(130.704330, 11.386056);
- vertex(130.923035, 11.310862);
- vertex(131.022415, 11.362306);
- vertex(131.024139, 11.478666);
- vertex(131.041641, 11.317389);
- vertex(131.103058, 11.338223);
- vertex(131.143921, 11.247222);
- vertex(131.250076, 11.470000);
- vertex(131.189423, 11.299556);
- vertex(131.255310, 11.189528);
- vertex(131.302887, 11.271305);
- vertex(131.426910, 11.259583);
- vertex(131.538559, 11.459389);
- vertex(131.465271, 11.499473);
- vertex(131.470642, 11.608444);
- vertex(131.372162, 11.585944);
- vertex(131.282394, 11.736000);
- vertex(130.957275, 11.943500);
- vertex(130.490219, 11.655583);
- vertex(130.358749, 11.247750);
- vertex(130.399826, 11.160111);
- vertex(130.599609, 11.299027);
- endShape();
- //nummer 28
- beginShape();
- vertex(136.681076, 11.250028);
- vertex(136.477661, 11.453167);
- vertex(136.754868, 11.044945);
- vertex(136.681076, 11.250028);
- endShape();
- //nummer 29
- beginShape();
- vertex(132.593826, 10.972305);
- vertex(132.587524, 11.353972);
- vertex(132.459717, 11.033750);
- vertex(132.593826, 10.972305);
- endShape();
- //nummer 30
- beginShape();
- vertex(142.608383, 10.755445);
- vertex(142.467896, 10.979055);
- vertex(142.595886, 10.872666);
- vertex(142.653717, 11.040000);
- vertex(142.718781, 10.966389);
- vertex(142.787720, 11.080472);
- vertex(142.868439, 11.383722);
- vertex(142.857224, 11.849972);
- vertex(143.246033, 11.976084);
- vertex(143.082809, 12.147388);
- vertex(143.081696, 12.342972);
- vertex(143.249802, 12.378889);
- vertex(143.262589, 12.499056);
- vertex(143.440750, 12.611333);
- vertex(143.353271, 12.899806);
- vertex(143.546051, 12.844584);
- vertex(143.508728, 13.142278);
- vertex(143.600479, 13.427861);
- vertex(143.532440, 13.749805);
- vertex(143.772919, 14.383972);
- vertex(143.949799, 14.517250);
- vertex(144.143661, 14.407666);
- vertex(144.198303, 14.262250);
- vertex(144.341309, 14.307333);
- vertex(144.519562, 14.169806);
- vertex(144.682831, 14.551194);
- vertex(144.905838, 14.610917);
- endShape();
- //nummer 31
- beginShape();
- vertex(142.269730, 10.729000);
- vertex(142.153137, 10.769361);
- vertex(142.123306, 10.650695);
- vertex(142.232391, 10.638028);
- vertex(142.269730, 10.729000);
- endShape();
- //nummer 32
- beginShape();
- vertex(105.716499, 10.467083);
- vertex(105.673164, 10.572278);
- vertex(105.538948, 10.516723);
- vertex(105.676804, 10.415916);
- vertex(105.716499, 10.467083);
- endShape();
- //nummer 33
- beginShape();
- vertex(142.326098, 10.201599);
- vertex(142.278641, 10.261333);
- vertex(142.189194, 10.195666);
- vertex(142.216939, 10.173729);
- vertex(142.326098, 10.201599);
- endShape();
- //nummer 34
- beginShape();
- vertex(142.146364, 10.155710);
- vertex(142.137466, 10.176639);
- vertex(142.118224, 10.148525);
- vertex(142.146364, 10.155710);
- endShape();
- //nummer 35
- beginShape();
- vertex(134.685952, 6.590383);
- vertex(134.698015, 6.577071);
- vertex(134.749054, 6.619250);
- vertex(134.669525, 6.772861);
- vertex(134.622696, 6.709694);
- vertex(134.685952, 6.590383);
- endShape();
- //nummer 36
- beginShape();
- vertex(134.732779, 6.538712);
- vertex(134.739925, 6.530826);
- vertex(134.740972, 6.528724);
- vertex(134.744919, 6.535056);
- vertex(134.732779, 6.538712);
- endShape();
- //nummer 37
- beginShape();
- vertex(134.801481, 6.407198);
- vertex(134.859371, 6.290934);
- vertex(134.835419, 6.471889);
- vertex(134.801481, 6.407198);
- endShape();
- }
1