Tuesday 18 November 2014

ArcCatalog Error: This Feature already Exists


Sometimes you want to import new Feature class or rename a feature class in ArcCatalog/ArcMap but you can't do and an error appears that this names is already used but you cant see it in the list of features in the Catalog Tree, so where is this Feature!!!!

The Solution:


  • Open SQL Developer
  • log-in in SDE schema 
  • Open "GDB_ITEMS" Table and find the record which contains the name in "Name" field
  • Delete the record and commit

Enjoy 
 

Reuse Oracle Spatial Styles and themes

After you create Your styles and themes on a server and you want to use them on another server, follow the following procedure

Log-in to your user
  •  run the following scripts depending on you user 
         create table my_user_sdo_geom_metadata as select * from user_sdo_geom_metadata;
         create table my_user_sdo_styles as select * from user_sdo_styles;
         create table my_user_sdo_themes as select * from user_sdo_themes ;
         create table my_user_sdo_maps as select * from user_sdo_maps;
         create table my_user_sdo_cached_maps as select * from user_sdo_cached_maps;
        create table my_user_sdo_geor_sysdata as select * from user_sdo_geor_sysdata;

Now Log-in as sysdba and do the following
  • To pick a directory from all directories in your DB use the following scrip
select * from all_directories;
  • Grant the user to access the selected directory and also grant it to use remap 
GRANT READ, WRITE ON DIRECTORY EXP_DIR TO GIS_B
grant imp_full_database to gis_v1;
Now open The command prompt (cmd) as Admin and do the following
  • Run the following script and don't type ";" at the end
expdp gis_coding/gis_coding@ora11g tables=my_user_sdo_cached_maps,my_user_sdo_geom_metadata,my_user_sdo_geor_sysdata, my_user_sdo_maps,my_user_sdo_styles,my_user_sdo_themes directory=EXP_DIR dumpfile=stylesAndThemes.dmp logfile=stylesAndThemes.log
Now you have dump file contains your styles and themes, copy it to a database directory on the destination Server
  •  Repeat the granting step -look at the top of this document- to the new schem; which you want to move the data to it
Now open command prompt
  • Run the following script , and don't type ";" at the end
impdp gis_coding/gis_coding@ora11g  directory=EXP_DIR dumpfile=stylesAndThemes.dmp logfile=stylesAndThemesIMP.log REMAP_SCHEMA=gis_coding:gis_coding
Now log-in to your new schema which you imported the data in it

  •  Run the insert statement to insert all or specific data into "user_sdo_styles" or "user_sdo_themes" 

Enjoy 

Export Shape files from ArcCatalog in UTF-8 encoding

When you Export feature class which contain Arabic Texts to shape file the Arabic texts appears as "??????????", to avoid this problem and to get the correct conversion follow the following steps and see the screenshots


  1. Open regedit from Search in Win8/grater or from run in win7/less
  2. go to HKEY_CURRENT_USER\Software\ESRI\Desktop10.2
  3. If there is no key named "Common" create it and create a new key inside it as "CodePage"
  4. Create a new String Value and name it "dbfDefault" 
  5. Put "UTF-8" value of the Value Data 
Enjoy 




Saturday 8 November 2014

ESRI Raster geoimage to tiff format

To export the geo-image to other format like tiff follow the steps in the following screenshots




Thursday 30 October 2014

Arc GIS Spatial Index error

Sometimes when you move database schema from server to another server and try to open the spatial tables in ArcCataloge or ArcMap you will face the following error because the spatial index does not updated



To solve the error which is the same as in the previous screenshot follow the following


  1. Go the table in SQL developer if you use oracle
  2. Go to the indexes tab 
  3. find the domain index 
  4. get its name 
  5. Create script as the following and refresh you ArcCataloge database connection 


DROP indexName ;
CREATE INDEX theSameIndexName ON spatialTableName (geometryColumn) INDEXTYPE IS MDSYS.SPATIAL_INDEX;


Example:

DROP index A130_IX1 ;
CREATE INDEX A130_IX1 ON BACKGROUND (shape) INDEXTYPE IS MDSYS.SPATIAL_INDEX;



Tuesday 14 October 2014

Disable click outside of bootstrap modal area to close modal

On Options chapter, in the page you linked, you can see the backdrop option. Passing this option with value 'static' will prevent closing the modal.
If you opening the modal by js(with jQuery in this example), use:
$('#myModal').modal({backdrop: 'static'})  
If you are using data attributes, use:

< button data-target="#myModal" data-toggle="modal" data-backdrop="static">
   Invoke Modal
 </ button>

Monday 29 September 2014

Verify the GIS data

EXECUTE SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT('LB_BLOCKS_GIS','SHAPE','RANDOM_POINT_RESULTS',2);
--CALL SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT('LB_BUILDINGS_GIS','SHAPE','RANDOM_POINT_RESULTS');

select
  *
from
  LB_BLOCKS_GIS A, RANDOM_POINT_RESULTS B
where
  A.ROWID = B.SDO_ROWID;
 
  select * from RANDOM_POINT_RESULTS;
 
 
 
 






