Giter VIP home page Giter VIP logo

tkmi's Introduction

TKMI

Step

  1. https://extract.bbbike.org/ tempat extract osm

  2. install postgres + postgis (jangan lupa username + passwordnya)

  3. download osm

  4. setting environment variable ke binnya (D:\Program Files\PostgreSQL\bin)(punya saya ini)

  5. run cmd

  6. masuk ke folder osmnya

  7. cobain "psql -U postgres" (punya saya postgres)

  8. masukin passwordmu

  9. ketik "CREATE DATABASE db_clearroute;"

  10. ctrl+c (keluar dari psql)

  11. "psql db_clearroute postgres"

  12. masukin password

  13. "CREATE EXTENSION postgis;"

  14. "CREATE EXTENSION pgRouting;"

  15. ctrl+c (keluar dari psql)

  16. download mapconfig.xml di https://github.com/pgRouting/osm2pgrouting-build/blob/master/mapconfig.xml, taroh di folder yang sama kayak osmnya

  17. "osm2pgrouting --f surabaya.osm --conf mapconfig.xml --dbname db_clearroute --username postgres --password n --clean"

  18. tunggu

  19. "psql db_clearroute postgres"

  20. masukin password

  21. testing "SELECT name FROM ways;"

  22. selamat, anda mendapatkan semua nama jalan

  23. jalanin ALTER TABLE configuration ADD COLUMN penalty FLOAT; UPDATE configuration SET penalty=1.0; UPDATE configuration SET penalty=2.0 WHERE tag_id = 112; UPDATE configuration SET penalty=1.5 WHERE tag_id = 110; UPDATE configuration SET penalty=0.8 WHERE tag_id = 109; UPDATE configuration SET penalty=0.5 WHERE tag_id = 124; UPDATE configuration SET penalty=0.5 WHERE tag_id = 108;

Itu buat gantiin yang UPDATE osm_way_classes SET penalty=2.0 WHERE class_id = 112; UPDATE osm_way_classes SET penalty=1.5 WHERE class_id = 110; UPDATE osm_way_classes SET penalty=0.8 WHERE class_id = 109; UPDATE osm_way_classes SET penalty=0.5 WHERE class_id = 124; UPDATE osm_way_classes SET penalty=0.5 WHERE class_id = 108;

  1. konekin postgres ke xampp http://philippekouadio.com/blog/?p=5304&lang=en http://subhra.me/install-postgresql-in-xampp-on-windows-and-integrate-phppgadmin/ cobain itu dah, kalo mau phppgadmin monggo nek ubuntu : https://www.howtoforge.com/tutorial/ubuntu-postgresql-installation/

Benahi environtment variable jika postgremu tidak di install di dalam xampp setting php.ini pada folder xampp>php dan cari pgsql lalu ubah menjadi seperti ini extension = pgsql extension = pdo_pgsql

  1. coba di php buat query http://php.net/manual/en/function.pg-connect.php (mirip mysql, coba google aja cara pakenya)

  2. coba query yang ini SELECT ST_AsGeoJSON(ST_UNION(c.geom)) AS geojson FROM (SELECT a.seq AS seq, b.gid AS gi, b.name AS name, a.cost AS cost, b.the_geom AS geom, b.source, b.target, b.x1 AS x, b.y1 AS y FROM pgr_dijkstra('SELECT gid::integer AS id, source::integer, target::integer, cost::double precision AS cost, reverse_cost::double precision AS reverse_cost, x1, y1, x2, y2 FROM backup_ways', 912, 920, true, true) AS a LEFT JOIN ways AS b ON (a.id2 = b.gid) ORDER BY a.seq) AS c

harusnya keluar geojsonnya, coba di echo aja http://prntscr.com/jl7k5e (kek gitu keluarnya)

25b. https://gist.github.com/rezkyal/577b178053522d0cb366d412f9108dc2 (save as cek.php) jangan lupa ganti passwordnya

  1. nah dari data geojson itu bisa digambar nanti diatas mapnya, pake data layer (aku pakenya openlayer, tapi jenis lain ada banyak juga)(coba explore google yak) https://openlayers.org/en/latest/examples/geojson.html itu contoh kodingannya

27.https://gist.github.com/rezkyal/26a0383e91195ec9dde764549918ea53 (save as script.js) https://gist.github.com/rezkyal/743ab3fcf64b554a34730906e5be5937(save as index.php)

27,1. CREATE TABLE backup_ways AS TABLE ways; 27,2. ALTER TABLE backup_ways ADD cost_clearroute DOUBLE PRECISION;

  1. Fungsi updateCostFix CREATE OR REPLACE FUNCTION updateCostFix(i INTEGER) RETURNS INTEGER AS $$

DECLARE sql_gid text; rec record; BEGIN sql_gid := 'SELECT * FROM backup_ways'; FOR rec IN EXECUTE sql_gid LOOP EXECUTE 'UPDATE backup_ways SET cost_clearroute = (SELECT cost_s FROM backup_ways WHERE gid = '||rec.gid||') WHERE gid = '||rec.gid||''; RAISE NOTICE 'Inserting %', rec.gid; END LOOP; RETURN i+1;

END; $$ language plpgsql volatile STRICT;

  1. Jalankan SELECT updateCostFix(1);
  2. intip.in/osmSIG, taro di htdocs jalankan xampp untuk webnya

tkmi's People

Contributors

naufalpf avatar

Watchers

James Cloos avatar

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.