Remove /api/0.6/changes endpoint

Also removes sql functions which are only used by this endpoint
This commit is contained in:
mmd-osm 2019-12-28 20:42:08 +01:00 committed by Andy Allan
parent cea93e7244
commit 4e6d729529
9 changed files with 2 additions and 255 deletions

View file

@ -16,7 +16,7 @@ all: ${DESTDIR}/libpgosm.so
clean:
$(RM) ${DESTDIR}/*.so ${DESTDIR}/*.o
${DESTDIR}/libpgosm.so: ${DESTDIR}/quadtile.o ${DESTDIR}/maptile.o ${DESTDIR}/xid_to_int4.o
${DESTDIR}/libpgosm.so: ${DESTDIR}/quadtile.o ${DESTDIR}/xid_to_int4.o
cc ${LDFLAGS} -o $@ $^
${DESTDIR}/%.o: %.c

View file

@ -42,33 +42,6 @@ END;
$$ LANGUAGE plpgsql IMMUTABLE;
-- maptile_for_point returns an integer representing the tile at the given zoom
-- which contains the point (scaled_lon, scaled_lat). Note that the arguments
-- are in the order (lat, lon), and should be scaled by 10^7.
--
-- The maptile_for_point function is used only for grouping the results of the
-- (deprecated?) /changes API call. Please don't use it for anything else, as
-- it might go away in the future.
CREATE OR REPLACE FUNCTION maptile_for_point(scaled_lat int8, scaled_lon int8, zoom int4)
RETURNS int4
AS $$
DECLARE
lat CONSTANT DOUBLE PRECISION := scaled_lat / 10000000.0;
lon CONSTANT DOUBLE PRECISION := scaled_lon / 10000000.0;
zscale CONSTANT DOUBLE PRECISION := 2.0 ^ zoom;
pi CONSTANT DOUBLE PRECISION := 3.141592653589793;
r_per_d CONSTANT DOUBLE PRECISION := pi / 180.0;
x int4;
y int4;
BEGIN
-- straight port of the C code. see db/functions/maptile.c
x := floor((lon + 180.0) * zscale / 360.0);
y := floor((1.0 - ln(tan(lat * r_per_d) + 1.0 / cos(lat * r_per_d)) / pi) * zscale / 2.0);
RETURN (x << zoom) | y;
END;
$$ LANGUAGE plpgsql IMMUTABLE;
-- xid_to_int4 converts a PostgreSQL transaction ID (xid) to a 32-bit integer
-- which can then be used to efficiently find rows which have changed between
-- two given transactions. This is currently used by Osmosis to extract a

View file

@ -1,36 +0,0 @@
#include <math.h>
#include <postgres.h>
#include <fmgr.h>
Datum
maptile_for_point(PG_FUNCTION_ARGS)
{
double lat = PG_GETARG_INT64(0) / 10000000.0;
double lon = PG_GETARG_INT64(1) / 10000000.0;
int zoom = PG_GETARG_INT32(2);
double scale = pow(2, zoom);
double r_per_d = M_PI / 180;
unsigned int x;
unsigned int y;
x = floor((lon + 180.0) * scale / 360.0);
y = floor((1 - log(tan(lat * r_per_d) + 1.0 / cos(lat * r_per_d)) / M_PI) * scale / 2.0);
PG_RETURN_INT32((x << zoom) | y);
}
PG_FUNCTION_INFO_V1(maptile_for_point);
/*
* To bind this into PGSQL, try something like:
*
* CREATE FUNCTION maptile_for_point(int8, int8, int4) RETURNS int4
* AS '/path/to/rails-port/db/functions/libpgosm', 'maptile_for_point'
* LANGUAGE C STRICT;
*
* (without all the *s)
*/
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

View file

@ -128,31 +128,6 @@ CREATE TYPE public.user_status_enum AS ENUM (
);
--
-- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.maptile_for_point(scaled_lat bigint, scaled_lon bigint, zoom integer) RETURNS integer
LANGUAGE plpgsql IMMUTABLE
AS $$
DECLARE
lat CONSTANT DOUBLE PRECISION := scaled_lat / 10000000.0;
lon CONSTANT DOUBLE PRECISION := scaled_lon / 10000000.0;
zscale CONSTANT DOUBLE PRECISION := 2.0 ^ zoom;
pi CONSTANT DOUBLE PRECISION := 3.141592653589793;
r_per_d CONSTANT DOUBLE PRECISION := pi / 180.0;
x int4;
y int4;
BEGIN
-- straight port of the C code. see db/functions/maptile.c
x := floor((lon + 180.0) * zscale / 360.0);
y := floor((1.0 - ln(tan(lat * r_per_d) + 1.0 / cos(lat * r_per_d)) / pi) * zscale / 2.0);
RETURN (x << zoom) | y;
END;
$$;
--
-- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
--