UPDATE user_sdo_geom_metadata
   SET diminfo = ( SELECT MDSYS.SDO_DIM_ARRAY(
                                MDSYS.SDO_DIM_ELEMENT('X', minx, maxx, 0.001),
                                MDSYS.SDO_DIM_ELEMENT('Y', miny, maxy, 0.001)) as diminfo
                     FROM ( SELECT TRUNC( MIN( v.x ) - 1,0) as minx,
                                   ROUND( MAX( v.x ) + 1,0) as maxx,
                                   TRUNC( MIN( v.y ) - 1,0) as miny,
                                   ROUND( MAX( v.y ) + 1,0) as maxy
                              FROM (SELECT SDO_AGGR_MBR(a.shape) as mbr
                                      FROM LB_QUARTERS_GIS a) b,
                                           TABLE(mdsys.sdo_util.getvertices(b.mbr)) v
                           )
                 )
 WHERE table_name = 'LB_ROADS_GIS_R';
 commit;
 
 
   delete from user_sdo_geom_metadata
   where table_name='LB_ROADS_GIS_R'
   ;
 
   --MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT(NULL,152796.6044,154204.896,0.001),MDSYS.SDO_DIM_ELEMENT(NULL,100965.676000001,102023.5385,0.001))
   --MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',152795,154206,0.001),MDSYS.SDO_DIM_ELEMENT('Y',100964,102025,0.001))

Wednesday 27 August 2014

Tuesday 15 July 2014

Change DB collation


ALTER DATABASE [Ratification] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

GO

ALTER DATABASE [Ratification] COLLATE Arabic_CI_AS;

GO

ALTER DATABASE [Ratification] SET MULTI_USER;

GO

--[Ratification] IS THE db NAME

Wednesday 28 May 2014

Oracle Commands




  • To connect from client use sqlplus and type (username/password@hostname/servicename(sid))
  • To list all tables names for the logged in user (select table_name from user_tables;)
  • To select cashed maps (select name from user_sdo_cached_maps;)

  • java.lang.OutOfMemoryError: Java heap space; It means Map builder requires more heap memory to load spatial data. To solve it.: Open the command line and start the Map Builder application as follows. java -jar -Xmx1024M D:\mapbuilder.jar





Sunday 30 March 2014

Execute Huge SQL Script File through SQLCM



Run Command Prompt as Administrator and cd in the folder which contains the DB script file

sqlcmd -S ServerName -d dataBaseName -i scriptFile.sql -o outputFile.txt

Thursday 27 February 2014

CSS




3 major CSS weaknesses
  •  Lack of essential basic features
  • Hard to maintain (huge messy CSS files)
  • Not DRY enough - leads to mistakes
“Variables... finally!”

Less, Sass, Stylus

You have to use 

  • for less variables
  • $   for Sass
  • = for Stylus
Less, Sass, Stylus They don't enhance CSS, but improve your development workflow


$my_blue: #4e6cb0; // Sass
@my_blue: #4e6cb0; // Less
my_blue = #4e6cb0; // Stylus
$primary_color: $my_blue;
h1 {
color: $primary_color;
}

$fonts: Helvetica, Arial, sans-serif;
$images_path: "../img/"
$font-size: 1.5em;
$margin: 20px;
$width: 80%;


Color functions
$light_blue: lighten($my_blue, 20%);
$flashy_blue: saturate($my_blue, 50%);

Nesting
.link {
            &:hover {
                    }
}
// ======== OUTPUT ========
.link {}
.link:hover {}

Don't nest too much (4 levels max)

  • Sass is written in Ruby
  • Less and Stylus are written in JavaScript
- This does NOT mean you need Ruby or Node on your production server to use them.
- You need them on your 
development machine

Tuesday 18 February 2014

To Delete Wireless Network Profile in a Command Prompt



This command will delete the wireless network profile
netsh wlan delete profile name="WirelessProfileName"



This command will give you a list of all wireless network profiles on your PC
netsh wlan show profiles

Sunday 16 February 2014

Available Area Units in Oracle Spatial

Open oracle sql plus tool and run the following query,
 you will see the following results
select distinct short_name, unit_of_meas_name 
from sdo_units_of_measure 
where unit_of_meas_type = 'area'; 
short_name unit_of_meas_name
SQ_METER Square Meter
SQ_KM Square Kilometer
SQ_CM Square Centimeter
SQ_IN Square Inch
SQ_LI Square Link
SQ_CENTIMETER Square Centimeter
SQ_ROD Square Rod
PERCH Perch
ROOD Rood
USER-SQ-HALF-METER
SQ_M Square Meter
SQ_INCH Square Inch
HECTARE Hectare
ACRE Acre
SQ_FT Square Foot
SQ_KILOMETER Square Kilometer
SQ_CH Square Chain
SQ_MILE Square Mile
SQ_YARD Square Yard
SQ_MM Square Millimeter
SQ_LINK Square Link
SQ_SURVEY_FOOT Square Survey Feet
SQ_MILLIMETER Square Millimeter
SQ_CHAIN Square Chain
SQ_FOOT Square Foot

Tuesday 11 February 2014

Export Oracle Databse to Dump file


login to database as sysdba


SQL> CREATE DIRECTORY dmpdir AS 'D:\dumpDire';

Directory created.

SQL> GRANT read, write ON DIRECTORY dmpdir TO sys;

Grant succeeded.

SQL> SELECT directory_path FROM dba_directories WHERE directory_name = 'DATA_PUM
P_DIR';

DIRECTORY_PATH
---------------------------------------------------------------------------

D:\oracle\app\admin\orcl\dpdump\


SQL>  $ expdp user/user@orcl DIRECTORY=dmpdir DUMPFILE=dumpFileName.dmp;