示例#1
0
        // GET: api/Lieux/4.83/45.76/50
        public async Task <IHttpActionResult> GetLieuByPositionLimite(float latitude, float longitude, short limite)
        {
            short[] coordonneesSmartphone = new short[2];
            DonneesGeographiques.calculerCoordonnees(longitude, latitude, coordonneesSmartphone);
            if (!DonneesGeographiques.coordonneesDansLimites(coordonneesSmartphone))
            {
                return(Json("Le point donné n'est pas dans les limites"));
            }

            List <LieuResume> res = await dao.requeteChercherProximite(coordonneesSmartphone[0], coordonneesSmartphone[1], 1, limite);

            return(Json(res));
        }
示例#2
0
        private async void editModel()
        {
            LieuDAO lDao = new LieuDAO();
            await lDao.deleteLieux();

            foreach (Feature f in data.features)
            {
                Lieu    l           = new Lieu();
                short[] coordonnees = new short[2];
                DonneesGeographiques.calculerCoordonnees((float)f.geometry.coordinates[0], (float)f.geometry.coordinates[1], coordonnees);

                await lDao.addLieu(l.createLieu(f, coordonnees));
            }
        }
示例#3
0
        async public void readJson()
        {
            HttpClient c   = new HttpClient();
            Uri        uri = new Uri("https://download.data.grandlyon.com/wfs/rdata?SERVICE=WFS&VERSION=2.0.0&outputformat=GEOJSON&request=GetFeature&typename=sit_sitra.sittourisme");

            String json = await c.GetStringAsync(uri);

            data = JsonConvert.DeserializeObject <RootObject>(json);
            float longBuf;
            float latBuf;
            float minLat = (float)90.0D, maxLat = (float)0.0D,
                  minLong = (float)180.0D, maxLong = (float)-180.0D;

            foreach (Feature f in data.features)
            {
                longBuf = (float)f.geometry.coordinates[0];
                latBuf  = (float)f.geometry.coordinates[1];

                if (longBuf < minLong)
                {
                    minLong = longBuf;
                }
                if (longBuf > maxLong)
                {
                    maxLong = longBuf;
                }
                if (latBuf < minLat)
                {
                    minLat = latBuf;
                }
                if (latBuf > maxLat)
                {
                    maxLat = latBuf;
                }
            }
            DonneesGeographiques.initExtremums(minLong, maxLong, minLat, maxLat);

            editModel();
        }