Dynamic Web Gis: Jumadi, PHD
Dynamic Web Gis: Jumadi, PHD
Jumadi, PhD
Static website: is one that has web pages stored on the server in the format that is
sent to a client web browser. It is primarily coded in Hypertext Markup Language
(HTML).
2
Static
Advantages
Quick and easy to put together, even by someone who doesn't have
much experience.
Ideal for demonstrating how a site will look.
Cache friendly, one copy can be shown to many people.
Disadvantages
Difficult to maintain when a site gets large.
Difficult to keep consistent and up to date.
Offers little visitor personalization (all would have to be client side).
3
Static - Disadvantage
Disadvantages
The basic disadvantage of static web sites is the web
pages are developed at the time of constructing the site.
As such, all static website owners have to be abjectly
dependent on Web professionals whenever any changes
become necessary. Though the initial cost of setting up a
static Website may not be costly, its long term
maintenance will be expensive – more so, if the site owner
wishes to effect changes at regular intervals.
4
What we have done
What we will do (dynamic)
Dynamics GeoJson
How to generate GeoJson
Remember the rules
GeoJson
Stucture
Feature
FeatureCollection
Geometry Properties
Feature
Geometry Properties
Format
Format
Format
Useful functions for the converter
• MySQL function
• ST_AsGeoJSON(g)
• PHP functions
• json_decode($geomobject)
• json_encode($geomobject)
ST_AsGeoJSON(g)
• Converting GEOMETRY field into
GeoJson format.
• Example: select
OGR_FID,desa,ST_asGeoJson(SHA
PE) from kartasura
{"type": "Polygon", "coordinates":
[[[110.757526676, -7.56198921399994],
[110.76217, -7.56348], [110.76247, -7.56358],
[110.76281, -7.56369], [110.76303, -7.56376],
[110.76324, -7.56381], [110.76355, -7.5639],
[110.76497, -7.56435], [110.7651, -7.56439],
[110.76555, -7.56452], [110.76573, -7.56457],
[110.767579144, -7.56516953299996],
[110.768006511, -7.56532486399993],
[110.768407999, -7.56542848], [110.768692931,
json_decode()
• Conver Json into object in php.
$obj =json_decode($json)
$obj->type= "Polygon";
$obj-> coordinates=[[[110.757526676,
-7.56198921399994], [110.76217, -7.56348],
[110.76217, -7.56348]]]
json_encode()
• Converting PHP object into JSON.
$obj->type= "Polygon";
$obj-> coordinates=[[[110.757526676,
-7.56198921399994], [110.76217, -7.56348],
[110.76217, -7.56348]]]
$obj =json_encode($json)
//put the attributes and geometry as array following GeoJson Feature structure,
$data = array("type"=>"Feature", "id"=>$row['OGR_FID'], "properties"=> $attributes, "geometry"=>$geom);
$json[$i]=$data; $i++;