This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.4' | |
services: | |
web: | |
restart: always | |
build: . | |
image: samples/fastapi-react-app | |
expose: | |
- "8000" | |
ports: | |
- "8000:8000" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:12.18-alpine AS ReactImage | |
WORKDIR /app/frontend | |
COPY ./frontend/package.json ./frontend/yarn.lock /app/frontend/ | |
RUN yarn install --no-optional | |
COPY ./frontend ./ | |
RUN yarn build | |
FROM python:3.8-slim-buster | |
ENV PYTHONUNBUFFERED 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
ApolloClient, | |
ApolloProvider, gql, HttpLink, InMemoryCache, useQuery | |
} from "@apollo/client"; | |
import bbox from "@turf/bbox"; | |
import MapGL, { Layer, Source } from "@urbica/react-map-gl"; | |
import "mapbox-gl/dist/mapbox-gl.css"; | |
import React, { useEffect, useState } from "react"; | |
const httpLink = new HttpLink({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REACT_APP_GRAPHQL_URL=http://localhost:8000/graphql | |
REACT_APP_MAPBOX_ACCESS_TOKEN=pk.*********************************************************** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI, Request | |
from fastapi.middleware.cors import CORSMiddleware | |
from starlette.graphql import GraphQLApp | |
import graphene | |
from fastapi.templating import Jinja2Templates | |
from graphql.execution.executors.asyncio import AsyncioExecutor | |
from fastapi.staticfiles import StaticFiles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests as req | |
from graphene import String, ObjectType, Float, Int, Field, Boolean | |
from operator import itemgetter | |
class Point(ObjectType): | |
lat = Float() | |
lng = Float() | |
class IbbParkObjectType(ObjectType): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Optional | |
import base64 | |
from passlib.context import CryptContext | |
from datetime import datetime, timedelta | |
import jwt | |
from jwt import PyJWTError | |
from pydantic import BaseModel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
color_options = {'colorFilename': 'gdal_rusle_colors.txt', | |
'format' : "GTiff", 'band':'1','addAlpha':True} | |
#Raster veriyi renklendirmek için gdal DEMProcessing fonksiyonu uygulanacak. | |
rusle_eski_colored = gdal.DEMProcessing(destName='/vsimem/rusle_eski_colored.tif', | |
srcDS=rusle_eski_reclassified.name, | |
processing='color-relief',**color_options) | |
rusle_yeni_colored = gdal.DEMProcessing(destName='/vsimem/rusle_yeni_colored.tif', | |
srcDS=rusle_yeni_reclassified.name, | |
processing='color-relief',**color_options) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def merge_rasters(first, second, out_file): | |
GDAL_PATH = os.environ.get("GDAL_PATH") | |
ps = subprocess.call( | |
['python', '{}\gdal_merge.py'.format(GDAL_PATH), | |
'-o', out_file, '-co', 'COMPRESS=LZW', '-n', '0','-ot', 'Int16', | |
first, second], | |
) | |
color_options = {'colorFilename': 'rusle_difference.txt', | |
'format': "GTiff", 'band': '1', 'addAlpha': True} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#RUSLE ham verisinden 5 grupta toplanmış risk haritası oluşturmak için | |
#aralık değerleri ve sınıf kodlarını içeren formül | |
rusle_rc_formul = "(logical_and(A>=0,A<=5)*1)+(logical_and(A>5,A<=10)*2)"\ | |
"+(logical_and(A>10,A<=20)*3)+(logical_and(A>20,A<=50)*4)+"\ | |
"(logical_and(A>50, A<=30000)*5)" | |
gdal_calculate(calc=rusle_rc_formul, | |
outfile='{}_SDR_RC.tif'.format(Path(rusle_eski_path).stem), | |
NoDataValue=0, creation_options=['COMPRESS=LZW'], | |
allBands=False, overwrite=True, debug=False, | |
quiet=True, A=rusle_eski_path, type='Byte') |
NewerOlder