Giter Club home page Giter Club logo

offline-map's Introduction

OFFLINE-MAP

Adım 1 (Programı indir)

git clone https://github.com/bedirhan-1/offline-map.git
cd offline-map

Adım 2 (Gerkesinimleri projeye ekle)

yarn
yarn start

veya

npm install
npm start

Programın bu aşamada çalışıyor olması gerekir. Eğer bir sorunla karşılaşılıyorsa npm güncellemesi yapılabilir. Sonrasıda 2. adım tekrarlanılabilir.

Program craco ile build edildi.

Programla ilgili bilinmesi gerekn bazı şeyler

Oldukça basit bir offline map yapmak için yazıldı ve şu an için ekstra bir özelliği yok.

// Viewer komponenti haritanın kendisini oluşturur.
<Viewer full timeline={false} animation={false}>
  <ImageryLayer />
  <SwitchOffline />
</Viewer>

Viewer'ın içinde bulunan ImageryLayer haritanın offline olmasını sağlayan bir provider oluşturur. SwitchOffline ise bu provider'ı etkinleştiren veya kapatan yapıdır.

ImageryLayer

const ImageryLayer = () => {
  const imageryLayer = useAppSelector((state) => state.layer);
  const { Offline_World_Map } = imageryLayer;

  return (
    <div>
      <ImageryLayerForOfflineMap
        frame={Offline_World_Map}
        url={Arcgis.Offline_World_Map}
      />
    </div>
  );
};

ImageryLayerForOfflineMap komponenti isminden anlaşılcağı gibi offline map için bir görsel katmanı oluşturmaktır.

ImageryLayerForOfflineMap'in içeriği:

const ImageryLayerForOfflineMap = (props: IFrame) => {
  const MapIsOffline = useAppSelector((state) => state.switch.isOn);
  const { url } = props;
  return (
    <div>
      {MapIsOffline ? (
        <Layer
          imageryProvider={
            new TileMapServiceImageryProvider({
              url: buildModuleUrl(`${url}`),
            })
          }
        />
      ) : null}
    </div>
  );
};

Burada gerçekleşen olay ise cesium'un kendisinde bulunan TileMapServiceImageryProvider'ı ve buildModuleUrl'i örnekte olduğu gibi kullanarak (şu an için props olarak gelen url, cesiumun içinde halihazırda bulunan NaturalEarthII dosya yapısını işaret ediyor) offline harita için gerekli assetleri bulunduran file yapısını haritaya enjekte edebiliyoruz.

Kendi offline harita assetlerimi oluşturmak için gereksinimler

offline-map's People

Contributors

bedirhan-1 avatar isazobu avatar

Watchers

James Cloos avatar  avatar

Forkers

isazobu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.