UlmApi / kleinerspatz

:baby: A better, graphical way to find childcare facilities in Ulm, Germany
http://www.ulmapi.de/kleinerspatz/
MIT License
0 stars 1 forks source link

Improve JSON creation #4

Closed berb closed 10 years ago

berb commented 10 years ago

The perl script does create the final JSON file. Hence, the workflow for updating the JSON file used in the web app is cumbersome.

hkopp commented 10 years ago

The perl script does NOT create the final json. The workflow would be to use the perlscript and then merger.html. I think i'll write a shellscript to automate this stuff.

taxilof commented 10 years ago

The perl script generates kitadata.json, this data is merged with coords.json (provided by stk). getKITAInstanceInfo.js can be used to gather the needed data (X, Y, address?). X and Y must be converted to valid lat/long pairs, maybe stk can provide a formular?

hkopp commented 10 years ago

stk wrote to me a mail with the following magical formula:

cs2cs -f "%.8f" +proj=tmerc +lat_0=0 +lon_0=9 +k=1.000000 +x_0=3500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs [inputfile]

that converts GK3 to WGS84.

namnatulco commented 10 years ago

I just realized the getKITAInstanceInfo.js was missing, and merged it back (66647616a2). However, note that the script only works on a browser that doesn't verify same origin policy (this relates to #5 and I might fix it later).

stkdiretto commented 10 years ago

The coordinates are parsed from the detail pages as Gauss Krueger Zone 3 coordinate pairs. E.g., id 10 has easting 3572983 and northing 5358494 (rechtswert und hochwert).

Those can be converted to decimal degree latitudes and longitudes within the WGS84 Coordinate Reference System, for instance through cs2cs, which is part of proj(1).

A proj.4 conversion to WGS84 lat/lon would be

cs2cs -f "%.8f" +proj=tmerc +lat_0=0 +lon_0=9 +k=1.000000 +x_0=3500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs [inputfile] 

-f "%.8f" → format selector for decimal degrees +lon_0=9 → 9 degrees as middle meridian (GK3) +x_0=3500000 → false easting of 3.500.000 km (GK3)

hkopp commented 10 years ago

Done in eda49457a5d73b39fa39ecdc6851211d4d653d49 I have integrated everything into the perlscript. Now you just have to call ./encodekitas.pl and it directly writes kita_final.json.

hkopp commented 10 years ago

...seems i have missed some small problems, but i am working on it

namnatulco commented 10 years ago

We fixed it.