Opasnet map: Difference between revisions
Jump to navigation
Jump to search
(→Static GoogleMaps test: function reorganised) |
(→Static GoogleMaps test: function MyRmap moved to OpasnetUtils/Drafts) |
||
Line 212: | Line 212: | ||
==== Static GoogleMaps test ==== | ==== Static GoogleMaps test ==== | ||
<rcode name='staticmapstest' graphics= | <rcode name='staticmapstest' graphics=1 embed=1> | ||
library(RgoogleMaps) | library(RgoogleMaps) | ||
Line 221: | Line 221: | ||
library(OpasnetUtils) | library(OpasnetUtils) | ||
library(OpasnetUtilsExt) | library(OpasnetUtilsExt) | ||
objects.latest("Op_en6007", code_name = "answer") # [[OpasnetUtils/Drafts]]. We need MyRmap. | |||
shp <- readOGR('PG:host=localhost user=postgres dbname=spatial_db','kuopio_house') | shp <- readOGR('PG:host=localhost user=postgres dbname=spatial_db','kuopio_house') | ||
proj4string(shp) <- ("+init=epsg:3067") # The map projection of NLS Finland. | |||
#oprint(shp@data[1:100 , ]) | #oprint(shp@data[1:100 , ]) | ||
epsg4326String <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs") | epsg4326String <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs") | ||
shp2 <- spTransform(shp,epsg4326String) # Convert to longitude-latitude projection. | |||
shp2 <- spTransform(shp,epsg4326String) | |||
# | |||
MyRmap(shp2, plotvar = "ika", legend_title = "Ikä", numbins = 8, pch = 19, cex = 0.3) # Draw the map. | |||
</rcode> | </rcode> |
Revision as of 14:16, 23 December 2013
Moderator:Jouni (see all) |
This page is a stub. You may improve it into a full page. |
Upload data
|
Question
How should GIS data be handled and visualised in Opasnet?
Answer
- Original GIS data is stored in a PostgreSQL database.
- Data is accessed by R using the RGDAL package and ?? connection.
- Data in manipulated in R.
- Ovariables are converted to SpatialPointsDataFrame objects using ova2spat function.
- Data is displayed by producing a KML file with ?? package.
- The KML file is created with MyPointKML function, if pins are shown.
- The KML file is saved at the R-tools server.
- Google Maps is used to show the KML file on a web page.
Currently, ova2spat and MyPointKML functions are located in OpasnetUtils/Drafts. Therefore, you need this command:
objects.latest("Op_en6007", code_name = "answer") # OpasnetUtils/Drafts. We need MyPointsKML and ova2spat.
This is the projection that the National Land Survey Finland uses: [1].
Key guidance:
- rgdal package for R
- sp package for R: contains descriptions about the key spatial objects.
- Changing the coordinate system of Spatial objects
Rationale
All pieces of the puzzle exist already.
Dependencies
Calculations
Kuopio buildings with Google pin map
GoogleMaps Sorvi MML TEST
⇤--#: . Something wrong with sorvi. --Jouni (talk) 12:54, 23 December 2013 (EET) (type: truth; paradigms: science: attack)
Google with shapefiles
Google show data from url on map
Google circles
Static GoogleMaps test
See also
Keywords
References
Related files
<mfanonymousfilelist></mfanonymousfilelist>